# File lib/rr/double_definitions/double_definition_create.rb, line 92 92: def add_implementation_strategy(implementation_strategy_class, subject=NO_SUBJECT, method_name=nil, &definition_eval_block) 93: add_strategy(subject, method_name, definition_eval_block) do 94: self.implementation_strategy = implementation_strategy_class.new(self) 95: end 96: end
# File lib/rr/double_definitions/double_definition_create.rb, line 98 98: def add_scope_strategy(scope_strategy_class, subject=NO_SUBJECT, method_name=nil, &definition_eval_block) 99: add_strategy(subject, method_name, definition_eval_block) do 100: self.scope_strategy = scope_strategy_class.new(self) 101: end 102: end
# File lib/rr/double_definitions/double_definition_create.rb, line 104 104: def add_strategy(subject, method_name, definition_eval_block) 105: if method_name && definition_eval_block 106: raise ArgumentError, "Cannot pass in a method name and a block" 107: end 108: @subject = subject 109: yield 110: # TODO: Allow hash argument to simulate a Struct. 111: if no_subject? 112: self 113: elsif method_name 114: # TODO: Pass in arguments. 115: call(method_name) 116: else 117: DoubleDefinitionCreateBlankSlate.new(self, &definition_eval_block) 118: end 119: end
# File lib/rr/double_definitions/double_definition_create.rb, line 86 86: def add_verification_strategy(verification_strategy_class, subject=NO_SUBJECT, method_name=nil, &definition_eval_block) 87: add_strategy(subject, method_name, definition_eval_block) do 88: self.verification_strategy = verification_strategy_class.new(self) 89: end 90: end
# File lib/rr/double_definitions/double_definition_create.rb, line 128 128: def implementation_strategy=(implementation_strategy) 129: verify_not_proxy_and_dont_allow(verification_strategy, implementation_strategy) 130: @implementation_strategy = implementation_strategy 131: end
# File lib/rr/double_definitions/double_definition_create.rb, line 162 162: def no_strategy_error 163: raise( 164: Errors::DoubleDefinitionError, 165: "This Double has no strategy" 166: ) 167: end
# File lib/rr/double_definitions/double_definition_create.rb, line 155 155: def proxy_when_dont_allow_error 156: raise( 157: Errors::DoubleDefinitionError, 158: "Doubles cannot be proxied when using dont_allow strategy" 159: ) 160: end
# File lib/rr/double_definitions/double_definition_create.rb, line 133 133: def scope_strategy=(scope_strategy) 134: verify_not_proxy_and_dont_allow(verification_strategy, implementation_strategy) 135: @scope_strategy = scope_strategy 136: end
# File lib/rr/double_definitions/double_definition_create.rb, line 142 142: def strategy_already_defined_error 143: raise( 144: Errors::DoubleDefinitionError, 145: "This Double already has a #{verification_strategy.name} strategy" 146: ) 147: end
# File lib/rr/double_definitions/double_definition_create.rb, line 121 121: def verification_strategy=(verification_strategy) 122: verify_no_verification_strategy 123: verify_not_proxy_and_dont_allow(verification_strategy, implementation_strategy) 124: @verification_strategy = verification_strategy 125: verification_strategy 126: end
# File lib/rr/double_definitions/double_definition_create.rb, line 138 138: def verify_no_verification_strategy 139: strategy_already_defined_error if verification_strategy 140: end
# File lib/rr/double_definitions/double_definition_create.rb, line 149 149: def verify_not_proxy_and_dont_allow(verification_strategy, implementation_strategy) 150: proxy_when_dont_allow_error if 151: verification_strategy.is_a?(Strategies::Verification::DontAllow) && 152: implementation_strategy.is_a?(Strategies::Implementation::Proxy) 153: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.