Sha256: e259d819e74e6fa5cc36a783fa1bcf5966aafbcdb0beae1a7333a948341640c6

Contents?: true

Size: 524 Bytes

Versions: 3

Compression:

Stored size: 524 Bytes

Contents

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

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

3 entries across 3 versions & 1 rubygems

Version Path
mondrian-olap-0.3.0 spec/support/matchers/be_like.rb
mondrian-olap-0.2.0 spec/support/matchers/be_like.rb
mondrian-olap-0.1.0 spec/support/matchers/be_like.rb