Sha256: 161566ad47f4abb8184a1b7ff97231fcc764b7d865cf576096457630544b125d

Contents?: true

Size: 478 Bytes

Versions: 7

Compression:

Stored size: 478 Bytes

Contents

module Matchers
  class BeLike
    def initialize(expected)
      @expected = expected.gsub(/\s+/, ' ').strip
    end

    def matches?(actual)
      @actual = actual.gsub(/\s+/, ' ').strip
      @expected == @actual
    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

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
arel-2.0.1 spec/support/matchers/be_like.rb
arel-2.0.0 spec/support/matchers/be_like.rb
arel-1.0.1 spec/support/matchers/be_like.rb
arel-1.0.0 spec/support/matchers/be_like.rb
arel-1.0.0.rc1 spec/support/matchers/be_like.rb
arel-compat-0.4.0 spec/support/matchers/be_like.rb
arel-0.4.0 spec/support/matchers/be_like.rb