diff --git a/spec/adapters/postgres_spec.rb b/spec/adapters/postgres_spec.rb index 1239f1d32..fb0610f07 100644 --- a/spec/adapters/postgres_spec.rb +++ b/spec/adapters/postgres_spec.rb @@ -80,12 +80,16 @@ def c.exec_prepared(*); super; nil end t = [] @db[:test].lock('ACCESS EXCLUSIVE') do Thread.new do - @db.run "SET lock_timeout = 1" - t << @db.table_exists?(:test) + @db.synchronize do + @db.run "SET lock_timeout = 1" + t << @db.table_exists?(:test) + end end.join Thread.new do - @db.run "SET statement_timeout = 1" - t << @db.table_exists?(:test) + @db.synchronize do + @db.run "SET statement_timeout = 1" + t << @db.table_exists?(:test) + end end.join end t.must_equal [true, true]