I'm trying to write some functionnal tests for one of my controllers and I've got a strange problem. In my test code I'm doing the following :
def test_index_user_not_login
get :index
assert_response :redirect
assert_redirected_to :controller => "user", :action => "login"
end
and when I launch the test, I've got this error :
1) Failure:
test_index_user_not_login(Admin::ConfigurationControllerTest) [./test/functional/admin/configuration_controller_test.rb:20]:
response is not a redirection to all of the options supplied (redirection is <{:action=>"login", :controller=>"user"}>), difference: <{}>
So if I understand, the testing tasks tells me that my redirection isn't correct (I test it by hand and it works well) and that's the difference is {}, so nothing different ... Odd.
What is the actual redirect_to call? I’ve found that Rails can be quite picky with functional tests and redirect checking, so make sure that the url_options are the exact same in both places.