Skip to content

Commit

Permalink
Change exception msg per @samphippen's suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
timcowlishaw committed Jul 12, 2013
1 parent fed03c9 commit 49c9f09
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/rspec/mocks/example_methods.rb
Expand Up @@ -114,7 +114,7 @@ def hide_const(constant_name)
# # You can also use most message expectations:
# expect(invitation).to have_received(:accept).with(mailer).once
def have_received(method_name)
raise "have_received matcher does not take a block argument: #{caller[0]}" if block_given?
raise "have_received matcher does not take a block argument. Called from #{caller[0]}" if block_given?
Matchers::HaveReceived.new(method_name)
end

Expand Down
3 changes: 1 addition & 2 deletions spec/rspec/mocks/matchers/have_received_spec.rb
Expand Up @@ -63,8 +63,7 @@ module Mocks
it "raises an exception when a block is used to match the arguments" do
dbl = double_with_met_expectation(:expected_method)
expect {
expect(dbl).to have_received(:expected_method) { |argument|
}
expect(dbl).to have_received(:expected_method) { }
}.to raise_error(/have_received matcher does not take a block argument/)
end

Expand Down

0 comments on commit 49c9f09

Please sign in to comment.