New Mocha Docs

Posted by James Mead Sun, 03 Sep 2006 18:20:00 GMT

Spurred on by Thorsten’s comment on Gluttonous’ blog and a mention of Mocha in the Top 5 Rails Stories of the Week, I’ve given the Mocha documentation a major overhaul.

Now the RDoc only shows the public API which should hopefully improve the signal-to-noise ratio and show how simple it is to use.

I’ve also had a play with CodeRay and generated syntax-highlighted examples.

Good general information on mocking…

Tags , , , , , , , , , , , , ,  | 4 comments

Comments

  1. Labrat said about 4 hours later:

    This is just wonderful. Thank you for taking the time out to put this together.

  2. Thorsten said 1 day later:

    Wahoooo! Thanks a million or taking the time to write this up. I’m sure we’ll come up with more details for you to fill in :-).

  3. Anselm said 2 days later:

    The documentation says :

    “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.”

    Inspired by Mocha, it looks like FlexMock now has stubs – see http://onestepback.org/software/flexmock/

  4. James Mead said 2 days later:

    Thanks for the link. It’s nice of Jim to credit Mocha as the inspiration for the flexstub stuff. I’d better update the Mocha README :-)

    We went down the road of using blocks in earlier incarnations of Mocha, but we decided they didn’t do much for readability. Take a look at the comparison…

    FlexMock
    flexstub(Woofer).should_receive(:new).and_return {
      flexmock("woofer") do |mock|
            mock.should_receive(:woof).and_return(:grrrr)
          end
        }
    }
    Mocha
    woofer = stub(:woof => :grrr)
    Woofer.stubs(:new).return(woofer)

Comments are disabled