ar_multi_threaded_transactional_tests

Execute multithreaded code while still using transactional fixtures by synchronizing db access to a single connection

MIT License

Downloads
27.1K
Stars
9
Committers
1

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 [email protected] License: MIT CI

Package Rankings
Top 17.51% on Rubygems.org