Using url helpers in Rails functional tests

Posted by mick on March 13th, 2009 filed in Ruby on Rails

Today I wrote a very simple functional test that had a line as follows:


    assert_redirected_to new_session_url
 

When I ran it I got the following error:


Missing host to link to! Please provide :host parameter or set default_url_options[:host]
 

The fix was simple. Instead of using a url helper, I should have been using a path helper.


    assert_redirected_to new_session_path
 

After this change, the test worked perfectly.

Leave a Comment

//