When mocking, does it scan the method being tested for outside calls?

Say I want to test this method:

def modify_user_status(user_id)

user = User.find(user_id)


end

Now could I mock the call to User.find()?

I’m just trying to understand, when I run the test, and say I mocked the
call to User.find, then rspec realizes this and replaces it with the
mocked
call.

Is this correct?

On May 3, 2011, at 2:27 PM, S Ahmed wrote:

end

Now could I mock the call to User.find()?

I’m just trying to understand, when I run the test, and say I mocked the call to
User.find, then rspec realizes this and replaces it with the mocked call.

Is this correct?

Please post the example so we have something specific to talk about.

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