Is there any way to logout and login another user when testing with Authlogic?
The following test case just fails
class MessagesControllerTest < ActionController::TestCase
setup :activate_authlogic
should "sender send a message and recipient delete it" do
@sender = Factory(:user, :login => sender )
@recipient = Factory(:user, :login => recipient )
UserSession.create(@sender)
post :create, :user_id => @recipient.id, :message => Factory.attributes_for(:message)
assert_equal @sender, assigns(:current_user)
UserSession.create(@recipient)
post :destroy, :user_id => @recipient.id, :message => @message
assert_equal @recipient, assigns(:current_user)
end
end
The crazy thing is that request session params look ok...
# UserSession.create(@sender)
"user_credentials"=> "605a73e0f1b4dcecf5495d549b9d33eb6d3197f3a1fdb033c86bca456a0a0c75a42b63c924edb5d071f6d748aea3870f312a908eb501e6814c69abdab9bbf387",
"user_credentials_id"=>1
# UserSession.create(@recipient)
"user_credentials"=> "e14363b2065b7202e766205e807d6b531e230a136c70ea13c0853c7c0f275fb95f0185b9f17a934483cadda693e50956d1bfda8c820895f574a06861479af18c",
"flash"=>{:notice=>"Message was successfully created."},
"user_credentials_id"=>2