Execute multithreaded code while still using transactional fixtures by synchronizing db access to a single connection
Install
gem install ar_multi_threaded_transactional_tests
Usage
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
Author
Michael Grosser
michael@grosser.it
License: MIT