[rspec-users] HowTo Specify A Method is Called Within A Controller's Action

Lee Longmore lee_longmore at yahoo.co.uk
Sat May 16 02:08:01 EDT 2009

I am new to RSpec and would appreciate some pointers on how to specify the following for my Rails application...

I have a controller called ContextsController and, within this, the usual 'create' method. The first line of this method should be:

@member = logged_in_member

where logged_in_member is a method that, for simplicity's sake, is a private method of the ContextsController and retrieves a Member model object based on the user_id in the session. I haven't written this method yet so would like to stub it out for now.

What might an Example look like to spec this expected behaviour? 

In particular, I can't work out how to specify that logged_in_member is called.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090516/cd42ff48/attachment.html>

More information about the rspec-users mailing list