From b044d950198925ea5f7d61a84f12bd7d069b0e18 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Wed, 10 Mar 2021 10:01:00 +0100 Subject: [PATCH] Fix support for Rails 4.2 Rails 4.2 does not have `use_transactional_tests` defined Fix #2477 --- lib/rspec/rails/fixture_support.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/rspec/rails/fixture_support.rb b/lib/rspec/rails/fixture_support.rb index 12acfdfbd6..22bc4c8253 100644 --- a/lib/rspec/rails/fixture_support.rb +++ b/lib/rspec/rails/fixture_support.rb @@ -13,7 +13,11 @@ module FixtureSupport # Monkey patched to avoid collisions with 'let(:name)' in Rails 6.1 and after # and let(:method_name) before Rails 6.1. def run_in_transaction? - use_transactional_tests && !self.class.uses_transaction?(self) + if ::Rails::VERSION::STRING > '5' + use_transactional_tests && !self.class.uses_transaction?(self) + else + use_transactional_fixtures && !self.class.uses_transaction?(self) + end end included do