
Test::Spec::RMock - a mocking library for Test::Spec

version 0.004

use Test::Spec;
use Test::Spec::RMock;
describe "Something" => sub {
it "should do something" => {
my $foo = rmock('Foo');
$foo->should_receive('bar')->twice->and_return('baz');
Something->new->do_something_with($foo);
};
};
runtests unless caller;

Creates a mock object with the given name.
$name is used in error messages. Often a good choice is the name of the class or role you are mocking.

You want to use method stubs on all messages that you don't care to set expectations on. Any interactions that don't are important for the test you are writing.
This creates a method stub on the mock object returning $return_value each time it is called.
Mocking methods allows you to set expectations on the messages that the mocked object should receive.
Use a null object when you don't care about the object's behavior or interaction, and don't want to explicitly stub everything out that's needed.
All return $self so that you can chain them.
$expectation->at_least(4)->times
$expectation->exactly(4)->times
Noop


Kjell-Magne Øierud <kjellm@cpan.org>

This software is Copyright (c) 2012 by Kjell-Magne Øierud.
This is free software, licensed under:
The MIT (X11) License