On Wed, Sep 2, 2009 at 3:34 AM, Jeremy Hageman<jjhage...@gmail.com> wrote: > > But this is not possible since current_user is a method unavailable to > the specs. At this point I realize this situation is much better > served by stubbing and mocking the functions and models.
Why isn't current_user available to your controller specs? If you defined it in ApplicationController, and your controller inherits from that, then it's just another method on your controller. You may or may not want to stub it for convenience, to return a mock or a factory model, but it should be accessible either way. As for which to use: I've done both, and at this moment I'm not sure I could pin down a rhyme or reason for you. It's whatever seems easier given my current thinking at the time, or sometimes doing neither. The important thing isn't really "how do I fake out the stuff that I'm *not* testing in this spec," but rather "why am I testing this code?" (i.e. "what do I think might break here?") and "what do I need to do to establish that this code works or doesn't work?" Mocks and factories are just details to get you there. -- Have Fun, Steve Eley (sfe...@gmail.com) ESCAPE POD - The Science Fiction Podcast Magazine http://www.escapepod.org _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users