Class: NotAMock::Matchers::AnythingMatcher

Inherits:
CallMatcher show all
Defined in:
lib/not_a_mock/matchers/anything_matcher.rb

Overview

Matcher for

object.should have_been_called

Instance Attribute Summary

Attributes inherited from CallMatcher

#calls

Instance Method Summary collapse

Methods inherited from CallMatcher

#and_returned, #exactly, #failure_message, #matched?, #matches?, #negative_failure_message, #once, #twice, #with, #without_args

Constructor Details

#initialize(parent = nil) ⇒ AnythingMatcher

Returns a new instance of AnythingMatcher.



9
10
11
# File 'lib/not_a_mock/matchers/anything_matcher.rb', line 9

def initialize(parent = nil)
  super parent
end

Instance Method Details

#failure_message_without_parentsObject



18
19
20
21
22
23
24
# File 'lib/not_a_mock/matchers/anything_matcher.rb', line 18

def failure_message_without_parents
  if matched?
    " was called"
  else
    " was never called"
  end
end

#matches_without_parents?Boolean

Returns:

  • (Boolean)


13
14
15
16
# File 'lib/not_a_mock/matchers/anything_matcher.rb', line 13

def matches_without_parents?
  @calls = CallRecorder.instance.calls_by_object(@object)
  !@calls.empty?
end