Skip to content

Commit

Permalink
Fix WrongScopeError being thrown on Rails master:
Browse files Browse the repository at this point in the history
- ### Problem

  Rails made a change in rails/rails@d4367eb
  and TestFixtures don't make use of `method_name` anymore, but simply
  `name`.

  `name` on RSpec raises a `WrongScopeError` when called within an
  example.

  This patch overrides `name` to return the example name instead.
  • Loading branch information
Edouard-chin committed Dec 2, 2019
1 parent d0f81df commit 5bfbfff
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/rspec/rails/fixture_support.rb
Expand Up @@ -50,6 +50,10 @@ def self.proxy_method_warning_if_called_in_before_context_scope(method_name)
end
end

def name
@example
end

fixtures RSpec.configuration.global_fixtures if RSpec.configuration.global_fixtures
end
end
Expand Down

0 comments on commit 5bfbfff

Please sign in to comment.