I’m having a strange problem with an assert_redirected_to in my
controller test which hopefully someone can point out my failings with!
Controller method -
def new
if request.post?
#Not important here.
else
flash[:notice] = ‘Please join a tree from this page.’
redirect_to :controller => ‘trees’, :action => ‘list’
end
end
And the failing test and result -
def test_new_using_get
get ‘new’
assert_response :redirect
assert_redirected_to :controller => ‘trees’, :action => ‘list’
end
Test::Unit::AssertionFailedError: response is not a redirection to all
of the options supplied (redirection is <{:action=>“list”,
:controller=>“trees”}>), difference: <{}>
I’m sure I’m missing something obvious but I haven’t managed to track it
down and Googling didn’t turn up anything of use. Surely an empty
difference is no difference?
Thanks in advance,
Ross