From 795c223f8b8884367d801ad367aa3514f6127276 Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Wed, 26 Jun 2013 19:44:53 +1000 Subject: [PATCH] rewording the blurb on alloow and readme --- .../message_expectations/allow_any_instance_of.feature | 6 +++--- features/method_stubs/README.md | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/features/message_expectations/allow_any_instance_of.feature b/features/message_expectations/allow_any_instance_of.feature index e8247c401..9c1ab609d 100644 --- a/features/message_expectations/allow_any_instance_of.feature +++ b/features/message_expectations/allow_any_instance_of.feature @@ -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: diff --git a/features/method_stubs/README.md b/features/method_stubs/README.md index 9bfea21ae..81e6e883a 100644 --- a/features/method_stubs/README.md +++ b/features/method_stubs/README.md @@ -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) @@ -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 @@ -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()) { ... }