Skip to content

undefined method 'message' with route specs and current rails master #679

Closed
seanwalbran opened this Issue Jan 26, 2013 · 8 comments

3 participants

@seanwalbran

While it looks to me like the root cause is a rails-core issue rather than an rspec-rails issue, I just wanted to open this here in case that interpretation is incorrect.

    Failure/Error: it { { :get => '/blah' }.should route_to(:controller => 'blah') }
     NoMethodError:
       undefined method `message' for #<RSpec::Core::ExampleGroup::Nested_1:0x007ffc79883d80>
     # /Users/seanwalbran/projects/rails/actionpack/lib/action_dispatch/testing/assertions/routing.rb:171:in `method_missing'
     # /Users/seanwalbran/projects/rails/actionpack/lib/action_dispatch/testing/assertions/routing.rb:47:in `assert_recognizes'

There are a few more details here: rails/rails#9085

@alindeman
@seanwalbran

It's reproducible with current master rspec-rails. Looks like it's a side effect of this filtering:
https://github.com/rspec/rspec-rails/blob/master/lib/rspec/rails/adapters.rb#L83
and while the diff in the below makes it work, I'm personally not excited about the prospect of that getting applied:
rails/rails#9085 (comment)

@alindeman

It's reproducible with current master rspec-rails. Looks like it's a side effect of this filtering:
https://github.com/rspec/rspec-rails/blob/master/lib/rspec/rails/adapters.rb#L83
and while the diff in the below makes it work, I'm personally not excited about the prospect of that getting applied:
rails/rails#9085

Routing specs no longer use that adapter. I'm working up an example Rails app to verify this is still an issue. I really thought I fixed it in 2.12.1.

@alindeman

Yah, I can't reproduce this with rspec-rails 2.12.1 or master on Rails 4 master. Are you sure you've upgraded to that version or later? And aren't running something spork or zeus that might be running old code?

Note that I can reproduce this error on rspec-rails 2.12.0 or below.

@seanwalbran

Gah, you're absolutely right, many apologies. I'd started out with 2.12.0, verified it there, then had switched to testing "it { assert_recognizes ... }" directly (attempting to eliminate rspec-rails as the source of the issue) for the rest of my testing.

Works great in 2.12.2. Again, sorry for the confusion.

@seanwalbran

Routing specs no longer use that adapter

Ok, I wasn't completely crazy: I can reproduce this error with rspec-rails master with a route_to matcher in a Controller spec (under spec/controllers/ ), versus a dedicated routing spec (under spec/routing/)... which is confusing behavior, but I'm happy to call that 'user error' at this point.

@alindeman

Routing specs no longer use that adapter

Ok, I wasn't completely crazy: I can reproduce this error with rspec-rails master with a route_to matcher in a Controller spec (under spec/controllers/ ), versus a dedicated routing spec (under spec/routing/)... which is confusing behavior, but I'm happy to call that 'user error' at this point.

You're totally right. We do mix in the routing assertions to controller specs too, so we need the same fix there.

@alindeman alindeman reopened this Jan 26, 2013
@alindeman alindeman was assigned Feb 16, 2013
@jcoyne jcoyne referenced this issue in projectblacklight/blacklight Feb 27, 2013
Closed

Rails 4: undefined method `message' #536

@zeeraw
zeeraw commented Mar 14, 2013

I reproduced this issue with rails/rails#master & rspec/rspec-rails#master.

@alindeman alindeman added a commit that referenced this issue Apr 7, 2013
@alindeman alindeman Changelog for #679
[ci skip]
810dcc1
@alindeman alindeman closed this in b4b490c Apr 7, 2013
@alindeman alindeman added a commit that referenced this issue Apr 7, 2013
@alindeman alindeman Changelog for #679
[ci skip]
3d4f317
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.