Jonathan Leighton
2008-Jul-23 16:16 UTC
[rspec-users] Routes not working properly inside "helper"
I have been upgrading my helper specs due to the recent change regarding mixing in modules: http://blog.davidchelimsky.net/2008/5/29/rspec-waving-bye-bye-to-implicit-module-inclusion 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 error: 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'' ./spec/helpers/application_helper_spec.rb:151: If I include the module directly into the spec it works fine. Any ideas? Cheers, Jon
David Chelimsky
2008-Jul-23 16:28 UTC
[rspec-users] Routes not working properly inside "helper"
That''s a bug in 1.1.4 which is fixed in git. If you grab the latest you should be OK. On Wed, Jul 23, 2008 at 11:16 AM, Jonathan Leighton <j at jonathanleighton.com> wrote:> I have been upgrading my helper specs due to the recent change regarding > mixing in modules: > http://blog.davidchelimsky.net/2008/5/29/rspec-waving-bye-bye-to-implicit-module-inclusion > > 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 > error: > > 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'' > ./spec/helpers/application_helper_spec.rb:151: > > If I include the module directly into the spec it works fine. > > Any ideas? > > Cheers, > Jon > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >