<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Floehopper: New Mocha Docs</title>
    <link>http://blog.floehopper.org/articles/2006/09/03/new-mocha-docs</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>thoughts on the bergy bits of life</description>
    <item>
      <title>New Mocha Docs</title>
      <description>&lt;p&gt;Spurred on by &lt;a href="http://glu.ttono.us/articles/2006/09/02/mocking-models#comment-1106"&gt;Thorsten&amp;#8217;s comment&lt;/a&gt; on &lt;a href="http://glu.ttono.us/"&gt;Gluttonous&amp;#8217; blog&lt;/a&gt; and a mention of &lt;a href="http://mocha.rubyforge.org"&gt;Mocha&lt;/a&gt; in the &lt;a href="http://cleanair.highgroove.com/articles/2006/09/03/ruby_on_rails_enterprise_capistrano_mocked_models_class_variables_rest"&gt;Top 5 Rails Stories of the Week&lt;/a&gt;, I&amp;#8217;ve given the Mocha &lt;a href="http://mocha.rubyforge.org"&gt;documentation&lt;/a&gt; a major overhaul.&lt;/p&gt;


	&lt;p&gt;Now the &lt;a href="http://rdoc.sourceforge.net/"&gt;RDoc&lt;/a&gt; only shows the public &lt;span class="caps"&gt;API&lt;/span&gt; which should hopefully improve the signal-to-noise ratio and show how simple it is to use.&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://mocha.rubyforge.org/classes/Mocha/AutoVerify.html"&gt;Create traditional mock objects&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://mocha.rubyforge.org/classes/Mocha/MockMethods.html"&gt;Set expectations on traditional mock objects&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://mocha.rubyforge.org/classes/Object.html"&gt;Set expectations on real (non-mock) classes&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://mocha.rubyforge.org/classes/Mocha/Expectation.html"&gt;Make expectations more specific or define behaviour of stub&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;


I&amp;#8217;ve also had a play with &lt;a href="http://coderay.rubychan.de/"&gt;CodeRay&lt;/a&gt; and generated syntax-highlighted examples.
	&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://mocha.rubyforge.org/examples/misc.html"&gt;Quick Start&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://mocha.rubyforge.org/examples/mocha.html"&gt;Traditional mocking&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://mocha.rubyforge.org/examples/stubba.html"&gt;Setting expectations on real (non-mock) classes&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Good general information on mocking&amp;#8230;&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;a href="http://www.martinfowler.com/articles/mocksArentStubs.html"&gt;Mocks Aren&amp;#8217;t Stubs&lt;/a&gt; by &lt;a href="http://www.martinfowler.com/"&gt;Martin Fowler&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://www.jmock.org/yoga.html"&gt;JMock &amp;#8211; Yoga for your unit tests&lt;/a&gt; by &lt;a href="http://nat.truemesh.com/"&gt;Nat Pryce&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;</description>
      <pubDate>Sun, 03 Sep 2006 18:20:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:d79eed64-175c-4108-887d-e122324a8696</guid>
      <author>James Mead</author>
      <link>http://blog.floehopper.org/articles/2006/09/03/new-mocha-docs</link>
      <category>mocha</category>
      <category>stubba</category>
      <category>test</category>
      <category>testing</category>
      <category>mock</category>
      <category>stub</category>
      <category>jmock</category>
      <category>coderay</category>
      <category>syntax</category>
      <category>highlight</category>
      <category>mocking</category>
      <category>stubbing</category>
      <category>ruby</category>
      <category>rails</category>
    </item>
    <item>
      <title>"New Mocha Docs" by James Mead</title>
      <description>&lt;p&gt;Thanks for the link. It&amp;#8217;s nice of Jim to credit &lt;a href="http://mocha.rubyforge.org"&gt;Mocha&lt;/a&gt; as the inspiration for the flexstub stuff.  I&amp;#8217;d better update the Mocha &lt;a href="http://mocha.rubyforge.org"&gt;README&lt;/a&gt; :-)&lt;/p&gt;


	&lt;p&gt;We went down the road of using blocks in earlier incarnations of Mocha, but we decided they didn&amp;#8217;t do much for readability. Take a look at the comparison&amp;#8230;&lt;/p&gt;


&lt;strong&gt;FlexMock&lt;/strong&gt;
&lt;pre&gt;&lt;code&gt;flexstub(Woofer).should_receive(:new).and_return {
  flexmock(&amp;quot;woofer&amp;quot;) do |mock|
        mock.should_receive(:woof).and_return(:grrrr)
      end
    }
}&lt;/code&gt;&lt;/pre&gt;

&lt;strong&gt;Mocha&lt;/strong&gt;
&lt;pre&gt;&lt;code&gt;woofer = stub(:woof =&amp;gt; :grrr)
Woofer.stubs(:new).return(woofer)&lt;/code&gt;&lt;/pre&gt;</description>
      <pubDate>Wed, 06 Sep 2006 09:59:10 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:20721f30-7377-495f-afe8-0951b71ccece</guid>
      <link>http://blog.floehopper.org/articles/2006/09/03/new-mocha-docs#comment-82</link>
    </item>
    <item>
      <title>"New Mocha Docs" by Anselm</title>
      <description>&lt;p&gt;The documentation says :&lt;/p&gt;


	&lt;p&gt;&amp;#8220;One of its main advantages is that it allows you to mock and stub methods on real (non-mock) classes and instances. [...]. This is a feature that is not currently offered by other Ruby mocking libraries like FlexMock and RSpec.&amp;#8221;&lt;/p&gt;


	&lt;p&gt;Inspired by Mocha, it looks like FlexMock now has stubs &amp;#8211; see &lt;a href="http://onestepback.org/software/flexmock/"&gt;http://onestepback.org/software/flexmock/&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Wed, 06 Sep 2006 08:22:43 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:0831491a-1926-4baa-a790-099029330ab0</guid>
      <link>http://blog.floehopper.org/articles/2006/09/03/new-mocha-docs#comment-81</link>
    </item>
    <item>
      <title>"New Mocha Docs" by Thorsten</title>
      <description>&lt;p&gt;Wahoooo! Thanks a million or taking the time to write this up. I&amp;#8217;m sure we&amp;#8217;ll come up with more details for you to fill in :-).&lt;/p&gt;</description>
      <pubDate>Tue, 05 Sep 2006 01:42:40 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:0174ab49-493c-4b87-95c5-cf326b9e7e20</guid>
      <link>http://blog.floehopper.org/articles/2006/09/03/new-mocha-docs#comment-74</link>
    </item>
    <item>
      <title>"New Mocha Docs" by Labrat</title>
      <description>&lt;p&gt;This is just wonderful.  Thank you for taking the time out to put this together.&lt;/p&gt;</description>
      <pubDate>Sun, 03 Sep 2006 22:10:26 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:32442636-5718-480c-988c-d7e010c61791</guid>
      <link>http://blog.floehopper.org/articles/2006/09/03/new-mocha-docs#comment-73</link>
    </item>
  </channel>
</rss>
