Sha256: e26bac1b4427b25477096077ffb716f2cceb6bb6bffc2fbdf6d0f57ae6bbeb6f

Contents?: true

Size: 575 Bytes

Versions: 10

Compression:

Stored size: 575 Bytes

Contents

module Remarkable
  # Allows Remarkable matchers to work on the negative way. Your matcher has to
  # follow some conventions to allow this to work by default.
  #
  # In negative cases, expectations can also be found under negative_expectations
  # keys, falling back to expectations. This allows to set customized failure
  # messages.
  #
  module Negative
    def matches?(subject)
      @negative ||= false
      super
    end

    def does_not_match?(subject)
      @negative = true
      !matches?(subject)
    end

    def negative?
      @negative
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
remarkable-4.0.0.alpha4 lib/remarkable/core/negative.rb
remarkable-4.0.0.alpha3 lib/remarkable/core/negative.rb
remarkable-4.0.0.alpha2 lib/remarkable/core/negative.rb
remarkable-4.0.0.alpha1 lib/remarkable/negative.rb
remarkable-3.1.13 lib/remarkable/negative.rb
remarkable-3.1.12 lib/remarkable/negative.rb
remarkable-3.1.11 lib/remarkable/negative.rb
remarkable-3.1.10 lib/remarkable/negative.rb
remarkable-3.1.9 lib/remarkable/negative.rb
remarkable-3.1.8 lib/remarkable/negative.rb