Testing user_controller update action

Hello everyone,

I’m trying to test the update action in my user controller, but
unfortunately having troubles. You can find all of my code and relevant
code here: http://pastie.org/private/odzbqvcoe8kdnh97ocaxia

You can find the exact RSpec error here:
http://pastie.org/private/pnpr3dgst1m50ixt4jufiq

In the first, I have the development.log to show the working log, on my
local server. That’s what I see when I update a user via the
application.

The test log is the log when running the spec. Please let me know if
anyone can think of anything that can point me in the right direction,
or inform me of something I may be doing wrong.

Thanks!
Andrew D.

Okay…

Problem temporarily solved.

Turns out it has to do with my before filter. I have:

before_filter :authenticate_user!
before_filter :set_conditions

in the application controller. And:

before_filter :authorize

At the top of the users_controller.

For some reason it works with those commented out. But still not at the
final solution yet.

To post a solution to my problem:

describe “PUT ‘update’” do
before(:each) do

  User.should_receive(:find).with(:first, 

{:conditions=>{:id=>@user.id}}).and_return(@user)
User.should_receive(:find).with(@user).and_return(@user)
end
.
.
.

The first line is for the authentication.