Displaying 2 results from an estimated 2 matches for "test_logout".
Did you mean:
test_layout
2008 Jan 12
0
Can't test application controller methods in functional tests?
...t::Unit::TestCase
#add fixtures:
fixtures :messages, :message_threads, :message_boards, :forums
def setup
@controller = ForumController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
end
...
# test logout (all cases)
def test_logout
get :logout, nil, nil
assert_response :success
assert_nil session[:username]
assert_nil session[:admin]
get :logout, nil, {:username => ''bogus''}
assert_response :success
assert_nil session[:username]
assert_nil session[:admin]
get :logout,...
2006 Jun 06
14
How can I set the session in a functional test?
Hey :)
I need to simulate a login in my functional test, otherwise I can''t GET nor
POST to the action.
I need to set the session key "logged_in_user_id".
I tried this inside the setup() method:
session[''logged_in_user_id''] = 1
But that throws: TypeError: can''t convert String into Integer
Any ideas?
Thanks,
Rob
-------------- next part