rr 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +3 -0
- data/Rakefile +1 -1
- data/examples/rr/scenario_example.rb +8 -7
- data/lib/rr/scenario.rb +9 -4
- metadata +1 -1
data/CHANGES
CHANGED
data/Rakefile
CHANGED
@@ -366,18 +366,19 @@ describe Scenario, "#implemented_by_original_method" do
|
|
366
366
|
@scenario.call(@double, 1, 2).should == [2, 1]
|
367
367
|
end
|
368
368
|
|
369
|
-
it "
|
369
|
+
it "calls method_missing when original_method does not exist" do
|
370
|
+
class << @object
|
371
|
+
def method_missing(method_name, *args, &block)
|
372
|
+
"method_missing for #{method_name}(#{args.inspect})"
|
373
|
+
end
|
374
|
+
end
|
370
375
|
double = @space.double(@object, :does_not_exist)
|
371
376
|
scenario = @space.scenario(double)
|
372
377
|
scenario.with_any_args
|
373
378
|
scenario.implemented_by_original_method
|
374
379
|
|
375
|
-
|
376
|
-
|
377
|
-
end.should raise_error(
|
378
|
-
Errors::ScenarioDefinitionError,
|
379
|
-
"implemented_by_original_method (probe) cannot be used when method does not exist on the object"
|
380
|
-
)
|
380
|
+
return_value = @object.does_not_exist(1, 2)
|
381
|
+
return_value.should == "method_missing for does_not_exist([1, 2])"
|
381
382
|
end
|
382
383
|
end
|
383
384
|
|
data/lib/rr/scenario.rb
CHANGED
@@ -280,11 +280,16 @@ module RR
|
|
280
280
|
return nil unless @implementation
|
281
281
|
|
282
282
|
if @implementation === ORIGINAL_METHOD
|
283
|
-
if
|
284
|
-
|
285
|
-
|
283
|
+
if double.original_method
|
284
|
+
return double.original_method.call(*args, &block)
|
285
|
+
else
|
286
|
+
return double.object.__send__(
|
287
|
+
:method_missing,
|
288
|
+
double.method_name,
|
289
|
+
*args,
|
290
|
+
&block
|
291
|
+
)
|
286
292
|
end
|
287
|
-
return double.original_method.call(*args, &block)
|
288
293
|
end
|
289
294
|
|
290
295
|
if @implementation.is_a?(Method)
|
metadata
CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.3
|
|
3
3
|
specification_version: 1
|
4
4
|
name: rr
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.3.
|
6
|
+
version: 0.3.3
|
7
7
|
date: 2007-07-22 00:00:00 -07:00
|
8
8
|
summary: RR (Double Ruby) is a double framework that features a rich selection of double techniques and a terse syntax. http://xunitpatterns.com/Test%20Double.html
|
9
9
|
require_paths:
|