# Accessing the params hash in a functional test not working

**URL:** <https://www.ruby-forum.com/t/accessing-the-params-hash-in-a-functional-test-not-working/59432>\
**Category:** Rails\
**Created:** [May 3, 2006, 7:06pm UTC](https://www.ruby-forum.com/t/accessing-the-params-hash-in-a-functional-test-not-working/59432 "2006-05-03T19:06:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dan\_Venkitachalam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/2bfe46/32.png) [@Dan\_Venkitachalam](https://www.ruby-forum.com/u/Dan_Venkitachalam)\
**Post date:** [May 3, 2006, 7:06pm UTC](https://www.ruby-forum.com/t/accessing-the-params-hash-in-a-functional-test-not-working/59432/1 "2006-05-03T19:06:21Z")

</div>

I am having problems 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 =\> “removed\_email\_address@domain.invalid”, :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\_email],  
params[:user\_password])  
flash[:notice] = "You are now logged in as  
"+session[:user].fullname  
redirect\_back\_or\_default :action =\> “welcome”  
else  
flash[:error] = “The email address and/or password you entered  
is  
invalid.”.t  
redirect\_back\_or\_default :action =\> “login”  
end  
end  
end

The test fails as follows. Note that session[:debug\_params] is missing  
the  
parameters sent by post.

1. Failure:  
test\_auth\_bob(UserControllerTest)  
[c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1  
/lib/action\_controller/depr  
ecated\_assertions.rb:23:in `assert_session_has' ./test/functional/user_controller_test.rb:25:in`test\_auth\_bob’]:  
\<:user\> is not in the session \<#\<ActionController::TestSession:0x36a8380  
@attributes=  
{:user=\>nil,  
:debug\_params=\>{“action”=\>“login”},  
“flash”=\>  
{:error=\>“The email address and/or password you entered is  
invalid.”},  
:return\_to=\>nil}\>\>

I am stumped figuring out why the params are not being passed through -  
any  
help appreciated!

Cheers,

Dan.
