Skip to content

Commit

Permalink
Fix WrongScopeError when use_active_record = false
Browse files Browse the repository at this point in the history
Fixes #2417
  • Loading branch information
pirj committed Jan 20, 2021
1 parent 040fecc commit 23c42e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Bug Fixes:
(Phil Pirozhkov, Jon Rowe, #2353, #2354)
* Remove old #fixture_path feature detection code which broke under newer Rails.
(Koen Punt, Jon Rowe, #2370)
* Fix an error when `use_active_record` is `false` (Phil Pirozhkov, #2423)

### 4.0.1 / 2020-05-16
[Full Changelog](https://github.com/rspec/rspec-rails/compare/v4.0.0...v4.0.1)
Expand Down
14 changes: 7 additions & 7 deletions lib/rspec/rails/fixture_support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ module FixtureSupport
include RSpec::Rails::MinitestAssertionAdapter
include ActiveRecord::TestFixtures

if ::Rails.version.to_f >= 6.1
# @private return the example name for TestFixtures
def name
@example
end
end

included do
if RSpec.configuration.use_active_record?
include Fixtures
Expand Down Expand Up @@ -50,13 +57,6 @@ def proxy_method_warning_if_called_in_before_context_scope(method_name)
end
end
end

if ::Rails.version.to_f >= 6.1
# @private return the example name for TestFixtures
def name
@example
end
end
end
end
end
Expand Down

0 comments on commit 23c42e7

Please sign in to comment.