Rails tests with sessions

Hi

Until recently it was easy to log in a user in a test case by just
passing a parameter in the get method like this:

get :show, {:id => posts(:private_post).id}, { :user_id =>
users(:tesla).id }

Now with Ruby 1.8.6 and Rails 1.2.5 that doesn’t work anymore. What has
changed? I’ve tried this:

session[:user_id] = users(:tesla).id
get :show, {:id => posts(:private_post).id}

But session[:user_id] is always nil!

Thanks,
hawe.

I’ve always used @request.session[:foo]=:bar

Yes, I tried that too, but it looses the session information on the way.
Now I found out that it actually works for the action itself (the
session value is present), but not for before_filters (the session value
went away)!
And I can still pass the session information in a hash, as before.

So this seems to be a bug?

On 18 Nov 2007, at 11:00, Heiko Webers wrote:

has
changed? I’ve tried this:

session[:user_id] = users(:tesla).id
get :show, {:id => posts(:private_post).id}

I’ve always used @request.session[:foo]=:bar

Fred