Sha256: 226ca01d37f3713f1fadcfa25d5e2465c79fd068659f4cf87259a6534781df53

Contents?: true

Size: 542 Bytes

Versions: 10

Compression:

Stored size: 542 Bytes

Contents

module MatchHelpers
  class MatchMatcher < Warp::Matcher
    attr_reader :value, :matcher

    def initialize(value)
      @value = value
    end

    def matches?(matcher)
      @matcher = matcher
      matcher.matches?(value)
    end

    def description
      "match #{value}"
    end

    def failure_message
      "expect #{matcher} to match #{value} but did not"
    end

    def failure_message_when_negated
      "expect #{matcher} to not match #{value} but did"
    end
  end

  def match(value)
    MatchMatcher.new(value)
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
warp-1.5.0 spec/support/match_helpers.rb
warp-1.4.0 spec/support/match_helpers.rb
warp-1.3.3 spec/support/match_helpers.rb
warp-1.3.2 spec/support/match_helpers.rb
warp-1.3.1 spec/support/match_helpers.rb
warp-1.3.0 spec/support/match_helpers.rb
warp-1.2.3 spec/support/match_helpers.rb
warp-1.2.2 spec/support/match_helpers.rb
warp-1.2.1 spec/support/match_helpers.rb
warp-1.2.0 spec/support/match_helpers.rb