[Rspec-devel] use case for: setup_once, teardown_once

itsme213 itsme213 at hotmail.com
Sun May 28 23:21:53 EDT 2006


From: "David Astels" <dastels at daveastels.com>
>> Sometimes the setup can be very expensive (e.g. establish a ssh or ftp
>> session) and the number of specs large.
>
> This should never be done.  You never want your specifications
> dependant on a) externsl, b) expensive, and c) nondeterministic/
> uncontrollable resources.

Good point, thanks. I do need to use mocks more.

> This is where you would use the mocking
> framework to mock the ssh/ftp interface.

In this case I was actually using spec to specify some explicit requirements 
about the (remote) results of a (remote) deployment, to say things like:

 - the remote directory structure should satisfy ...
 - remote file time stamps should be ...
 - remote access controls should be ...

How would mocks help with this? Or is this not an appropriate thing to 
specify?

Thanks.


More information about the Rspec-devel mailing list