class RSpec::SleepingKingStudios::Matchers::BaseMatcher

Minimal implementation of the RSpec matcher interface.

@since 1.0.0

Attributes

actual[R]

Public Instance Methods

does_not_match?(actual) click to toggle source

Inverse of matches? method.

@param [Object] actual the object to test against the matcher

@return [Boolean] false if the object matches, otherwise true

@see matches?

# File lib/rspec/sleeping_king_studios/matchers/base_matcher.rb, line 24
def does_not_match? actual
  !matches?(actual)
end
failure_message() click to toggle source

Message for when the object does not match, but was expected to. Make sure to always call matches? first to set up the matcher state.

# File lib/rspec/sleeping_king_studios/matchers/base_matcher.rb, line 42
def failure_message
  "expected #{@actual.inspect} to #{description}"
end
failure_message_when_negated() click to toggle source

Message for when the object matches, but was expected not to. Make sure to always call matches? first to set up the matcher state.

# File lib/rspec/sleeping_king_studios/matchers/base_matcher.rb, line 48
def failure_message_when_negated
  "expected #{@actual.inspect} not to #{description}"
end
matches?(actual) click to toggle source

Tests the actual object to see if it matches the defined condition(s). Invoked by RSpec expectations.

@param [Object] actual the object to test against the matcher

@return [Boolean] true if the object matches, otherwise false

# File lib/rspec/sleeping_king_studios/matchers/base_matcher.rb, line 34
def matches? actual
  @actual = actual

  true
end