test/non_instance_test.rb in querrel-1.1.0 vs test/non_instance_test.rb in querrel-1.2.0

- old
+ new

@@ -1,5 +1,6 @@ +require 'thread' require_relative 'setup/test_helper' class NonInstanceTest < Querrel::Test def setup super @@ -36,8 +37,25 @@ names = Product.pluck(:name) res = Querrel.query(Product.all, on: @dbs) do |scope| scope.pluck(:name) end - assert names * @dbs.length, res + assert_equal names * @dbs.length, res + end + + def test_runner + s = Mutex.new + configs_actual = [] + Querrel.run(on: @dbs) do |q| + s.synchronize do + configs_actual << q[Product].connection_config + end + end + + configs = Querrel::ConnectionResolver.new(@dbs, false).configurations.values + + configs = configs.map{ |c| Hash[c.map{ |k, v| [k.to_s, v] }] }.sort_by{ |c| c["database"] } + configs_actual = configs_actual.map{ |c| Hash[c.map{ |k, v| [k.to_s, v] }] }.sort_by{ |c| c["database"] } + + assert_equal configs, configs_actual end end \ No newline at end of file