Class: TarkaMatchers::Matchers::Expectation::SupportBlockExpectations
- Defined in:
- lib/tarka_matchers/matchers/expectation/support_block_expectations.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
- #matches?(actual) ⇒ Boolean
- #report ⇒ Object
- #supports_block_expectations? ⇒ Boolean
Instance Method Details
#description ⇒ Object
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_message ⇒ Object
35 36 37 |
# File 'lib/tarka_matchers/matchers/expectation/support_block_expectations.rb', line 35 def "failed to #{description} #{report}" end |
#failure_message_when_negated ⇒ Object
39 40 41 |
# File 'lib/tarka_matchers/matchers/expectation/support_block_expectations.rb', line 39 def "#{description} #{report}" end |
#matches?(actual) ⇒ 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 |
#report ⇒ Object
29 30 31 32 33 |
# File 'lib/tarka_matchers/matchers/expectation/support_block_expectations.rb', line 29 def report = "Expected the matcher, '#{@actual_matcher.class}', to contain the method supports_block_expectations? method and for it to return 'true'. " @exist ? << "Instead it returned '#{@actual}'." : << "The supports_block_expectations? method does not exist inside the matcher. (Hint: check spelling)" end |
#supports_block_expectations? ⇒ Boolean
10 11 12 |
# File 'lib/tarka_matchers/matchers/expectation/support_block_expectations.rb', line 10 def supports_block_expectations? true end |