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
http://svn.typosphere.org/typo/trunk/spec/controllers/comments_controller_spec.rband
http://svn.typosphere.org/typo/trunk/app/controllers/comments_controller.rb.


Thanks in advance for any ideas!
Tiffani AB
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to