Skip to content

Commit

Permalink
rewording the blurb on alloow and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
JonRowe committed Jun 26, 2013
1 parent bbb0502 commit 795c223
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions features/message_expectations/allow_any_instance_of.feature
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Feature: allow a message on any instance of a class

Use `allow_any_instance_of(Class).to receive` when an instance of a class may
respond to a particular message. This will not set an expectation on any instance
so the spec will not fail if no instance receives the message.
Use `allow_any_instance_of(Class).to receive` when an instance of a class is
allowed to respond to a particular message. This will not set an expectation
on any instance so the spec will not fail if no instance receives the message.

Scenario: allowing a message on any instance of a class
Given a file named "example_spec.rb" with:
Expand Down
10 changes: 5 additions & 5 deletions features/method_stubs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# create a double
obj = double()

# specify a return value using `expect` syntax
# specify a return value using `:expect` syntax
allow(obj).to receive(:message) { :value }
allow(obj).to receive(:message).and_return(:value)

# specify a return value using `should` syntax
# specify a return value using `:should` syntax
obj.stub(:message) { :value }
obj.stub(:message => :value)
obj.stub(:message).and_return(:value)
Expand All @@ -20,12 +20,12 @@ block contents are evaluated lazily when the `obj` receives the

allow(obj).to receive(:message) do |arg1, arg2|
# set expectations about the args in this block
# and/or set a return value
# and/or return value
end

obj.stub(:message) do |arg1, arg2|
# set expectations about the args in this block
# and/or set a return value
# and/or return a value
end

### Raising/Throwing
Expand Down Expand Up @@ -59,7 +59,7 @@ You can also use the block format:
allow(obj).to receive(:message).with(an_instance_of(Money)) { ... }
allow(obj).to receive(:message).with(hash_including(:a => 'b')) { ... }
allow(obj).to receive(:message).with(array_including(1,2,3)) { ... }
or
# or
allow(obj).to receive(:message).with(array_including([1,2,3])) { ... }

obj.stub(:message).with(anything()) { ... }
Expand Down

0 comments on commit 795c223

Please sign in to comment.