Skip to content

Commit

Permalink
Clean up formatting and language on allow(O.any_instance) code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Phippen committed Oct 16, 2013
1 parent cc5312c commit 6556ed2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/rspec/mocks/matchers/receive.rb
Expand Up @@ -67,7 +67,7 @@ def warn_if_any_instance(expression, subject)
if AnyInstance::Recorder === subject
RSpec.warning(
"`#{expression}(#{subject.klass}.any_instance).to` " <<
"is probably not what you meant, it does not #{expression} on " <<
"is probably not what you meant, it does not operate on " <<
"any instance of `#{subject.klass}`. " <<
"Use `#{expression}_any_instance_of(#{subject.klass}).to` instead."
)
Expand Down
5 changes: 2 additions & 3 deletions spec/rspec/mocks/matchers/receive_spec.rb
Expand Up @@ -11,15 +11,14 @@ def verify_all

describe "expectations/allowances on any instance recorders" do
include_context "with syntax", [:expect, :should]
include DeprecationHelpers

it "warns about allow(Klass.any_instance).to receive..." do
expect(RSpec).to receive(:warning).with(/allow.*any_instance.*is probably not what you meant.*allow_any_instance_of.*instead/)
allow(Object.any_instance).to receive(:foo)
end

it "includes the correct call site in the allow warning" do
expect_warning_with_call_site(__FILE__, __LINE__+1)
expect_warning_with_call_site(__FILE__, __LINE__ + 1)
allow(Object.any_instance).to receive(:foo)
end

Expand All @@ -30,7 +29,7 @@ def verify_all
end

it "includes the correct call site in the expect warning" do
expect_warning_with_call_site(__FILE__, __LINE__+1)
expect_warning_with_call_site(__FILE__, __LINE__ + 1)
expect(Object.any_instance).to receive(:foo)
Object.any_instance.foo
end
Expand Down

0 comments on commit 6556ed2

Please sign in to comment.