rspec/rspec-rails — Issue #456: The polymorphic_path method is not available
Author: theycallmeswift
Created: 2011-10-26 19:54:31+00:00
State: open

Although normal path helpers (ex. `users_path`, `edit_books_path`, etc.) are available, the `polymorphic_path` method is not available.

I have an assertion like this:

should redirect_to(polymorphic_path(some_model))

And the following error occurs:

Failure/Error: should redirect_to(polymorphic_path(some_model))
NoMethodError:
undefined method `polymorphic_path' for #

Did a little bit of searching around google and found that the fix is:

include Rails.application.routes.url_helpers

System info: Rails 3.0.3, RSpec 2.6.0, RSpec Rails 2.6.1