09 May 2010, 20:40
Gravatar_pragsmall

James Mead (3 posts)

There are some significant errors in this article…

The syntax of the first two examples are incorrect :-

thing.stubs(:name).and_return("Fred")

should be :-

thing.stubs(:name).returns("Fred")

and :-

thing.expects(:name).and_return("Fred")

should be :-

thing.expects(:name).returns("Fred")

Also the link to the Mocha API is incorrect :-

http://mocha.rubyforge.com/

should be :-

http://mocha.rubyforge.org/

Regards, James Mead (author of Mocha)

09 May 2010, 23:21
Head_shot_pragsmall

Noel Rappin (16 posts)

James is correct, I inadvertently used the syntax of a different mock package in those examples. I’m sorry about that, it’s rather embarrassing.

Noel

  You must be logged in to comment