[rspec-users] The RSpec way of doing this? Need help on validating block

Sebastian W. lists at ruby-forum.com
Thu Dec 4 02:59:52 EST 2008


Yikes, left out the all-important call:

> describe EmailSender do
>   it "Should use Net::SMTP to send email"
>     es = EmailSender.new
>     es.mailer.should == Net::SMTP
>     MockSMTP = mock("Net::SMTP")
>     def es.mailer
>       MockSMTP
>     end
>     MockSMTP.should_receive(:start).with('your.smtp.server', 25)
>     #but, er...wha?
      es.send_email
>   end
> end

Sorry about that.

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


More information about the rspec-users mailing list