This project is archived and is in readonly mode.

#1263 ✓invalid
ronin-35527 (at lighthouseapp)

#put method does not respect sessions in functional tests

Reported by ronin-35527 (at lighthouseapp) | October 24th, 2008 @ 10:23 AM | in 2.x

In my functional tests I'm testing two actions in two different controllers. The first action "save" in the SettingsController is tested like this:


login_as :quentin
put :save, {}, :settings => [{:id => settings(:site_name).id, :value => "Hello world"}]
assert_redirected_to :controller => "settings", :action => "index"

The #login_as helper method looks like this:


def login_as(user)
  @request.session[:user_id] = user ? users(user).id : nil
end

It assigns a session variable to the request. My other action "update" in the PagesController is also tested like above, using the #put method that makes a new PUT request. But the two tests fails and the failure message is similar to this:


expected a redirect to <{"action"=>"index", "controller"=>"settings"}>, found one to <{"action"=>"ne
w", "controller"=>"sessions"}>, a difference of <{"action"=>"new", "controller"=>"sessions"}>

What this actually means is, that there is no "user_id" session variable which must mean that #put doesn't respect sessions. Can anyone confirm this?

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages