I've narrowed the problem a bit. It now seems that follow_redirect in
one test will break an ActionController's +verify+ directive in another,
later test.
I am ashamed to say my code fragment was not accurate. Here is the
correct code:
======
class AdminControllerTest < Test::Unit::TestCase
# #setup puts user credentials in @session
def test_approve_not_post
get :approve, { :id => 3 }, @session
assert_response :redirect
assert_redirected_to :action => :list
assert_equal 'You cannot do this directly.', flash[:notice]
### OMITTED IN ORIGINAL - SORRY ###
follow_redirect
assert_response :success
end
def test_deny_not_post
get :deny, { :id => 3 }, @session
assert_response :redirect
assert_redirected_to :action => :list
assert_equal 'You cannot do this directly.', flash[:notice]
### OMITTED IN ORIGINAL - SORRY ###
follow_redirect
assert_response :success
end
end
======
Note that I have the tests follow the redirect_to arising from the
failed +verify+.
I have discovered that if I comment-out the follow_redirect and
assert_response calls in test_approve_not_post, then +verify+ will
redirect correctly in test_deny_not_post. Remember it was the
assert_redirected_to, and the redirection hash, that broke.
So now: follow_redirect breaks an ActionController's +verify+ handling.
before_filter and after_filter don't have this problem. Is this a
peculiarity of functional tests -- and can I therefore ignore it? I'd
rather be able to test the redirection.
Should I update beyond Rails 1.2.6? 2.x is not feasible for my
deployment.
Again, I'm sorry about mischaracterizing the code.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---