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

Sebastian W. lists at ruby-forum.com
Thu Dec 4 03:07:33 EST 2008

Ha! Don't I feel silly. Just figured it out, I think.

Sebastian W. wrote:
> 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
       mock_smtp = mock("smtp")
       mock_smtp.should_recieve(:send_message).with("Yay! You got an 
email!", 'your at mail',
'other at mail')
>       es.send_email
>>   end
>> end

Mission accomplished. :P

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

More information about the rspec-users mailing list