Class: Cheffish::RSpec::Matchers::PartiallyMatch

Inherits:
Object
  • Object
show all
Includes:
RSpec::Matchers::Composable
Defined in:
lib/cheffish/rspec/matchers/partially_match.rb

Instance Method Summary collapse

Constructor Details

#initialize(example, expected) ⇒ PartiallyMatch

Returns a new instance of PartiallyMatch.



7
8
9
10
# File 'lib/cheffish/rspec/matchers/partially_match.rb', line 7

def initialize(example, expected)
  @example = example
  @expected = expected
end

Instance Method Details

#failure_messageObject



17
18
19
# File 'lib/cheffish/rspec/matchers/partially_match.rb', line 17

def failure_message
  "expected #{@actual} to match #{@expected}"
end

#failure_message_when_negatedObject



21
22
23
# File 'lib/cheffish/rspec/matchers/partially_match.rb', line 21

def failure_message_when_negated
  "expected #{@actual} not to match #{@expected}"
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
15
# File 'lib/cheffish/rspec/matchers/partially_match.rb', line 12

def matches?(actual)
  @actual = actual
  partially_matches_values(@expected, actual)
end