rr 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,8 +16,12 @@ end
16
16
  describe Scenario, "#with" do
17
17
  it_should_behave_like "RR::Scenario"
18
18
 
19
+ it "returns ScenarioDefinition" do
20
+ @scenario.with(1).should === @scenario.definition
21
+ end
22
+
19
23
  it "sets an ArgumentEqualityExpectation" do
20
- @scenario.with(1).should === @scenario
24
+ @scenario.with(1)
21
25
  @scenario.should be_exact_match(1)
22
26
  @scenario.should_not be_exact_match(2)
23
27
  end
@@ -35,8 +39,8 @@ describe Scenario, "#with_any_args" do
35
39
  @scenario.with_any_args {:return_value}
36
40
  end
37
41
 
38
- it "returns self" do
39
- @scenario.with_no_args.should === @scenario
42
+ it "returns ScenarioDefinition" do
43
+ @scenario.with_no_args.should === @scenario.definition
40
44
  end
41
45
 
42
46
  it "sets an AnyArgumentExpectation" do
@@ -56,8 +60,8 @@ describe Scenario, "#with_no_args" do
56
60
  @scenario.with_no_args {:return_value}
57
61
  end
58
62
 
59
- it "returns self" do
60
- @scenario.with_no_args.should === @scenario
63
+ it "returns ScenarioDefinition" do
64
+ @scenario.with_no_args.should === @scenario.definition
61
65
  end
62
66
 
63
67
  it "sets an ArgumentEqualityExpectation with no arguments" do
@@ -72,8 +76,8 @@ end
72
76
  describe Scenario, "#never" do
73
77
  it_should_behave_like "RR::Scenario"
74
78
 
75
- it "returns self" do
76
- @scenario.never.should === @scenario
79
+ it "returns ScenarioDefinition" do
80
+ @scenario.never.should === @scenario.definition
77
81
  end
78
82
 
79
83
  it "sets up a Times Called Expectation with 0" do
@@ -90,8 +94,12 @@ end
90
94
  describe Scenario, "#once" do
91
95
  it_should_behave_like "RR::Scenario"
92
96
 
97
+ it "returns ScenarioDefinition" do
98
+ @scenario.once.should === @scenario.definition
99
+ end
100
+
93
101
  it "sets up a Times Called Expectation with 1" do
94
- @scenario.once.should === @scenario
102
+ @scenario.once
95
103
  @scenario.call(@double)
96
104
  proc {@scenario.call(@double)}.should raise_error(Errors::TimesCalledError)
97
105
  end
@@ -105,8 +113,12 @@ end
105
113
  describe Scenario, "#twice" do
106
114
  it_should_behave_like "RR::Scenario"
107
115
 
116
+ it "returns ScenarioDefinition" do
117
+ @scenario.twice.should === @scenario.definition
118
+ end
119
+
108
120
  it "sets up a Times Called Expectation with 2" do
109
- @scenario.twice.should === @scenario
121
+ @scenario.twice
110
122
  @scenario.call(@double)
111
123
  @scenario.call(@double)
112
124
  proc {@scenario.call(@double)}.should raise_error(Errors::TimesCalledError)
@@ -121,13 +133,13 @@ end
121
133
  describe Scenario, "#at_least" do
122
134
  it_should_behave_like "RR::Scenario"
123
135
 
124
- it "returns self" do
125
- @scenario.with_any_args.at_least(2).should === @scenario
136
+ it "returns ScenarioDefinition" do
137
+ @scenario.with_any_args.at_least(2).should === @scenario.definition
126
138
  end
127
139
 
128
- it "sets up a Times Called Expectation with 1" do
140
+ it "sets up a AtLeastMatcher with 2" do
129
141
  @scenario.at_least(2)
130
- @scenario.times_matcher.should == TimesCalledMatchers::AtLeastMatcher.new(2)
142
+ @scenario.definition.times_matcher.should == TimesCalledMatchers::AtLeastMatcher.new(2)
131
143
  end
132
144
 
133
145
  it "sets return value when block passed in" do
@@ -139,8 +151,8 @@ end
139
151
  describe Scenario, "#at_most" do
140
152
  it_should_behave_like "RR::Scenario"
141
153
 
142
- it "returns self" do
143
- @scenario.with_any_args.at_most(2).should === @scenario
154
+ it "returns ScenarioDefinition" do
155
+ @scenario.with_any_args.at_most(2).should === @scenario.definition
144
156
  end
145
157
 
146
158
  it "sets up a Times Called Expectation with 1" do
@@ -164,8 +176,12 @@ end
164
176
  describe Scenario, "#times" do
165
177
  it_should_behave_like "RR::Scenario"
166
178
 
179
+ it "returns ScenarioDefinition" do
180
+ @scenario.times(3).should === @scenario.definition
181
+ end
182
+
167
183
  it "sets up a Times Called Expectation with passed in times" do
168
- @scenario.times(3).should === @scenario
184
+ @scenario.times(3)
169
185
  @scenario.call(@double)
170
186
  @scenario.call(@double)
171
187
  @scenario.call(@double)
@@ -181,8 +197,8 @@ end
181
197
  describe Scenario, "#any_number_of_times" do
182
198
  it_should_behave_like "RR::Scenario"
183
199
 
184
- it "returns self" do
185
- @scenario.any_number_of_times.should === @scenario
200
+ it "returns ScenarioDefinition" do
201
+ @scenario.any_number_of_times.should === @scenario.definition
186
202
  end
187
203
 
188
204
  it "sets up a Times Called Expectation with AnyTimes matcher" do
@@ -232,8 +248,8 @@ end
232
248
  describe Scenario, "#yields" do
233
249
  it_should_behave_like "RR::Scenario"
234
250
 
235
- it "returns self" do
236
- @scenario.yields(:baz).should === @scenario
251
+ it "returns ScenarioDefinition" do
252
+ @scenario.yields(:baz).should === @scenario.definition
237
253
  end
238
254
 
239
255
  it "yields the passed in argument to the call block when there is no returns value set" do
@@ -260,8 +276,8 @@ end
260
276
  describe Scenario, "#after_call" do
261
277
  it_should_behave_like "RR::Scenario"
262
278
 
263
- it "returns self" do
264
- @scenario.after_call {}.should === @scenario
279
+ it "returns ScenarioDefinition" do
280
+ @scenario.after_call {}.should === @scenario.definition
265
281
  end
266
282
 
267
283
  it "sends return value of Scenario implementation to after_call" do
@@ -306,9 +322,9 @@ end
306
322
  describe Scenario, "#returns" do
307
323
  it_should_behave_like "RR::Scenario"
308
324
 
309
- it "returns self" do
310
- @scenario.returns {:baz}.should === @scenario
311
- @scenario.returns(:baz).should === @scenario
325
+ it "returns ScenarioDefinition" do
326
+ @scenario.returns {:baz}.should === @scenario.definition
327
+ @scenario.returns(:baz).should === @scenario.definition
312
328
  end
313
329
 
314
330
  it "sets the value of the method when passed a block" do
@@ -336,8 +352,8 @@ end
336
352
  describe Scenario, "#implemented_by" do
337
353
  it_should_behave_like "RR::Scenario"
338
354
 
339
- it "returns the scenario object" do
340
- @scenario.implemented_by(proc{:baz}).should === @scenario
355
+ it "returns the ScenarioDefinition" do
356
+ @scenario.implemented_by(proc{:baz}).should === @scenario.definition
341
357
  end
342
358
 
343
359
  it "sets the implementation to the passed in proc" do
@@ -357,8 +373,8 @@ end
357
373
  describe Scenario, "#implemented_by_original_method" do
358
374
  it_should_behave_like "RR::Scenario"
359
375
 
360
- it "returns the scenario object" do
361
- @scenario.implemented_by_original_method.should === @scenario
376
+ it "returns the ScenarioDefinition object" do
377
+ @scenario.implemented_by_original_method.should === @scenario.definition
362
378
  end
363
379
 
364
380
  it "sets the implementation to the original method" do
@@ -573,7 +589,7 @@ describe Scenario, "#attempt?" do
573
589
 
574
590
  it "returns true when there is no Times Called expectation" do
575
591
  @scenario.with(1, 2, 3)
576
- @scenario.times_called_expectation.should be_nil
592
+ @scenario.definition.times_matcher.should be_nil
577
593
  @scenario.should be_attempt
578
594
  end
579
595
  end
@@ -616,8 +632,8 @@ describe Scenario, "#terminal?" do
616
632
  @scenario.should_not be_terminal
617
633
  end
618
634
 
619
- it "returns false when there is not times_called_expectation" do
620
- @scenario.times_called_expectation.should be_nil
635
+ it "returns false when there is no times_matcher" do
636
+ @scenario.definition.times_matcher.should be_nil
621
637
  @scenario.should_not be_terminal
622
638
  end
623
639
  end
@@ -32,7 +32,7 @@ describe ScenarioMethodProxy, ".new without block" do
32
32
  proxy_subclass.instance_methods.should include('i_should_be_a_scenario')
33
33
 
34
34
  proxy = proxy_subclass.new(@space, @creator, @subject)
35
- proxy.i_should_be_a_scenario.should be_instance_of(Scenario)
35
+ proxy.i_should_be_a_scenario.should be_instance_of(ScenarioDefinition)
36
36
  end
37
37
  end
38
38
 
@@ -63,7 +63,7 @@ describe ScenarioMethodProxy, ".new with block" do
63
63
  proxy_subclass.instance_methods.should include('i_should_be_a_scenario')
64
64
 
65
65
  proxy_subclass.new(@space, @creator, @subject) do |m|
66
- m.i_should_be_a_scenario.should be_instance_of(Scenario)
66
+ m.i_should_be_a_scenario.should be_instance_of(ScenarioDefinition)
67
67
  end
68
68
  end
69
69
  end
@@ -161,9 +161,9 @@ describe Space, "#verify_ordered_scenario where the passed in scenario is not at
161
161
  end
162
162
 
163
163
  def scenario
164
- scenario = @space.scenario(@double).once
165
- @space.register_ordered_scenario(scenario)
166
- scenario
164
+ scenario_definition = @space.scenario(@double).once
165
+ @space.register_ordered_scenario(scenario_definition.scenario)
166
+ scenario_definition.scenario
167
167
  end
168
168
  end
169
169
  end
data/lib/rr.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require "forwardable"
2
+
1
3
  require "rr/errors/rr_error"
2
4
  require "rr/errors/scenario_definition_error"
3
5
  require "rr/errors/scenario_not_found_error"
@@ -14,6 +16,8 @@ require "rr/scenario_method_proxy"
14
16
  require "rr/scenario_creator"
15
17
 
16
18
  require "rr/scenario"
19
+ require "rr/scenario_definition"
20
+ require "rr/scenario_definition_builder"
17
21
  require "rr/scenario_matches"
18
22
 
19
23
  require "rr/expectations/argument_equality_expectation"
@@ -1,12 +1,11 @@
1
1
  module RR
2
2
  module Expectations
3
3
  class TimesCalledExpectation
4
- attr_reader :matcher, :times_called
4
+ attr_reader :times_called
5
+ attr_accessor :matcher
5
6
 
6
- def initialize(matcher=nil, &time_condition_block)
7
- raise ArgumentError, "Cannot pass in both an argument and a block" if matcher && time_condition_block
8
- matcher_value = matcher || time_condition_block
9
- @matcher = TimesCalledMatchers::TimesCalledMatcher.create(matcher_value)
7
+ def initialize(matcher=nil)
8
+ @matcher = matcher
10
9
  @times_called = 0
11
10
  @verify_backtrace = caller[1..-1]
12
11
  end
@@ -153,6 +153,22 @@ module Extensions
153
153
  alias_method :do_not_allow, :do_not_call
154
154
  alias_method :dont_allow, :do_not_call
155
155
 
156
+ # Calling instance_of will cause all instances of the passed in Class
157
+ # to have the Scenario defined.
158
+ #
159
+ # The following example mocks all User's valid? method and return false.
160
+ # mock.instance_of(User).valid? {false}
161
+ #
162
+ # The following example mocks and probes User#projects and returns the
163
+ # first 3 projects.
164
+ # mock.instance_of(User).projects do |projects|
165
+ # projects[0..2]
166
+ # end
167
+ def instance_of(subject=ScenarioCreator::NO_SUBJECT_ARG, method_name=nil, &definition)
168
+ creator = RR::Space.scenario_creator
169
+ creator.instance_of(subject, method_name, &definition)
170
+ end
171
+
156
172
  # Returns a AnyTimesMatcher. This is meant to be passed in as an argument
157
173
  # to Scenario#times.
158
174
  #
data/lib/rr/scenario.rb CHANGED
@@ -15,19 +15,15 @@ module RR
15
15
  end.join("\n")
16
16
  end
17
17
  end
18
- ORIGINAL_METHOD = Object.new
19
18
 
20
- attr_reader :times_called, :argument_expectation, :times_called_expectation, :double
19
+ attr_reader :times_called, :double, :definition
21
20
 
22
- def initialize(space, double)
21
+ def initialize(space, double, definition)
23
22
  @space = space
24
23
  @double = double
25
- @implementation = nil
26
- @argument_expectation = nil
27
- @times_called_expectation = nil
24
+ @definition = definition
28
25
  @times_called = 0
29
- @after_call = nil
30
- @yields = nil
26
+ @times_called_expectation = Expectations::TimesCalledExpectation.new
31
27
  end
32
28
 
33
29
  # Scenario#with sets the expectation that the Scenario will receive
@@ -37,9 +33,7 @@ module RR
37
33
  #
38
34
  # mock(subject).method_name.with(1, 2) {:return_value}
39
35
  def with(*args, &returns)
40
- @argument_expectation = Expectations::ArgumentEqualityExpectation.new(*args)
41
- returns(&returns) if returns
42
- self
36
+ definition.with(*args, &returns)
43
37
  end
44
38
 
45
39
  # Scenario#with_any_args sets the expectation that the Scenario can receive
@@ -49,9 +43,7 @@ module RR
49
43
  #
50
44
  # mock(subject).method_name.with_any_args {:return_value}
51
45
  def with_any_args(&returns)
52
- @argument_expectation = Expectations::AnyArgumentExpectation.new
53
- returns(&returns) if returns
54
- self
46
+ definition.with_any_args(&returns)
55
47
  end
56
48
 
57
49
  # Scenario#with_no_args sets the expectation that the Scenario will receive
@@ -61,9 +53,7 @@ module RR
61
53
  #
62
54
  # mock(subject).method_name.with_no_args {:return_value}
63
55
  def with_no_args(&returns)
64
- @argument_expectation = Expectations::ArgumentEqualityExpectation.new()
65
- returns(&returns) if returns
66
- self
56
+ definition.with_no_args(&returns)
67
57
  end
68
58
 
69
59
  # Scenario#never sets the expectation that the Scenario will never be
@@ -73,8 +63,7 @@ module RR
73
63
  #
74
64
  # mock(subject).method_name.never
75
65
  def never
76
- @times_called_expectation = Expectations::TimesCalledExpectation.new(0)
77
- self
66
+ definition.never
78
67
  end
79
68
 
80
69
  # Scenario#once sets the expectation that the Scenario will be called
@@ -84,9 +73,7 @@ module RR
84
73
  #
85
74
  # mock(subject).method_name.once {:return_value}
86
75
  def once(&returns)
87
- @times_called_expectation = Expectations::TimesCalledExpectation.new(1)
88
- returns(&returns) if returns
89
- self
76
+ definition.once(&returns)
90
77
  end
91
78
 
92
79
  # Scenario#twice sets the expectation that the Scenario will be called
@@ -96,9 +83,7 @@ module RR
96
83
  #
97
84
  # mock(subject).method_name.twice {:return_value}
98
85
  def twice(&returns)
99
- @times_called_expectation = Expectations::TimesCalledExpectation.new(2)
100
- returns(&returns) if returns
101
- self
86
+ definition.twice(&returns)
102
87
  end
103
88
 
104
89
  # Scenario#at_least sets the expectation that the Scenario
@@ -109,10 +94,7 @@ module RR
109
94
  #
110
95
  # mock(subject).method_name.at_least(4) {:return_value}
111
96
  def at_least(number, &returns)
112
- matcher = RR::TimesCalledMatchers::AtLeastMatcher.new(number)
113
- @times_called_expectation = Expectations::TimesCalledExpectation.new(matcher)
114
- returns(&returns) if returns
115
- self
97
+ definition.at_least(number, &returns)
116
98
  end
117
99
 
118
100
  # Scenario#at_most allows sets the expectation that the Scenario
@@ -123,10 +105,7 @@ module RR
123
105
  #
124
106
  # mock(subject).method_name.at_most(4) {:return_value}
125
107
  def at_most(number, &returns)
126
- matcher = RR::TimesCalledMatchers::AtMostMatcher.new(number)
127
- @times_called_expectation = Expectations::TimesCalledExpectation.new(matcher)
128
- returns(&returns) if returns
129
- self
108
+ definition.at_most(number, &returns)
130
109
  end
131
110
 
132
111
  # Scenario#any_number_of_times sets an that the Scenario will be called
@@ -137,9 +116,7 @@ module RR
137
116
  #
138
117
  # mock(subject).method_name.any_number_of_times
139
118
  def any_number_of_times(&returns)
140
- @times_called_expectation = Expectations::TimesCalledExpectation.new(TimesCalledMatchers::AnyTimesMatcher.new)
141
- returns(&returns) if returns
142
- self
119
+ definition.any_number_of_times(&returns)
143
120
  end
144
121
 
145
122
  # Scenario#times creates an TimesCalledExpectation of the passed
@@ -149,9 +126,7 @@ module RR
149
126
  #
150
127
  # mock(subject).method_name.times(4) {:return_value}
151
128
  def times(number, &returns)
152
- @times_called_expectation = Expectations::TimesCalledExpectation.new(number)
153
- returns(&returns) if returns
154
- self
129
+ definition.times(number, &returns)
155
130
  end
156
131
 
157
132
  # Scenario#ordered sets the Scenario to have an ordered
@@ -161,17 +136,14 @@ module RR
161
136
  #
162
137
  # mock(subject).method_name.ordered {return_value}
163
138
  def ordered(&returns)
164
- @ordered = true
165
- @space.ordered_scenarios << self unless @space.ordered_scenarios.include?(self)
166
- returns(&returns) if returns
167
- self
139
+ definition.ordered(&returns)
168
140
  end
169
141
 
170
142
  # Scenario#ordered? returns true when the Scenario is ordered.
171
143
  #
172
144
  # mock(subject).method_name.ordered?
173
145
  def ordered?
174
- @ordered
146
+ definition.ordered?
175
147
  end
176
148
 
177
149
  # Scenario#yields sets the Scenario to invoke a passed in block when
@@ -184,9 +156,7 @@ module RR
184
156
  # mock(subject).method_name.yields(yield_arg1, yield_arg2) {return_value}
185
157
  # subject.method_name {|yield_arg1, yield_arg2|}
186
158
  def yields(*args, &returns)
187
- @yields = args
188
- returns(&returns) if returns
189
- self
159
+ definition.yields(*args, &returns)
190
160
  end
191
161
 
192
162
  # Scenario#after_call creates a callback that occurs after call
@@ -200,9 +170,7 @@ module RR
200
170
  # This feature is built into probes.
201
171
  # probe(User).find('1') {|user| mock(user).valid? {false}}
202
172
  def after_call(&block)
203
- raise ArgumentError, "after_call expects a block" unless block
204
- @after_call = block
205
- self
173
+ definition.after_call &block
206
174
  end
207
175
 
208
176
  # Scenario#returns accepts an argument value or a block.
@@ -213,14 +181,7 @@ module RR
213
181
  #
214
182
  # Passing in an argument causes Scenario to return the argument.
215
183
  def returns(value=nil, &implementation)
216
- if value && implementation
217
- raise ArgumentError, "returns cannot accept both an argument and a block"
218
- end
219
- if value.nil?
220
- implemented_by implementation
221
- else
222
- implemented_by proc {value}
223
- end
184
+ definition.returns(value, &implementation)
224
185
  end
225
186
 
226
187
  # Scenario#implemented_by sets the implementation of the Scenario.
@@ -233,8 +194,7 @@ module RR
233
194
  # end
234
195
  # mock(obj).method_name.implemented_by(obj.method(:foobar))
235
196
  def implemented_by(implementation)
236
- @implementation = implementation
237
- self
197
+ definition.implemented_by implementation
238
198
  end
239
199
 
240
200
  # Scenario#implemented_by_original_method sets the implementation
@@ -248,8 +208,7 @@ module RR
248
208
  # mock(obj).method_name.implemented_by_original_method
249
209
  # obj.foobar {|arg| puts arg} # puts 1
250
210
  def implemented_by_original_method
251
- implemented_by ORIGINAL_METHOD
252
- self
211
+ definition.implemented_by_original_method
253
212
  end
254
213
 
255
214
  # Scenario#call calls the Scenario's implementation. The return
@@ -258,28 +217,28 @@ module RR
258
217
  # A TimesCalledError is raised when the times called
259
218
  # exceeds the expected TimesCalledExpectation.
260
219
  def call(double, *args, &block)
261
- @times_called_expectation.attempt! if @times_called_expectation
220
+ self.times_called_expectation.attempt! if definition.times_matcher
262
221
  @space.verify_ordered_scenario(self) if ordered?
263
222
  yields!(block)
264
223
  return_value = call_implementation(double, *args, &block)
265
- return return_value unless @after_call
266
- @after_call.call(return_value)
224
+ return return_value unless definition.after_call_value
225
+ definition.after_call_value.call(return_value)
267
226
  end
268
227
 
269
228
  def yields!(block)
270
- if @yields
229
+ if definition.yields_value
271
230
  unless block
272
231
  raise ArgumentError, "A Block must be passed into the method call when using yields"
273
232
  end
274
- block.call(*@yields)
233
+ block.call(*definition.yields_value)
275
234
  end
276
235
  end
277
236
  protected :yields!
278
237
 
279
238
  def call_implementation(double, *args, &block)
280
- return nil unless @implementation
239
+ return nil unless implementation
281
240
 
282
- if @implementation === ORIGINAL_METHOD
241
+ if implementation === ScenarioDefinition::ORIGINAL_METHOD
283
242
  if double.original_method
284
243
  return double.original_method.call(*args, &block)
285
244
  else
@@ -292,11 +251,11 @@ module RR
292
251
  end
293
252
  end
294
253
 
295
- if @implementation.is_a?(Method)
296
- return @implementation.call(*args, &block)
254
+ if implementation.is_a?(Method)
255
+ return implementation.call(*args, &block)
297
256
  else
298
257
  args << block if block
299
- return @implementation.call(*args)
258
+ return implementation.call(*args)
300
259
  end
301
260
  end
302
261
  protected :call_implementation
@@ -304,36 +263,34 @@ module RR
304
263
  # Scenario#exact_match? returns true when the passed in arguments
305
264
  # exactly match the ArgumentEqualityExpectation arguments.
306
265
  def exact_match?(*arguments)
307
- return false unless @argument_expectation
308
- @argument_expectation.exact_match?(*arguments)
266
+ definition.exact_match?(*arguments)
309
267
  end
310
268
 
311
269
  # Scenario#wildcard_match? returns true when the passed in arguments
312
270
  # wildcard match the ArgumentEqualityExpectation arguments.
313
271
  def wildcard_match?(*arguments)
314
- return false unless @argument_expectation
315
- @argument_expectation.wildcard_match?(*arguments)
272
+ definition.wildcard_match?(*arguments)
316
273
  end
317
274
 
318
275
  # Scenario#attempt? returns true when the
319
276
  # TimesCalledExpectation is satisfied.
320
277
  def attempt?
321
- return true unless @times_called_expectation
322
- @times_called_expectation.attempt?
278
+ return true unless definition.times_matcher
279
+ times_called_expectation.attempt?
323
280
  end
324
281
 
325
282
  # Scenario#verify verifies the the TimesCalledExpectation
326
283
  # is satisfied for this scenario. A TimesCalledError
327
284
  # is raised if the TimesCalledExpectation is not met.
328
285
  def verify
329
- return true unless @times_called_expectation
330
- @times_called_expectation.verify!
286
+ return true unless definition.times_matcher
287
+ times_called_expectation.verify!
331
288
  true
332
289
  end
333
290
 
334
291
  def terminal?
335
- return false unless @times_called_expectation
336
- @times_called_expectation.terminal?
292
+ return false unless definition.times_matcher
293
+ times_called_expectation.terminal?
337
294
  end
338
295
 
339
296
  # The method name that this Scenario is attatched to
@@ -351,5 +308,26 @@ module RR
351
308
  def times_matcher
352
309
  times_called_expectation.matcher
353
310
  end
311
+
312
+ def times_called_expectation
313
+ @times_called_expectation.matcher = definition.times_matcher
314
+ @times_called_expectation
315
+ end
316
+
317
+ def implementation
318
+ definition.implementation
319
+ end
320
+ def implementation=(value)
321
+ definition.implementation = value
322
+ end
323
+ protected :implementation=
324
+
325
+ def argument_expectation
326
+ definition.argument_expectation
327
+ end
328
+ def argument_expectation=(value)
329
+ definition.argument_expectation = value
330
+ end
331
+ protected :argument_expectation=
354
332
  end
355
333
  end