[rspec-users] Named routes problem... more rails than rspec

David Chelimsky dchelimsky at gmail.com
Mon Jan 31 00:54:07 EST 2011

On Jan 30, 2011, at 5:53 PM, Jason Nah wrote:

> On 31 January 2011 04:33, David Chelimsky <dchelimsky at gmail.com> wrote:
> On Jan 30, 2011, at 9:34 AM, Rick DeNatale wrote:
> > On Sun, Jan 30, 2011 at 9:09 AM, David Chelimsky <dchelimsky at gmail.com> wrote:
> >> You can either use mock_model or mock_stub
> >
> >
> > David,
> >
> > Did you mean to say stub_model rather than mock_stub?
> Yes :)

> Thanks for that... although the exception still bugs me... and digging through the router code in rails is mighty obtuse.
> I'm switching over to rspec mocks to get me over this... (was using mocha).
> One problem I ran into, I'm testing a mailer (+ view), and I'm trying to generate the email ONCE for the entire spec, and then run various it { should have_body_text(x) }
> If I generate the email once using before(:all), I don't have access to any mock methods (which is understandable). Is there a way to get this going?

Yes - you've got it in front of you, but you don't seem to want to do it :)

Use mocks in before(:each).

> Or am I going to have to do the whole thing in one big "it" block?

That's an alternative too, but I'd recommend what I wrote above.

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

More information about the rspec-users mailing list