Functional Test: post - Other controller

Hi All

I’m attempting to get all of my tests clear after installing the Salted
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
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
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
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
but just need to get over this little hurdle.

All the best


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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs