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

Ashley Moran work at ashleymoran.me.uk
Mon Nov 5 10:53:22 EST 2007

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, @from_domain) do |smtp|
     # ... previous implementation

So at some point you still need that one connection that gets passed  
through the rest of the code.  Class Spammer holds onto the SMTP but  
it's a transient object really - I pictured it being made in the  
Net::SMTP block and discarded, eg:

   Net::SMTP(@host, @port, @from_domain) do |smtp|

Does this help?



blog @ http://aviewfromafar.net/
linked-in @ http://www.linkedin.com/in/ashleymoran
currently @ work

More information about the rspec-users mailing list