caricature 0.7.5 → 0.7.6

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.
Files changed (74) hide show
  1. data/README.rdoc +97 -97
  2. data/Rakefile +309 -310
  3. data/caricature.gemspec +123 -110
  4. data/lib/caricature/bacon/integration.rb +75 -75
  5. data/lib/caricature/bacon.rb +2 -2
  6. data/lib/caricature/clr/descriptor.rb +159 -159
  7. data/lib/caricature/clr/event_verification.rb +56 -56
  8. data/lib/caricature/clr/expectation.rb +100 -100
  9. data/lib/caricature/clr/isolation.rb +78 -78
  10. data/lib/caricature/clr/isolator.rb +252 -252
  11. data/lib/caricature/clr/messenger.rb +51 -49
  12. data/lib/caricature/clr/method_call_recorder.rb +96 -96
  13. data/lib/caricature/expectation.rb +1 -1
  14. data/lib/caricature/method_call_recorder.rb +3 -3
  15. data/lib/caricature/rspec/integration.rb +118 -118
  16. data/lib/caricature/version.rb +5 -5
  17. data/lib/caricature.rb +25 -25
  18. data/spec/bacon/integration/callback_spec.rb +156 -156
  19. data/spec/bacon/integration/clr_to_clr_spec.rb +325 -253
  20. data/spec/bacon/integration/event_spec.rb +97 -97
  21. data/spec/bacon/integration/indexer_spec.rb +27 -27
  22. data/spec/bacon/spec_helper.rb +4 -4
  23. data/spec/bacon/unit/descriptor_spec.rb +212 -212
  24. data/spec/bacon/unit/sword_spec.rb +39 -39
  25. data/spec/bacon/unit/verification_spec.rb +103 -103
  26. data/spec/bin/ClrModels.dll +0 -0
  27. data/spec/bin/ClrModels.dll.mdb +0 -0
  28. data/spec/fixtures/ExplodingCar.cs +56 -0
  29. data/spec/fixtures/ExposedChangedSubscriber.cs +26 -0
  30. data/spec/fixtures/ExposingWarrior.cs +58 -0
  31. data/spec/fixtures/IExplodingWarrior.cs +10 -0
  32. data/spec/fixtures/IExposing.cs +9 -0
  33. data/spec/fixtures/IExposingBridge.cs +9 -0
  34. data/spec/fixtures/IExposingWarrior.cs +8 -0
  35. data/spec/fixtures/IHaveAnIndexer.cs +8 -0
  36. data/spec/fixtures/IWarrior.cs +13 -0
  37. data/spec/fixtures/IWeapon.cs +9 -0
  38. data/spec/fixtures/IndexerCaller.cs +17 -0
  39. data/spec/fixtures/IndexerContained.cs +20 -0
  40. data/spec/fixtures/MyClassWithAStatic.cs +16 -0
  41. data/spec/fixtures/Ninja.cs +34 -0
  42. data/spec/fixtures/Samurai.cs +29 -0
  43. data/spec/fixtures/StaticCaller.cs +12 -0
  44. data/spec/fixtures/Sword.cs +16 -0
  45. data/spec/fixtures/SwordWithStatics.cs +19 -0
  46. data/spec/fixtures/clr_interaction.rb +61 -0
  47. data/spec/fixtures/dagger.rb +11 -0
  48. data/spec/fixtures/dagger_with_class_members.rb +11 -0
  49. data/spec/fixtures/sheath.rb +19 -0
  50. data/spec/fixtures/soldier.rb +29 -0
  51. data/spec/fixtures/soldier_with_class_members.rb +7 -0
  52. data/spec/fixtures/swift_cleanup_crew.rb +21 -0
  53. data/spec/fixtures/with_class_methods.rb +11 -0
  54. data/spec/{models → models.notused}/ClrModels.cs +241 -241
  55. data/spec/{models → models.notused}/ruby_models.rb +150 -150
  56. data/spec/rspec/integration/callback_spec.rb +156 -156
  57. data/spec/rspec/integration/clr_to_clr_spec.rb +254 -254
  58. data/spec/rspec/integration/clr_to_ruby_spec.rb +227 -227
  59. data/spec/rspec/integration/indexer_spec.rb +27 -27
  60. data/spec/rspec/integration/ruby_to_ruby_spec.rb +271 -271
  61. data/spec/rspec/spec_helper.rb +12 -12
  62. data/spec/rspec/unit/core_ext_spec.rb +87 -87
  63. data/spec/rspec/unit/descriptor_spec.rb +210 -210
  64. data/spec/rspec/unit/event_spec.rb +16 -16
  65. data/spec/rspec/unit/expectation_spec.rb +300 -300
  66. data/spec/rspec/unit/interop_spec.rb +29 -29
  67. data/spec/rspec/unit/isolation_spec.rb +86 -86
  68. data/spec/rspec/unit/isolator_spec.rb +219 -219
  69. data/spec/rspec/unit/messaging_spec.rb +310 -310
  70. data/spec/rspec/unit/method_call_spec.rb +342 -342
  71. data/spec/rspec/unit/sword_spec.rb +39 -39
  72. data/spec/rspec/unit/verification_spec.rb +103 -103
  73. data/spec/spec_helper.rb +16 -15
  74. metadata +42 -11
@@ -1,272 +1,272 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
2
-
3
- describe "Ruby to Ruby interactions" do
4
-
5
- describe "when isolating Ruby classes" do
6
-
7
- before do
8
- @dagger = Dagger.new
9
- @soldier = Caricature::Isolation.for(Soldier)
10
- end
11
-
12
- it "should work without expectations" do
13
- result = @dagger.attack @soldier
14
- result.should == nil
15
-
16
- @soldier.did_receive?(:survive_attack_with).with(@dagger).should be_successful
17
- end
18
-
19
- it "should work for expectations with an argument constraint" do
20
- @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
21
-
22
- @dagger.attack(@soldier).should == 5
23
-
24
- @soldier.did_receive?(:survive_attack_with).with(:any).should be_successful
25
- end
26
-
27
- it "should work for expectations with an argument constraint when a wrong argument is passed in" do
28
- @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
29
-
30
- @dagger.attack(Soldier.new).should == 8
31
-
32
- @soldier.did_receive?(:survive_attack_with).with(@dagger).should_not be_successful
33
- end
34
-
35
- it "should work for expectations with an argument constraint and an assertion argument constraint" do
36
- soldier = Soldier.new
37
- @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
38
-
39
- @dagger.attack(@soldier).should == 5
40
-
41
- @soldier.did_receive?(:survive_attack_with).with(@dagger).should be_successful
42
- end
43
-
44
- it "should fail for expectations with an argument constraint and an assertion argument constraint" do
45
- soldier = Soldier.new
46
- @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
47
-
48
- @dagger.attack(@soldier).should == 5
49
-
50
- @soldier.did_receive?(:survive_attack_with).with(Dagger.new).should_not be_successful
51
- end
52
-
53
- it "should work with an expectation for any arguments" do
54
- @soldier.when_receiving(:survive_attack_with).return(5)
55
-
56
- result = @dagger.attack @soldier
57
- result.should == 5
58
-
59
- @soldier.did_receive?(:survive_attack_with).with(:any).should be_successful
60
- end
61
-
62
- it "should work with an assertion for specific arguments" do
63
- @soldier.when_receiving(:survive_attack_with) do |method_should|
64
- method_should.return(5)
65
- end
66
-
67
- result = @dagger.attack @soldier
68
- result.should == 5
69
-
70
- @soldier.did_receive?(:survive_attack_with).with(@dagger).should be_successful
71
- end
72
-
73
- it "should fail for an assertion with wrong arguments" do
74
- @soldier.when_receiving(:survive_attack_with) do |method_should|
75
- method_should.return(5)
76
- end
77
-
78
- result = @dagger.attack @soldier
79
- result.should == 5
80
-
81
- @soldier.
82
- did_receive?(:survive_attack_with).
83
- with(Caricature::Isolation.for(Dagger)).
84
- should_not be_successful
85
- end
86
-
87
- end
88
-
89
- describe "when isolating Ruby classes with class members" do
90
-
91
- before do
92
- @dagger = Dagger.new
93
- @soldier = Caricature::Isolation.for(SoldierWithClassMembers)
94
- end
95
-
96
- it "should work without expectations" do
97
- result = @dagger.attack @soldier
98
- result.should == nil
99
-
100
- @soldier.did_receive?(:survive_attack_with).with(@dagger).should be_successful
101
- end
102
-
103
- it "should work for expectations with an argument constraint" do
104
- @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
105
-
106
- @dagger.attack(@soldier).should == 5
107
-
108
- @soldier.did_receive?(:survive_attack_with).with(:any).should be_successful
109
- end
110
-
111
- it "should work for an expctation on a class method without an argument constraint" do
112
- @soldier.when_class_receives(:class_name).return(5)
113
-
114
- @soldier.class.class_name.should == 5
115
-
116
- @soldier.did_class_receive?(:class_name).should be_successful
117
- end
118
-
119
- it "should work for expectations with an argument constraint when a wrong argument is passed in" do
120
- @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
121
-
122
- @dagger.attack(Soldier.new).should == 8
123
-
124
- @soldier.did_receive?(:survive_attack_with).with(@dagger).should_not be_successful
125
- end
126
-
127
- it "should work for expectations with an argument constraint and an assertion argument constraint" do
128
- soldier = Soldier.new
129
- @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
130
-
131
- @dagger.attack(@soldier).should == 5
132
-
133
- @soldier.did_receive?(:survive_attack_with).with(@dagger).should be_successful
134
- end
135
-
136
- it "should fail for expectations with an argument constraint and an assertion argument constraint" do
137
- soldier = Soldier.new
138
- @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
139
-
140
- @dagger.attack(@soldier).should == 5
141
-
142
- @soldier.did_receive?(:survive_attack_with).with(Dagger.new).should_not be_successful
143
- end
144
-
145
- it "should work with an expectation for any arguments" do
146
- @soldier.when_receiving(:survive_attack_with).return(5)
147
-
148
- result = @dagger.attack @soldier
149
- result.should == 5
150
-
151
- @soldier.did_receive?(:survive_attack_with).with(:any).should be_successful
152
- end
153
-
154
- it "should work with an assertion for specific arguments" do
155
- @soldier.when_receiving(:survive_attack_with) do |method_should|
156
- method_should.return(5)
157
- end
158
-
159
- result = @dagger.attack @soldier
160
- result.should == 5
161
-
162
- @soldier.did_receive?(:survive_attack_with).with(@dagger).should be_successful
163
- end
164
-
165
- it "should fail for an assertion with wrong arguments" do
166
- @soldier.when_receiving(:survive_attack_with) do |method_should|
167
- method_should.return(5)
168
- end
169
-
170
- result = @dagger.attack @soldier
171
- result.should == 5
172
-
173
- @soldier.
174
- did_receive?(:survive_attack_with).
175
- with(Caricature::Isolation.for(Dagger)).
176
- should_not be_successful
177
- end
178
-
179
- end
180
-
181
- describe "when isolating Ruby instances" do
182
-
183
- before do
184
- @dagger = Dagger.new
185
- @soldier = Caricature::Isolation.for(Soldier.new)
186
- end
187
-
188
- it "should work without expectations" do
189
- result = @dagger.attack @soldier
190
- result.should == nil
191
-
192
- @soldier.did_receive?(:survive_attack_with).with(@dagger).should be_successful
193
- end
194
-
195
- it "should work for expectations with an argument constraint" do
196
- @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
197
-
198
- @dagger.attack(@soldier).should == 5
199
-
200
- @soldier.did_receive?(:survive_attack_with).with(:any).should be_successful
201
- end
202
-
203
- it "should work for expectations with an argument constraint when a wrong argument is passed in" do
204
- @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
205
-
206
- @dagger.attack(Soldier.new).should == 8
207
-
208
- @soldier.did_receive?(:survive_attack_with).with(@dagger).should_not be_successful
209
- end
210
-
211
- it "should work for expectations with an argument constraint and an assertion argument constraint" do
212
- soldier = Soldier.new
213
- @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
214
-
215
- @dagger.attack(@soldier).should == 5
216
-
217
- @soldier.did_receive?(:survive_attack_with).with(@dagger).should be_successful
218
- end
219
-
220
- it "should fail for expectations with an argument constraint and an assertion argument constraint" do
221
- soldier = Soldier.new
222
- @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
223
-
224
- @dagger.attack(@soldier).should == 5
225
-
226
- @soldier.did_receive?(:survive_attack_with).with(Dagger.new).should_not be_successful
227
- end
228
-
229
- it "should work with an expectation for any arguments" do
230
- @soldier.when_receiving(:survive_attack_with).return(5)
231
-
232
- result = @dagger.attack @soldier
233
- result.should == 5
234
-
235
- @soldier.did_receive?(:survive_attack_with).with(:any).should be_successful
236
- end
237
-
238
- it "should fail for an assertion for specific arguments" do
239
- @soldier.when_receiving(:survive_attack_with) do |method_should|
240
- method_should.return(5)
241
- end
242
-
243
- result = @dagger.attack @soldier
244
- result.should == 5
245
- var = @soldier.did_receive?(:survive_attack_with).with(:any)
246
- # @soldier.did_receive?(:survive_attack_with).with(@dagger).should be_successful
247
- @soldier.should have_received(:survive_attack_with).with(@dagger)
248
- end
249
-
250
- it "should allow to delegate the method call to the real instance (partial mock)" do
251
- @soldier.when_receiving(:survive_attack_with).super_after
252
-
253
- result = @dagger.attack @soldier
254
- result.should == 8
255
-
256
- @soldier.should have_received(:survive_attack_with)
257
- end
258
-
259
- it "should be able to isolate objects with constructor params" do
260
- sheath = Caricature::Isolation.for(Sheath)
261
- sheath.when_receiving(:insert).raise("Overridden")
262
- lambda { sheath.insert(@dagger) }.should raise_error(RuntimeError, /Overridden/)
263
- end
264
-
265
- it "should be able to isolate objects with constructor params" do
266
- sheath = Caricature::Isolation.for(Sheath)
267
- lambda { sheath.insert(@dagger) }.should_not raise_error
268
- end
269
-
270
- end
271
-
1
+ require File.dirname(__FILE__) + "/../spec_helper"
2
+
3
+ describe "Ruby to Ruby interactions" do
4
+
5
+ describe "when isolating Ruby classes" do
6
+
7
+ before do
8
+ @dagger = Dagger.new
9
+ @soldier = Caricature::Isolation.for(Soldier)
10
+ end
11
+
12
+ it "should work without expectations" do
13
+ result = @dagger.attack @soldier
14
+ result.should == nil
15
+
16
+ @soldier.did_receive?(:survive_attack_with).with(@dagger).should be_successful
17
+ end
18
+
19
+ it "should work for expectations with an argument constraint" do
20
+ @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
21
+
22
+ @dagger.attack(@soldier).should == 5
23
+
24
+ @soldier.did_receive?(:survive_attack_with).with(:any).should be_successful
25
+ end
26
+
27
+ it "should work for expectations with an argument constraint when a wrong argument is passed in" do
28
+ @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
29
+
30
+ @dagger.attack(Soldier.new).should == 8
31
+
32
+ @soldier.did_receive?(:survive_attack_with).with(@dagger).should_not be_successful
33
+ end
34
+
35
+ it "should work for expectations with an argument constraint and an assertion argument constraint" do
36
+ soldier = Soldier.new
37
+ @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
38
+
39
+ @dagger.attack(@soldier).should == 5
40
+
41
+ @soldier.did_receive?(:survive_attack_with).with(@dagger).should be_successful
42
+ end
43
+
44
+ it "should fail for expectations with an argument constraint and an assertion argument constraint" do
45
+ soldier = Soldier.new
46
+ @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
47
+
48
+ @dagger.attack(@soldier).should == 5
49
+
50
+ @soldier.did_receive?(:survive_attack_with).with(Dagger.new).should_not be_successful
51
+ end
52
+
53
+ it "should work with an expectation for any arguments" do
54
+ @soldier.when_receiving(:survive_attack_with).return(5)
55
+
56
+ result = @dagger.attack @soldier
57
+ result.should == 5
58
+
59
+ @soldier.did_receive?(:survive_attack_with).with(:any).should be_successful
60
+ end
61
+
62
+ it "should work with an assertion for specific arguments" do
63
+ @soldier.when_receiving(:survive_attack_with) do |method_should|
64
+ method_should.return(5)
65
+ end
66
+
67
+ result = @dagger.attack @soldier
68
+ result.should == 5
69
+
70
+ @soldier.did_receive?(:survive_attack_with).with(@dagger).should be_successful
71
+ end
72
+
73
+ it "should fail for an assertion with wrong arguments" do
74
+ @soldier.when_receiving(:survive_attack_with) do |method_should|
75
+ method_should.return(5)
76
+ end
77
+
78
+ result = @dagger.attack @soldier
79
+ result.should == 5
80
+
81
+ @soldier.
82
+ did_receive?(:survive_attack_with).
83
+ with(Caricature::Isolation.for(Dagger)).
84
+ should_not be_successful
85
+ end
86
+
87
+ end
88
+
89
+ describe "when isolating Ruby classes with class members" do
90
+
91
+ before do
92
+ @dagger = Dagger.new
93
+ @soldier = Caricature::Isolation.for(SoldierWithClassMembers)
94
+ end
95
+
96
+ it "should work without expectations" do
97
+ result = @dagger.attack @soldier
98
+ result.should == nil
99
+
100
+ @soldier.did_receive?(:survive_attack_with).with(@dagger).should be_successful
101
+ end
102
+
103
+ it "should work for expectations with an argument constraint" do
104
+ @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
105
+
106
+ @dagger.attack(@soldier).should == 5
107
+
108
+ @soldier.did_receive?(:survive_attack_with).with(:any).should be_successful
109
+ end
110
+
111
+ it "should work for an expctation on a class method without an argument constraint" do
112
+ @soldier.when_class_receives(:class_name).return(5)
113
+
114
+ @soldier.class.class_name.should == 5
115
+
116
+ @soldier.did_class_receive?(:class_name).should be_successful
117
+ end
118
+
119
+ it "should work for expectations with an argument constraint when a wrong argument is passed in" do
120
+ @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
121
+
122
+ @dagger.attack(Soldier.new).should == 8
123
+
124
+ @soldier.did_receive?(:survive_attack_with).with(@dagger).should_not be_successful
125
+ end
126
+
127
+ it "should work for expectations with an argument constraint and an assertion argument constraint" do
128
+ soldier = Soldier.new
129
+ @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
130
+
131
+ @dagger.attack(@soldier).should == 5
132
+
133
+ @soldier.did_receive?(:survive_attack_with).with(@dagger).should be_successful
134
+ end
135
+
136
+ it "should fail for expectations with an argument constraint and an assertion argument constraint" do
137
+ soldier = Soldier.new
138
+ @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
139
+
140
+ @dagger.attack(@soldier).should == 5
141
+
142
+ @soldier.did_receive?(:survive_attack_with).with(Dagger.new).should_not be_successful
143
+ end
144
+
145
+ it "should work with an expectation for any arguments" do
146
+ @soldier.when_receiving(:survive_attack_with).return(5)
147
+
148
+ result = @dagger.attack @soldier
149
+ result.should == 5
150
+
151
+ @soldier.did_receive?(:survive_attack_with).with(:any).should be_successful
152
+ end
153
+
154
+ it "should work with an assertion for specific arguments" do
155
+ @soldier.when_receiving(:survive_attack_with) do |method_should|
156
+ method_should.return(5)
157
+ end
158
+
159
+ result = @dagger.attack @soldier
160
+ result.should == 5
161
+
162
+ @soldier.did_receive?(:survive_attack_with).with(@dagger).should be_successful
163
+ end
164
+
165
+ it "should fail for an assertion with wrong arguments" do
166
+ @soldier.when_receiving(:survive_attack_with) do |method_should|
167
+ method_should.return(5)
168
+ end
169
+
170
+ result = @dagger.attack @soldier
171
+ result.should == 5
172
+
173
+ @soldier.
174
+ did_receive?(:survive_attack_with).
175
+ with(Caricature::Isolation.for(Dagger)).
176
+ should_not be_successful
177
+ end
178
+
179
+ end
180
+
181
+ describe "when isolating Ruby instances" do
182
+
183
+ before do
184
+ @dagger = Dagger.new
185
+ @soldier = Caricature::Isolation.for(Soldier.new)
186
+ end
187
+
188
+ it "should work without expectations" do
189
+ result = @dagger.attack @soldier
190
+ result.should == nil
191
+
192
+ @soldier.did_receive?(:survive_attack_with).with(@dagger).should be_successful
193
+ end
194
+
195
+ it "should work for expectations with an argument constraint" do
196
+ @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
197
+
198
+ @dagger.attack(@soldier).should == 5
199
+
200
+ @soldier.did_receive?(:survive_attack_with).with(:any).should be_successful
201
+ end
202
+
203
+ it "should work for expectations with an argument constraint when a wrong argument is passed in" do
204
+ @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
205
+
206
+ @dagger.attack(Soldier.new).should == 8
207
+
208
+ @soldier.did_receive?(:survive_attack_with).with(@dagger).should_not be_successful
209
+ end
210
+
211
+ it "should work for expectations with an argument constraint and an assertion argument constraint" do
212
+ soldier = Soldier.new
213
+ @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
214
+
215
+ @dagger.attack(@soldier).should == 5
216
+
217
+ @soldier.did_receive?(:survive_attack_with).with(@dagger).should be_successful
218
+ end
219
+
220
+ it "should fail for expectations with an argument constraint and an assertion argument constraint" do
221
+ soldier = Soldier.new
222
+ @soldier.when_receiving(:survive_attack_with).with(@dagger).return(5)
223
+
224
+ @dagger.attack(@soldier).should == 5
225
+
226
+ @soldier.did_receive?(:survive_attack_with).with(Dagger.new).should_not be_successful
227
+ end
228
+
229
+ it "should work with an expectation for any arguments" do
230
+ @soldier.when_receiving(:survive_attack_with).return(5)
231
+
232
+ result = @dagger.attack @soldier
233
+ result.should == 5
234
+
235
+ @soldier.did_receive?(:survive_attack_with).with(:any).should be_successful
236
+ end
237
+
238
+ it "should fail for an assertion for specific arguments" do
239
+ @soldier.when_receiving(:survive_attack_with) do |method_should|
240
+ method_should.return(5)
241
+ end
242
+
243
+ result = @dagger.attack @soldier
244
+ result.should == 5
245
+ var = @soldier.did_receive?(:survive_attack_with).with(:any)
246
+ # @soldier.did_receive?(:survive_attack_with).with(@dagger).should be_successful
247
+ @soldier.should have_received(:survive_attack_with).with(@dagger)
248
+ end
249
+
250
+ it "should allow to delegate the method call to the real instance (partial mock)" do
251
+ @soldier.when_receiving(:survive_attack_with).super_after
252
+
253
+ result = @dagger.attack @soldier
254
+ result.should == 8
255
+
256
+ @soldier.should have_received(:survive_attack_with)
257
+ end
258
+
259
+ it "should be able to isolate objects with constructor params" do
260
+ sheath = Caricature::Isolation.for(Sheath)
261
+ sheath.when_receiving(:insert).raise("Overridden")
262
+ lambda { sheath.insert(@dagger) }.should raise_error(RuntimeError, /Overridden/)
263
+ end
264
+
265
+ it "should be able to isolate objects with constructor params" do
266
+ sheath = Caricature::Isolation.for(Sheath)
267
+ lambda { sheath.insert(@dagger) }.should_not raise_error
268
+ end
269
+
270
+ end
271
+
272
272
  end
@@ -1,12 +1,12 @@
1
-
2
- require 'rubygems'
3
- # load the rspec library
4
- require 'spec' unless defined? Spec
5
-
6
- require File.dirname(__FILE__) + "/../spec_helper"
7
-
8
-
9
- Spec::Runner.configure do |config|
10
- config.mock_with Caricature::RSpecAdapter
11
- config.include Caricature::RSpecMatchers
12
- end
1
+
2
+ require 'rubygems'
3
+ # load the rspec library
4
+ require 'spec' unless defined? Spec
5
+
6
+ require File.dirname(__FILE__) + "/../spec_helper"
7
+
8
+
9
+ Spec::Runner.configure do |config|
10
+ config.mock_with Caricature::RSpecAdapter
11
+ config.include Caricature::RSpecMatchers
12
+ end