[rspec-users] Testing arbitrary post action parameters

James Byrne lists at ruby-forum.com
Sat Jan 17 18:49:30 EST 2009


I still cannot get this to work.  Tracing the actual calls in the log I 
see this:


Processing UsersController#index (for 127.0.0.1 at 2009-01-17 18:32:54) 
[PUT]
  Parameters: {"action"=>"index", "controller"=>"users", "user"=>"2"}
  User Load (16.0ms)   SELECT * FROM "users"
Rendering template within layouts/application
Rendering users/index
  SQL (0.0ms)   SELECT count(*) AS count_all FROM "users" WHERE 
(last_request_at > '2009-01-17 18:22:54')
  User Load (0.0ms)   SELECT * FROM "users" WHERE ("users"."id" = 1) 
LIMIT 1
  User Update (0.0ms)   UPDATE "users" SET "updated_at" = '2009-01-17 
23:32:54', "last_request_at" = '2009-01-17 18:32:54' WHERE "id" = 1
Completed in 110ms (View: 94, DB: 16) | 200 OK 
[http://www.example.com/users?user=2]
  User Load (0.0ms)   SELECT * FROM "users" WHERE ("users"."username" = 
'myuser')

This is my users_controller/update action:

  # PUT /users/1
  # PUT /users/1.xml
  def update
    @user = @current_user
    if @user.update_attributes(params[:user])
      flash[:notice] = 'User Account Changes Saved'
      redirect_to account_url
    else
        render :action => "edit"
    end
  end
-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list