4
include Spec::Mocks::ArgumentConstraintMatchers
6
# Shortcut for creating an instance of Spec::Mocks::Mock.
8
# +name+ is used for failure reporting, so you should use the
9
# role that the mock is playing in the example.
11
# +stubs_and_options+ lets you assign options and stub values
12
# at the same time. The only option available is :null_object.
13
# Anything else is treated as a stub value.
17
# stub_thing = mock("thing", :a => "A")
18
# stub_thing.a == "A" => true
20
# stub_person = stub("thing", :name => "Joe", :email => "joe@domain.com")
21
# stub_person.name => "Joe"
22
# stub_person.email => "joe@domain.com"
23
def mock(name, stubs_and_options={})
24
Spec::Mocks::Mock.new(name, stubs_and_options)
29
# Shortcut for creating a mock object that will return itself in response
30
# to any message it receives that it hasn't been explicitly instructed
32
def stub_everything(name = 'stub')
33
mock(name, :null_object => true)