From 4a0e64d361491ec2bec995572b23e3f2e6920f15 Mon Sep 17 00:00:00 2001 From: mokha Date: Fri, 13 Jul 2018 14:38:15 -0600 Subject: rollback legacy db transactions. --- spec/rails_helper.rb | 2 +- spec/support/legacy_record.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 spec/support/legacy_record.rb diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index bbe1ba5..ccfd92e 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -20,7 +20,7 @@ require 'rspec/rails' # directory. Alternatively, in the individual `*_spec.rb` files, manually # require only the support files necessary. # -# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } +Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } # Checks for pending migrations and applies them before tests are run. # If you are not using ActiveRecord, you can remove this line. diff --git a/spec/support/legacy_record.rb b/spec/support/legacy_record.rb new file mode 100644 index 0000000..bdbab33 --- /dev/null +++ b/spec/support/legacy_record.rb @@ -0,0 +1,9 @@ +RSpec.configure do |config| + config.before(:each) do + LegacyRecord.connection.begin_transaction joinable: false + end + + config.after(:each) do + LegacyRecord.connection.rollback_transaction + end +end -- cgit v1.2.3