New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WrongScopeError exception with edge rails #37783
Comments
Last working commit: 3f14733 Temporary workaround if you must use edge rails and rspec:
I'm not well versed enough on rspec's or the rails test framework internal workings to diagnose this further, but this seemed to have helped in the interim for me. |
@Edouard-chin - This appears to be your commit that introduced the "name" variable that is mentioned in this issue's gist. d4367eb I would appreciate it if you would check this out. Thanks. |
ACK, let me think of a way to fix it. Didn't know RSpec used |
@Edouard-chin - Rspec might be using "name" as a variable. |
Attempted a fix in rspec-rails rspec/rspec-rails#2215 as I don't think the fix should be in Rails itself. |
@Edouard-chin - Thanks for following up on this issue. |
This has been addressed in rspec/rspec-rails#2215. |
Related errors below. == Test WrongScopeError Error: ``` Failures: 1) Posts API (Custom Controller) GET /posts returns a list of posts Failure/Error: raise WrongScopeError, "`#{name}` is not available from within an example (e.g. an " \ "`it` block) or from constructs that run in the scope of an " \ "example (e.g. `before`, `let`, etc). It is only available " \ "on an example group (e.g. a `describe` or `context` block)." `name` is not available from within an example (e.g. an `it` block) or from constructs that run in the scope of an example (e.g. `before`, `let`, etc). It is only available on an example group (e.g. a `describe` or `context` block). # /Users/alexkitchens/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rspec-core-3.8.0/lib/rspec/core/example_group.rb:742:in `method_missing' # /Users/alexkitchens/fun/journey/dependencies/rails/actionpack/lib/action_dispatch/testing/assertions/routing.rb:188:in `method_missing' # /Users/alexkitchens/fun/journey/dependencies/rails/actionpack/lib/action_dispatch/testing/integration.rb:422:in `method_missing' # /Users/alexkitchens/fun/journey/dependencies/rails/activerecord/lib/active_record/test_fixtures.rb:101:in `run_in_transaction?' # /Users/alexkitchens/fun/journey/dependencies/rails/activerecord/lib/active_record/test_fixtures.rb:115:in `setup_fixtures' # /Users/alexkitchens/fun/journey/dependencies/rails/activerecord/lib/active_record/test_fixtures.rb:8:in `before_setup' # /Users/alexkitchens/fun/journey/dependencies/rails/actionpack/lib/action_dispatch/testing/integration.rb:331:in `before_setup' # /Users/alexkitchens/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rspec-rails-3.8.2/lib/rspec/rails/adapters.rb:126:in `block (2 levels) in <module:MinitestLifecycleAdapter>' # /Users/alexkitchens/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rspec-core-3.8.0/lib/rspec/core/example.rb:447:in `instance_exec' # /Users/alexkitchens/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rspec-core-3.8.0/lib/rspec/core/example.rb:447:in `instance_exec' # /Users/alexkitchens/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/rspec-core-3.8.0/lib/rspec/core/hooks.rb:373:in `execute_with' # # Showing full backtrace because every line was filtered out. # See docs for RSpec::Configuration#backtrace_exclusion_patterns and # RSpec::Configuration#backtrace_inclusion_patterns for more information. ``` Bisect led to d4367eb72601f6e5bba3206443e9d141e9753af8 Issue opened here: rails/rails#37783 Fix in Rspec Rails here: rspec/rspec-rails#2215 The fix is not in a full release yet, so I've pinned to the latest beta release. ``` commit d4367eb72601f6e5bba3206443e9d141e9753af8 Author: Edouard CHIN <edouard.chin@shopify.com> Date: Thu Nov 21 18:39:54 2019 +0100 Modify ActiveRecord::TestFixtures to not rely on AS::TestCase: - ### Problem If one wants to use ActiveRecord::TestFixtures it is mandatory for the test suite to inherit from `ActiveSupport::TestCase`. TestFixtures makes use of specific method from AS::TestCase (`file_fixture_path` and `method_name`). ### Solution This PR fixes that by not making use of method_name and file_fixture_path. ``` == Time Issue Error: ``` Failure/Error: require File.expand_path('../../config/environment', __FILE__) NoMethodError: undefined method `hour' for 1:Integer Run options: include {:locations=>{"./spec/requests/api/posts_spec.rb"=>[10]}} ``` Bisect led to commit 12959dee0f19a8e050dd1236b031c2c690729905 Issue open at rails/rails#37391
This morning (11/23/2019) I'm getting a new error with 3 repos. Here is an example repo.
Steps to reproduce
https://gist.github.com/jasnow/2edc53d905d26870bb2e77221c71ab29
Expected behavior
Expect "rake" to run with no errors/exceptions. See step 2 above.
Actual behavior
See step 4 above.
System configuration
Rails version: 6.1.0.alpha
Ruby version: ruby 2.7.0preview2 (2019-10-22 master 02aadf1032) [x86_64-darwin16]
The text was updated successfully, but these errors were encountered: