Skip to content

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

License

Notifications You must be signed in to change notification settings

grosser/ar_multi_threaded_transactional_tests

Repository files navigation

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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages