Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Improve wording of warning.

  • Loading branch information...
commit a6365b04bd0c8fc03e3d09a4a04ffbf343229d9d 1 parent 0e706c6
@myronmarston myronmarston authored
View
9 lib/rspec/expectations/handler.rb
@@ -2,12 +2,13 @@ module RSpec
module Expectations
class ExpectationHandler
- def self.message_must_be_string
- "The value passed as the message for the expectation was not a string"
+ def self.message_must_be_string(msg)
+ "WARNING: ignoring the provided expectation message argument " +
+ "(#{msg.inspect}) since it is not a string."
end
- def self.check_message(message=nil)
- ::Kernel.warn message_must_be_string unless message == nil or String === message
+ def self.check_message(msg)
+ ::Kernel.warn message_must_be_string(msg) unless msg.nil? || msg.is_a?(String)
end
end
View
4 spec/rspec/expectations/syntax_spec.rb
@@ -8,7 +8,7 @@ module Syntax
describe "#should" do
it "prints a warning when the message object isn't a String" do
- warner.should_receive(:warn).with /The value passed as the message/
+ warner.should_receive(:warn).with /ignoring.*message/
3.should eq(3), :not_a_string
end
@@ -20,7 +20,7 @@ module Syntax
describe "#should_not" do
it "prints a warning when the message object isn't a String" do
- warner.should_receive(:warn).with /The value passed as the message/
+ warner.should_receive(:warn).with /ignoring.*message/
3.should_not eq(4), :not_a_string
end
Please sign in to comment.
Something went wrong with that request. Please try again.