Sha256: 3e1142720004cf36b20f131d343c8b74f7a125c6de32ccc24c6731c15b297aa9
Contents?: true
Size: 1.05 KB
Versions: 37
Compression:
Stored size: 1.05 KB
Contents
require 'dynflow/testing' module ForemanTasks module TestHelpers 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 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 module WithInThreadExecutor extend ActiveSupport::Concern included do setup do @old_dynflow_world = ForemanTasks.dynflow.world ForemanTasks.dynflow.world = ForemanTasks::TestHelpers.test_in_thread_world end teardown do ForemanTasks.dynflow.world = @old_dynflow_world end end end end end
Version data entries
37 entries across 37 versions & 1 rubygems