diff options
Diffstat (limited to 'spec/matchers')
-rw-r--r-- | spec/matchers/be_like.rb | 10 | ||||
-rw-r--r-- | spec/matchers/disambiguate_attributes.rb | 10 | ||||
-rw-r--r-- | spec/matchers/hash_the_same_as.rb | 10 |
3 files changed, 15 insertions, 15 deletions
diff --git a/spec/matchers/be_like.rb b/spec/matchers/be_like.rb index 4ff5bc532f..c9d4d4b979 100644 --- a/spec/matchers/be_like.rb +++ b/spec/matchers/be_like.rb @@ -3,22 +3,22 @@ module BeLikeMatcher def initialize(expected) @expected = expected end - + def matches?(actual) @actual = actual @expected.gsub(/\s+/, ' ').strip == @actual.gsub(/\s+/, ' ').strip end - + def failure_message "expected\n#{@actual}\nto be like\n#{@expected}" end - + def negative_failure_message "expected\n#{@actual}\nto be unlike\n#{@expected}" end end - + def be_like(expected) BeLike.new(expected) end -end
\ No newline at end of file +end diff --git a/spec/matchers/disambiguate_attributes.rb b/spec/matchers/disambiguate_attributes.rb index bee7d22b0c..bc4a5215d4 100644 --- a/spec/matchers/disambiguate_attributes.rb +++ b/spec/matchers/disambiguate_attributes.rb @@ -3,7 +3,7 @@ module DisambiguateAttributesMatcher def initialize(attributes) @attributes = attributes end - + def matches?(actual) @actual = actual attribute1, attribute2 = @attributes @@ -11,18 +11,18 @@ module DisambiguateAttributesMatcher !@actual[attribute1].descends_from?(attribute2) && @actual[attribute2].descends_from?(attribute2) end - + def failure_message "" # "expected #{@actual} to disambiguate its attributes" end - + def negative_failure_message "expected #{@actual} to not disambiguate its attributes" end end - + def disambiguate_attributes(*attributes) DisambiguateAttributes.new(attributes) end -end
\ No newline at end of file +end diff --git a/spec/matchers/hash_the_same_as.rb b/spec/matchers/hash_the_same_as.rb index c1903b62b4..03e955a0cb 100644 --- a/spec/matchers/hash_the_same_as.rb +++ b/spec/matchers/hash_the_same_as.rb @@ -3,24 +3,24 @@ module HashTheSameAsMatcher def initialize(expected) @expected = expected end - + def matches?(actual) @actual = actual hash = {} hash[@expected] = :some_arbitrary_value hash[@actual] == :some_arbitrary_value end - + def failure_message "expected #{@actual} to hash the same as #{@expected}; they must be `eql?` and have the same `#hash` value" end - + def negative_failure_message "expected #{@actual} to hash differently than #{@expected}; they must not be `eql?` or have a differing `#hash` values" end end - + def hash_the_same_as(expected) HashTheSameAs.new(expected) end -end
\ No newline at end of file +end |