Hi everybody,<br><br>I&#39;m pretty new to RSpec and have been reading over examples and tutorials of how to use the framework. &nbsp;I like everything so far since it goes right along with Rails&#39; expressiveness and such. &nbsp;<br>
<br>I was reading the Typo source code, however, and came across some code that I didn&#39;t know exactly how it worked. &nbsp;I&#39;ve noticed that in testing one of their controllers, they use a variable (@comments) that they don&#39;t declare anywhere else, yet they use it as a stand in for collections on some of the mocks. &nbsp;How is that possible? &nbsp;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? &nbsp;I only ask that because later, you see code like this: &nbsp;@comments.stub!(:build).and_return(@comment). &nbsp;<br>
<br>I&#39;m looking at&nbsp;<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&nbsp;<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>. &nbsp;<br>
<br>Thanks in advance for any ideas!<br>Tiffani AB