search for: assert_session_ha

Displaying 6 results from an estimated 6 matches for "assert_session_ha".

Did you mean: assert_session_has
2006 Jun 17
3
What is this failure trying to tell me?
Here is my unit test code. post :login, :user=>{ :login => "bob", :password => "test"} assert_response :redirect assert_session_has :user assert_redirected_to :action => ''welcome'' Here is the failure I''m getting when I run my tests. 2) Failure: test_login_required(UserControllerTest) [test/functional/user_controller_test.rb:122]: response is not a redirection to all of the options supplie...
2006 May 03
0
Accessing the params hash in a functional test not working
...oblems reading params in a functional test (Rails 1.1.2). My test looks like this: fixtures :users def test_auth_bob @request.session[:return_to] = "/bogus/location" post :login, :user => { :email => "bob@example.com", :password => "test" } assert_session_has :user assert_equal @bob, @response.session[:user] assert_redirected_to "/bogus/location" end And the login action looks like: def login session[:debug_params] = params case @request.method when :post if session[:user] = User.authenticate(params[:user_ema...
2006 Mar 15
2
Session (stored in db) not working in testing mode
...#39;'config.action_controller.session_store = :active_record_store''. But now all my tests fail. I get the following error: 1) Failure: test_authorized_new(AdControllerTest) [c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/depr ecated_assertions.rb:23:in `assert_session_has'' ./functional/../test_helper.rb:34:in `login'' functional/ad_controller_test.rb:49:in `test_authorized_new'']: <:user_id> is not in the session <#<ActionController::TestSession:0x31d2198 @attributes={"flash"=>{}}>> Have I overlook...
2006 Mar 21
1
Functional Test: post - Other controller
...as I haven''t explicitly logged in and got the session. I thought adding the following to the beginning of my methods in the other controllers would be ok: post :login, "user" => { "login" => "username", "password" => "testpass" } assert_session_has "user" However, it assumes the current controller being tested. How do I go through the other login/user controller before running through these tests requiring user session data? Is there a way of simply setting the session data to bypass that test? Would much appreciate your help a...
2005 Dec 14
1
Problems with testing - error posting to other controller
...n, so I have written a login() that logs in a valid user and generates a session[:user_id], like: def login (login="bob", password="atest") post "user/login", :user => { :login => login, :password => password } assert_response 302 # redirect assert_session_has :user_id assert_equal 1000001, session[:user_id] assert_redirect_url "http://#{@request.host}/user/home" end and added it to test_helper.rb . In my ad_controller_test I call it like login(), but this throws an error. In my test.log it get the following Processing AdControll...
2005 May 18
10
Salted Login Generator issues
Hello all, I''ve just installed and begun to integrate the salted login generator. So far I''m very impressed, though I''ve hit a few snags along the way. Unfortunately, I''ve met the first one that I haven''t been able to resolve on my own. When I hit the login action, I get errors in my log files. The specific error with trace is included below.