module ForemanTasks::TestHelpers

Public Class Methods

test_in_thread_world() click to toggle source
# 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!() click to toggle source
# 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