Skip to content

Commit

Permalink
Merge pull request rspec#2480 from tagliala/fix-rails42-compatibility
Browse files Browse the repository at this point in the history
Fix support for Rails 4.2
  • Loading branch information
JonRowe authored Mar 10, 2021
2 parents c100cf1 + c4e2647 commit 9629a72
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/rspec/rails/fixture_support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@ module FixtureSupport
# @private prevent ActiveSupport::TestFixtures to start a DB transaction.
# 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'
def run_in_transaction?
use_transactional_tests && !self.class.uses_transaction?(self)
end
else
def run_in_transaction?
use_transactional_fixtures && !self.class.uses_transaction?(self)
end
end

included do
Expand Down

0 comments on commit 9629a72

Please sign in to comment.