Class: RR::SpyVerification

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DoubleDefinitions::DoubleDefinition::ArgumentDefinitionConstructionMethods

#with, #with_any_args, #with_no_args

Methods included from DoubleDefinitions::DoubleDefinition::TimesDefinitionConstructionMethods

#any_number_of_times, #at_least, #at_most, #never, #once, #times, #twice

Constructor Details

#initialize(subject, method_name, args) ⇒ SpyVerification



3
4
5
6
7
8
9
# File 'lib/rr/spy_verification.rb', line 3

def initialize(subject, method_name, args)
  @subject = subject
  @method_name = method_name.to_sym
  set_argument_expectation_for_args(args)
  @ordered = false
  once
end

Instance Attribute Details

#argument_expectationObject (readonly)

Returns the value of attribute argument_expectation



11
12
13
# File 'lib/rr/spy_verification.rb', line 11

def argument_expectation
  @argument_expectation
end

#method_nameObject (readonly)

Returns the value of attribute method_name



11
12
13
# File 'lib/rr/spy_verification.rb', line 11

def method_name
  @method_name
end

#subjectObject

Returns the value of attribute subject



12
13
14
# File 'lib/rr/spy_verification.rb', line 12

def subject
  @subject
end

#times_matcherObject

Returns the value of attribute times_matcher



11
12
13
# File 'lib/rr/spy_verification.rb', line 11

def times_matcher
  @times_matcher
end

Instance Method Details

#callObject



26
27
28
# File 'lib/rr/spy_verification.rb', line 26

def call
  (error = RR.recorded_calls.match_error(self)) && raise(error)
end

#orderedObject



17
18
19
20
# File 'lib/rr/spy_verification.rb', line 17

def ordered
  @ordered = true
  self
end

#ordered?Boolean



22
23
24
# File 'lib/rr/spy_verification.rb', line 22

def ordered?
  @ordered
end

#to_procObject



30
31
32
33
34
# File 'lib/rr/spy_verification.rb', line 30

def to_proc
  lambda do
    call
  end
end