Module: Remarkable::Negative

Defined in:
lib/remarkable/negative.rb

Overview

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.

Instance Method Summary collapse

Instance Method Details

#does_not_match?(subject) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
18
# File 'lib/remarkable/negative.rb', line 15

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

#matches?(subject) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
# File 'lib/remarkable/negative.rb', line 10

def matches?(subject)
  @negative ||= false
  super
end

#negative?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/remarkable/negative.rb', line 20

def negative?
  @negative
end