A quick gotcha we ran into when using polymorphic path and rspec2 today.
In a controller test we had an assertion:
Which resulted in the following error
Failure/Error: Unable to find matching line from backtrace stack level too deep # ~/.rvm/gems/ruby-1.9.2-p0@gemset/gems/rspec-expectations-2.1.0/lib/rspec/matchers/method_missing.rb:4
It turns out polymorphic path is not available in the controller test (but the usual object_path method is). As to why this throws a stack level too deep and not a method undefined looks like potentially another bug in rspec but the solution seemed to be to do the following in our spec_helper.b for Rails 3:
For Rails 2.x you’ll want to use:
I’ve opened an issue for this on github as well https://github.com/rspec/rspec-expectations/issues/issue/46
About the AuthorMore Content by Pivotal Labs