Module: FactoryBot

Defined in:
lib/ledger_sync/test/support/factory_bot.rb

Defined Under Namespace

Classes: DefinitionProxy

Class Method Summary collapse

Class Method Details

.rand_id(*appends, include_test_run_id: true) ⇒ Object



91
92
93
94
95
96
97
98
99
# File 'lib/ledger_sync/test/support/factory_bot.rb', line 91

def self.rand_id(*appends, include_test_run_id: true)
  ret = ''
  ret += test_run_id if include_test_run_id
  ret += (0...8).map { rand(65..90).chr }.join
  appends.each do |append|
    ret += "-#{append}"
  end
  ret
end

.test_run_id(*appends, **keywords) ⇒ Object



101
102
103
104
105
106
# File 'lib/ledger_sync/test/support/factory_bot.rb', line 101

def self.test_run_id(*appends, **keywords)
  @test_run_id ||= rand_id(
    *appends,
    **keywords.merge(include_test_run_id: false)
  )
end