1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/spec/matchers/be_like.rb
Nick Kallen 311f5f8eb5 minor
2008-01-07 18:37:20 -08:00

24 lines
No EOL
490 B
Ruby

module BeLikeMatcher
class BeLike
def initialize(expected)
@expected = expected
end
def matches?(target)
@target = target
@expected.gsub(/\s+/, ' ').strip == @target.gsub(/\s+/, ' ').strip
end
def failure_message
"expected #{@target} to be like #{@expected}"
end
def negative_failure_message
"expected #{@target} to be unlike #{@expected}"
end
end
def be_like(expected)
BeLike.new(expected)
end
end