[rspec-users] Rspec with ActionMailer and .deliver

Jason R. lists at ruby-forum.com
Tue Aug 16 12:30:43 EDT 2011


Chris M. wrote in post #1014770:
>CurriculumCommentMailer.should_receive(:comment_update).and_return(double("mailer").stub(:deliver))
>
> That's odd -- I would expect that second version to work if the first
> version is working. What error did you get? Was it the same "undefined
> method `deliver' for nil:NilClass" as before?

It was giving this error:
NoMethodError: undefined method `deliver' for
#<RSpec::Mocks::MessageExpectation:0x10542bb88>

But, I changed the test to this and it works fine:
CurriculumCommentMailer.should_receive(:comment_update).and_return(double("mailer",
:deliver => true))

-Jason

-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list