I have a controller test, where I want to do a GET on a page. Our URL’s
complex, and need to be correct (duh, but we allow some slop, but that
causes a redirect which I want to avoid). Anyway, in my controller test
do a get to the URL that is produced by a helper method which calls a
route URL helper. This is not working, and I’m wondering why/what I’m
messing up. Here’s the line in the spec code that starts things off
(@widget is a real ActiveRecord object):
The widget_path_for_seo method is defined in our ApplicationController.
digs some info out of the widget instance that then get passed to the
route URL helper method, so it looks like this:
location = seo_name_for_url widget.location.name
true) + “-widgets”
widget_id = seo_name_for_url(widget.name) + “-” + widget.id.to_s
seo_widget_path(:location => location, : building => building, :id
It’s the “seo_widget_path” named route helper method that is failing.
checked that all values going into it are valid, but the error I get is
ActionController::Base.url_for, where it’s looking at the options hash
values that are passed in, and doing this:
It compalins that @url is nil. I’m wondering if this is due to being
under the test environment or what I’m missing/not realizing, etc.
strange is that some of the restful resource route url helpers work
Can anyone clue me in?