Module: ForemanTasks::TestHelpers
- Defined in:
- lib/foreman_tasks/test_helpers.rb
Defined Under Namespace
Modules: WithInThreadExecutor
Class Method Summary
collapse
Class Method Details
.test_in_thread_world ⇒ Object
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/foreman_tasks/test_helpers.rb', line 9
def self.test_in_thread_world
return @test_in_thread_world if @test_in_thread_world
world_config = ForemanTasks.dynflow.config.world_config
if @use_in_memory_sqlite
world_config.persistence_adapter = lambda do |*_args|
::Dynflow::PersistenceAdapters::Sequel.new('adapter' => 'sqlite', 'database' => ':memory:')
end
end
@test_in_thread_world = ::Dynflow::Testing::InThreadWorld.new(world_config)
end
|
.use_in_memory_sqlite! ⇒ Object
4
5
6
7
|
# File 'lib/foreman_tasks/test_helpers.rb', line 4
def self.use_in_memory_sqlite!
raise 'the in thread world have already been initialized' if @test_in_thread_world
@use_in_memory_sqlite = true
end
|