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: <{}>
The redirect_to I use is using exactly the same parameters than those used in the assertion.
So if I understand, the testing task tells me that my redirection
isn't correct (I tested it by hand and it works well) and that the
difference is {}, so nothing different ... Odd.
If I change:
assert_redirected_to :controller => "user", :action => "login"
to:
assert_redirected_to @controller.url_for(:controller => 'user', :action => 'login')
it works like a charm ...