Re: [rspec-users] Specing raising error, handling, and then not raising error

2007-11-05 Thread Ashley Moran
On 4 Nov 2007, at 23:51, Mikel Lindsaar wrote: > The problem I was trying to solve with the mass sender is I only want > to open one connection to the SMTP server, not multiple. I thought I covered that. I didn't mock out the bit that wrapped your existing code: Net::SMTP(@host, @port, @f

Re: [rspec-users] Specing raising error, handling, and then not raising error

2007-11-04 Thread Mikel Lindsaar
On 11/5/07, Ashley Moran <[EMAIL PROTECTED]> wrote: > Mikel, > > It looks like you are doing too much here. You are specifying sending > with the SMTP object in the same block you are specifying the > algorithm for counting the sent emails. Also, the way it interrogates > the email object to extr

Re: [rspec-users] Specing raising error, handling, and then not raising error

2007-11-04 Thread Ashley Moran
On Nov 04, 2007, at 9:55 am, Mikel Lindsaar wrote: > it "should only increase the sent emails counter if the email was > sent" do >@smtp = mock(Net::SMTP) > > @smtp > .should_receive(:send_message).exactly(4).times.and_return(true, > IOError, true, true) >Net::SMTP.stub!(:start

[rspec-users] Specing raising error, handling, and then not raising error

2007-11-04 Thread Mikel Lindsaar
Hey guys and gals, I have a snippet of code: Net::SMTP(@host, @port, @from_domain) do |smtp| @emails.each do |email| begin smtp.send_message email.encoded, email.from, email.destinations @emails_sent += 1 rescue Exception => e # blah end end end What I want to d