Class: TarkaMatchers::Matchers::Expectation::HaveAFailureMessageWhenNegatedOf

Inherits:
Object
  • Object
show all
Includes:
Helpers::Expectation::Common
Defined in:
lib/tarka_matchers/matchers/expectation/have_a_failure_message_when_negated_of.rb

Constant Summary

Constants included from Helpers::Expectation::Common

Helpers::Expectation::Common::NEWLINE, Helpers::Expectation::Common::SGR

Instance Method Summary collapse

Methods included from Helpers::Expectation::Common

#clean!

Constructor Details

#initialize(expected) ⇒ HaveAFailureMessageWhenNegatedOf

Returns a new instance of HaveAFailureMessageWhenNegatedOf.



13
14
15
# File 'lib/tarka_matchers/matchers/expectation/have_a_failure_message_when_negated_of.rb', line 13

def initialize expected
	@expected = expected
end

Instance Method Details

#descriptionObject



27
28
29
# File 'lib/tarka_matchers/matchers/expectation/have_a_failure_message_when_negated_of.rb', line 27

def description		
	"utilize a matcher that has a failure message when negated of: '#{@expected}'"
end

#failure_messageObject



31
32
33
# File 'lib/tarka_matchers/matchers/expectation/have_a_failure_message_when_negated_of.rb', line 31

def failure_message
	"The matcher, '#{@actual_matcher.class}', does not have the expected failure message when negated: #{TarkaMatchers::Formatters::Difference.difference(@expected,@actual)}"
end

#failure_message_when_negatedObject



35
36
37
# File 'lib/tarka_matchers/matchers/expectation/have_a_failure_message_when_negated_of.rb', line 35

def failure_message_when_negated
	"#{description}"
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
24
25
# File 'lib/tarka_matchers/matchers/expectation/have_a_failure_message_when_negated_of.rb', line 21

def matches? actual
	@actual_matcher = TarkaMatchers::Helpers::Expectation::ExpectCapture.capture(actual)[1]
	@actual = clean!(escape(@actual_matcher.failure_message_when_negated))
	@actual == @expected
end

#supports_block_expectations?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/tarka_matchers/matchers/expectation/have_a_failure_message_when_negated_of.rb', line 17

def supports_block_expectations?
	true
end