# Functional Test: post - Other controller

**URL:** <https://www.ruby-forum.com/t/functional-test-post-other-controller/55468>\
**Category:** Rails\
**Created:** [March 21, 2006, 1:37pm UTC](https://www.ruby-forum.com/t/functional-test-post-other-controller/55468 "2006-03-21T13:37:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashiro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e5b9ba/32.png) [@ashiro](https://www.ruby-forum.com/u/ashiro)\
**Post date:** [March 21, 2006, 1:37pm UTC](https://www.ruby-forum.com/t/functional-test-post-other-controller/55468/1 "2006-03-21T13:37:02Z")

</div>

Hi All

I’m attempting to get all of my tests clear after installing the Salted  
Hash  
Login generator. Now I’ve protected the entire application so login is  
required from all points. However I get a fail 302 on all other  
protected  
controllers 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 as I feeel I’m making strides on this  
now  
but just need to get over this little hurdle.

All the best

Doug

---

<div class="post-metadata">

**Author:** ![ashiro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e5b9ba/32.png) [@ashiro](https://www.ruby-forum.com/u/ashiro)\
**Post date:** [March 21, 2006, 5:38pm UTC](https://www.ruby-forum.com/t/functional-test-post-other-controller/55468/2 "2006-03-21T17:38:23Z")

</div>

get and post allow a third parameter: a hash that is the session.

So, pass in what SHLG expects to see in the session for an auth’d  
user, and your tests will pass.

–  
– Tom M.
