[rspec-users] Attempting to Make Sense of RSpec use

Tiffani Ashley Bell tiffani2k3 at gmail.com
Thu Jul 3 18:32:49 EDT 2008

Hi everybody,

I'm pretty new to RSpec and have been reading over examples and tutorials of
how to use the framework.  I like everything so far since it goes right
along with Rails' expressiveness and such.

I was reading the Typo source code, however, and came across some code that
I didn't know exactly how it worked.  I've noticed that in testing one of
their controllers, they use a variable (@comments) that they don't declare
anywhere else, yet they use it as a stand in for collections on some of the
mocks.  How is that possible?  I know in the mocking documentation it says
that you can define collaborations with other objects before those objects
exist, but how is that working in this code?  I only ask that because later,
you see code like this:  @comments.stub!(:build).and_return(@comment).

I'm looking at

Thanks in advance for any ideas!
Tiffani AB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20080703/051cf0d4/attachment-0001.html>

More information about the rspec-users mailing list