From 49c9f090ef51b7918e8241f768c63447c7640c80 Mon Sep 17 00:00:00 2001 From: Tim Cowlishaw Date: Fri, 12 Jul 2013 17:00:44 +0100 Subject: [PATCH] Change exception msg per @samphippen's suggestion --- lib/rspec/mocks/example_methods.rb | 2 +- spec/rspec/mocks/matchers/have_received_spec.rb | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/rspec/mocks/example_methods.rb b/lib/rspec/mocks/example_methods.rb index 5b4a07b19..199576be4 100644 --- a/lib/rspec/mocks/example_methods.rb +++ b/lib/rspec/mocks/example_methods.rb @@ -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 diff --git a/spec/rspec/mocks/matchers/have_received_spec.rb b/spec/rspec/mocks/matchers/have_received_spec.rb index cbc9761dc..a270d37de 100644 --- a/spec/rspec/mocks/matchers/have_received_spec.rb +++ b/spec/rspec/mocks/matchers/have_received_spec.rb @@ -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