Execute multithreaded code while still using transactional fixtures by synchronizing db access to a single connection
gem install ar_multi_threaded_transactional_tests
require 'ar_multi_threaded_transactional_tests'
it "stays in sync" do
ArMultiThreadedTransactionalTests.activate do
Array.new(10).map { Thread.new { 10.times { User.create! } } }.each(&:join)
end
end
Alternatively use .activate
and .deactivate
Michael Grosser
[email protected]
License: MIT