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")
MockSMTP.should_receive(:start).with('your.smtp.server',
25).and_yield(mock_smtp)
mock_smtp.should_recieve(:send_message).with("Yay! You got an
email!", '[EMAIL PROTECTED]',
'[EMAIL PROTECTED]')
> es.send_email
>> end
>> end
Mission accomplished. :P
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users