public
Description: RR (Double Ruby) is a test double framework that features a rich selection of double techniques and a terse syntax.
Homepage: http://rubyforge.org/projects/double-ruby
Clone URL: git://github.com/btakita/rr.git
DoubleDefinitionCreatorProxy does not undef #object_id.


git-svn-id: svn+ssh://rubyforge.org/var/svn/pivotalrb/rr/trunk@1731 
af276e61-6b34-4dac-905b-574b5f35ef33
btakita (author)
Fri Jul 04 00:06:33 -0700 2008
commit  9dff2a3539f5607a304c7202349a21592fa7d25e
tree    021d3f82f37f691fe6ee98087e596ba024ceca2e
parent  99ace7f90db3a3b593cd40f658d63433fea46d01
...
2
3
4
 
...
2
3
4
5
0
@@ -2,3 +2,4 @@
0
 *.ipr
0
 *.iws
0
 previous_failures.txt
0
+pkg
...
 
 
1
2
3
...
1
2
3
4
5
0
@@ -1,3 +1,5 @@
0
+- DoubleDefinitionCreatorProxy does not undef #object_id
0
+
0
 * 0.4.9
0
 - Proxying from RR module to RR::Space.instance
0
 
...
5
6
7
8
 
 
 
9
10
11
...
5
6
7
 
8
9
10
11
12
13
0
@@ -5,7 +5,9 @@ module RR
0
       @object = object
0
       class << self
0
         instance_methods.each do |m|
0
- undef_method m unless m =~ /^__/
0
+ unless m =~ /^_/ || m.to_s == 'object_id'
0
+ undef_method m
0
+ end
0
         end
0
 
0
         def method_missing(method_name, *args, &block)
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
...
21
22
23
24
25
26
27
28
29
30
31
32
 
 
 
 
 
33
 
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 
 
 
 
51
52
53
54
55
56
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
59
60
61
62
 
 
 
 
 
 
 
63
64
65
66
67
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
70
71
 
72
73
74
...
1
2
3
 
 
 
 
 
 
 
 
 
4
5
6
...
12
13
14
 
 
 
 
 
 
 
 
 
15
16
17
18
19
20
21
22
 
 
 
 
23
24
25
 
 
 
 
 
 
 
 
 
26
27
28
29
30
31
 
 
 
 
 
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 
 
 
51
52
53
54
55
56
57
58
59
 
60
 
 
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
0
@@ -1,15 +1,6 @@
0
 require "spec/spec_helper"
0
 
0
 module RR
0
- describe DoubleDefinitionCreatorProxy, "initializes proxy with passed in creator", :shared => true do
0
- it "initializes proxy with passed in creator" do
0
- class << the_proxy
0
- attr_reader :creator
0
- end
0
- the_proxy.creator.should === creator
0
- end
0
- end
0
-
0
   describe DoubleDefinitionCreatorProxy do
0
     attr_reader :space, :subject, :creator, :the_proxy
0
     it_should_behave_like "Swapped Space"
0
@@ -21,53 +12,74 @@ module RR
0
       creator.mock
0
     end
0
 
0
- describe ".new without block" do
0
- it_should_behave_like "RR::DoubleDefinitionCreatorProxy initializes proxy with passed in creator"
0
- before do
0
- @the_proxy = DoubleDefinitionCreatorProxy.new(creator, subject)
0
- end
0
-
0
- it "clears out all methods from proxy" do
0
- proxy_subclass = Class.new(DoubleDefinitionCreatorProxy) do
0
- def i_should_be_a_double
0
+ class << self
0
+ define_method("initializes proxy with passed in creator") do
0
+ it "initializes proxy with passed in creator" do
0
+ class << the_proxy
0
+ attr_reader :creator
0
           end
0
+ the_proxy.creator.should === creator
0
         end
0
- proxy_subclass.instance_methods.should include('i_should_be_a_double')
0
-
0
- proxy = proxy_subclass.new(creator, subject)
0
- proxy.i_should_be_a_double.should be_instance_of(DoubleDefinition)
0
       end
0
     end
0
 
0
- describe ".new with block" do
0
- it_should_behave_like "RR::DoubleDefinitionCreatorProxy initializes proxy with passed in creator"
0
- before do
0
- @the_proxy = DoubleDefinitionCreatorProxy.new(creator, subject) do |b|
0
- b.foobar(1, 2) {:one_two}
0
- b.foobar(1) {:one}
0
- b.foobar.with_any_args {:default}
0
- b.baz() {:baz_result}
0
- end
0
+ describe ".new" do
0
+ it "does not undefine object_id" do
0
+ the_proxy = DoubleDefinitionCreatorProxy.new(creator, subject)
0
+ the_proxy.object_id.class.should == Fixnum
0
       end
0
 
0
- it "creates double_injections" do
0
- subject.foobar(1, 2).should == :one_two
0
- subject.foobar(1).should == :one
0
- subject.foobar(:something).should == :default
0
- subject.baz.should == :baz_result
0
+ context "without block" do
0
+ before do
0
+ @the_proxy = DoubleDefinitionCreatorProxy.new(creator, subject)
0
+ end
0
+
0
+ send "initializes proxy with passed in creator"
0
+
0
+ it "clears out all methods from proxy" do
0
+ proxy_subclass = Class.new(DoubleDefinitionCreatorProxy) do
0
+ def i_should_be_a_double
0
+ end
0
+ end
0
+ proxy_subclass.instance_methods.map {|m| m.to_s}.should include('i_should_be_a_double')
0
+
0
+ proxy = proxy_subclass.new(creator, subject)
0
+ proxy.i_should_be_a_double.should be_instance_of(DoubleDefinition)
0
+ end
0
       end
0
 
0
- it "clears out all methods from proxy" do
0
- proxy_subclass = Class.new(DoubleDefinitionCreatorProxy) do
0
- def i_should_be_a_double
0
+ context "with block" do
0
+ before do
0
+ @the_proxy = DoubleDefinitionCreatorProxy.new(creator, subject) do |b|
0
+ b.foobar(1, 2) {:one_two}
0
+ b.foobar(1) {:one}
0
+ b.foobar.with_any_args {:default}
0
+ b.baz() {:baz_result}
0
           end
0
         end
0
- proxy_subclass.instance_methods.should include('i_should_be_a_double')
0
 
0
- proxy_subclass.new(creator, subject) do |m|
0
- m.i_should_be_a_double.should be_instance_of(DoubleDefinition)
0
+ send "initializes proxy with passed in creator"
0
+
0
+ it "creates double_injections" do
0
+ subject.foobar(1, 2).should == :one_two
0
+ subject.foobar(1).should == :one
0
+ subject.foobar(:something).should == :default
0
+ subject.baz.should == :baz_result
0
+ end
0
+
0
+ it "clears out all methods from proxy" do
0
+ proxy_subclass = Class.new(DoubleDefinitionCreatorProxy) do
0
+ def i_should_be_a_double
0
+ end
0
+ end
0
+ proxy_subclass.instance_methods.map {|m| m.to_s}.should include('i_should_be_a_double')
0
+
0
+ proxy_subclass.new(creator, subject) do |m|
0
+ m.i_should_be_a_double.should be_instance_of(DoubleDefinition)
0
+ end
0
         end
0
       end
0
     end
0
+
0
   end
0
 end
0
\ No newline at end of file

Comments

    No one has commented yet.