Class: TarkaMatchers::Matchers::Expectation::SupportBlockExpectations

Inherits:
Object
  • Object
show all
Defined in:
lib/tarka_matchers/matchers/expectation/support_block_expectations.rb

Instance Method Summary collapse

Instance Method Details

#descriptionObject



25
26
27
# File 'lib/tarka_matchers/matchers/expectation/support_block_expectations.rb', line 25

def description	
	"utilize a matcher, '#{@actual_matcher.class}', that supports block expectations."
end

#failure_messageObject



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

def failure_message
	"failed to #{description} #{report}"
end

#failure_message_when_negatedObject



39
40
41
# File 'lib/tarka_matchers/matchers/expectation/support_block_expectations.rb', line 39

def failure_message_when_negated
	"#{description} #{report}"
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
18
19
20
21
22
23
# File 'lib/tarka_matchers/matchers/expectation/support_block_expectations.rb', line 14

def matches? actual
	@actual_matcher = TarkaMatchers::Helpers::Expectation::ExpectCapture.capture(actual)[1]
	@exist = true
	begin
		@actual = @actual_matcher.supports_block_expectations?
	rescue NoMethodError 
		@exist = false
	end
	@actual == true
end

#reportObject



29
30
31
32
33
# File 'lib/tarka_matchers/matchers/expectation/support_block_expectations.rb', line 29

def report
	message = "Expected the matcher, '#{@actual_matcher.class}', to contain the method supports_block_expectations? method and for it to return 'true'. "
	@exist ? message << "Instead it returned '#{@actual}'." : message << "The supports_block_expectations? method does not exist inside the matcher. (Hint: check spelling)"
	message
end

#supports_block_expectations?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/tarka_matchers/matchers/expectation/support_block_expectations.rb', line 10

def supports_block_expectations?
	true
end