[rspec-users] Routes not working properly inside "helper"

Jonathan Leighton j at jonathanleighton.com
Wed Jul 23 12:16:23 EDT 2008

I have been upgrading my helper specs due to the recent change regarding
mixing in modules:

Unfortunately I have hit a snag. It seems that when the helper uses
routes I get an error about a nil object. For instance, if one of my
helper methods calls the route "new_company_path", I get the following

You have a nil object when you didn't expect it!
The error occurred while evaluating nil.url_for
(eval):45:in `new_company_path'
RAILS_ROOT/app/helpers/application_helper.rb:64:in `format_address'

If I include the module directly into the spec it works fine.

Any ideas?


More information about the rspec-users mailing list