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 CHANGED
@@ -1,3 +1,6 @@
1
+ * 0.3.3
2
+ - Fixed [#12495] Error Probing method_missing interaction
3
+
1
4
  * 0.3.2
2
5
  - Fixed [#12486] ScenarioMethodProxy when Kernel passed into instance methods
3
6
 
data/Rakefile CHANGED
@@ -21,7 +21,7 @@ def run_suite
21
21
  end
22
22
 
23
23
  PKG_NAME = "rr"
24
- PKG_VERSION = "0.3.2"
24
+ PKG_VERSION = "0.3.3"
25
25
  PKG_FILES = FileList[
26
26
  '[A-Z]*',
27
27
  '*.rb',
@@ -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 "raises error when original_method does not exist" do
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
- proc do
376
- @object.does_not_exist(1, 2)
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
 
@@ -280,11 +280,16 @@ module RR
280
280
  return nil unless @implementation
281
281
 
282
282
  if @implementation === ORIGINAL_METHOD
283
- if !double.original_method
284
- raise Errors::ScenarioDefinitionError,
285
- "implemented_by_original_method (probe) cannot be used when method does not exist on the object"
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.2
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: