Class: RR::DoubleDefinitions::DoubleDefinition

Inherits:
Object
  • Object
show all
Includes:
DefinitionConstructionMethods, StateQueryMethods, Space::Reader
Defined in:
lib/rr/double_definitions/double_definition.rb

Overview

:nodoc:

Defined Under Namespace

Modules: DefinitionConstructionMethods, StateQueryMethods

Constant Summary collapse

ORIGINAL_METHOD =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from StateQueryMethods

#exact_match?, #expected_arguments, #implementation_is_original_method?, #ordered?, #terminal?, #verbose?, #wildcard_match?

Methods included from DefinitionConstructionMethods

#after_call, #any_number_of_times, #at_least, #at_most, #implemented_by, #implemented_by_original_method, #never, #once, #ordered, #returns, #times, #twice, #verbose, #with, #with_any_args, #with_no_args, #yields

Methods included from Space::Reader

#space

Constructor Details

#initialize(double_definition_creator, subject) ⇒ DoubleDefinition

Returns a new instance of DoubleDefinition.



34
35
36
37
38
39
40
41
42
# File 'lib/rr/double_definitions/double_definition.rb', line 34

def initialize(double_definition_creator, subject)
  @implementation = nil
  @argument_expectation = nil
  @times_matcher = nil
  @after_call_proc = nil
  @yields_value = nil
  @double_definition_creator = double_definition_creator
  @subject = subject
end

Instance Attribute Details

#after_call_procObject

Returns the value of attribute after_call_proc.



21
22
23
# File 'lib/rr/double_definitions/double_definition.rb', line 21

def after_call_proc
  @after_call_proc
end

#argument_expectationObject

Returns the value of attribute argument_expectation.



21
22
23
# File 'lib/rr/double_definitions/double_definition.rb', line 21

def argument_expectation
  @argument_expectation
end

#doubleObject

Returns the value of attribute double.



21
22
23
# File 'lib/rr/double_definitions/double_definition.rb', line 21

def double
  @double
end

#double_definition_creatorObject

Returns the value of attribute double_definition_creator.



21
22
23
# File 'lib/rr/double_definitions/double_definition.rb', line 21

def double_definition_creator
  @double_definition_creator
end

#implementationObject

Returns the value of attribute implementation.



21
22
23
# File 'lib/rr/double_definitions/double_definition.rb', line 21

def implementation
  @implementation
end

#subjectObject

Returns the value of attribute subject.



21
22
23
# File 'lib/rr/double_definitions/double_definition.rb', line 21

def subject
  @subject
end

#times_matcherObject

Returns the value of attribute times_matcher.



21
22
23
# File 'lib/rr/double_definitions/double_definition.rb', line 21

def times_matcher
  @times_matcher
end

#yields_valueObject

Returns the value of attribute yields_value.



21
22
23
# File 'lib/rr/double_definitions/double_definition.rb', line 21

def yields_value
  @yields_value
end

Class Method Details

.register_strategy_class(strategy_class, method_name) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rr/double_definitions/double_definition.rb', line 5

def register_strategy_class(strategy_class, method_name)
  class_eval((<<-CLASS), __FILE__, __LINE__ + 1)
  def #{method_name}(subject=DoubleDefinitionCreator::NO_SUBJECT, method_name=nil, &definition_eval_block)
    ChildDoubleDefinitionCreator.new(self).#{method_name}(subject, method_name, &definition_eval_block)
  end
  CLASS

  class_eval((<<-CLASS), __FILE__, __LINE__ + 1)
  def #{method_name}!(method_name=nil, &definition_eval_block)
    ChildDoubleDefinitionCreator.new(self).#{method_name}!(method_name, &definition_eval_block)
  end
  CLASS
end