Hi everybody,<br><br>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. <br>
<br>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). <br>
<br>I'm looking at <a href="http://svn.typosphere.org/typo/trunk/spec/controllers/comments_controller_spec.rb">http://svn.typosphere.org/typo/trunk/spec/controllers/comments_controller_spec.rb</a> and <a href="http://svn.typosphere.org/typo/trunk/app/controllers/comments_controller.rb">http://svn.typosphere.org/typo/trunk/app/controllers/comments_controller.rb</a>. <br>
<br>Thanks in advance for any ideas!<br>Tiffani AB