caricature 0.7.6 → 0.7.7

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 (39) hide show
  1. data/caricature.gemspec +3 -3
  2. data/lib/bin/Workarounds.dll.mdb +0 -0
  3. data/lib/caricature.rb +25 -25
  4. data/lib/caricature/clr.rb +6 -6
  5. data/lib/caricature/clr/aspnet_mvc.rb +54 -54
  6. data/lib/caricature/core_ext.rb +10 -10
  7. data/lib/caricature/core_ext/array.rb +9 -9
  8. data/lib/caricature/core_ext/class.rb +31 -14
  9. data/lib/caricature/core_ext/hash.rb +12 -12
  10. data/lib/caricature/core_ext/module.rb +14 -14
  11. data/lib/caricature/core_ext/object.rb +76 -18
  12. data/lib/caricature/core_ext/string.rb +16 -16
  13. data/lib/caricature/core_ext/system/string.rb +20 -20
  14. data/lib/caricature/core_ext/system/type.rb +26 -26
  15. data/lib/caricature/descriptor.rb +73 -73
  16. data/lib/caricature/expectation.rb +264 -263
  17. data/lib/caricature/isolation.rb +143 -143
  18. data/lib/caricature/isolator.rb +302 -302
  19. data/lib/caricature/messenger.rb +67 -67
  20. data/lib/caricature/method_call_recorder.rb +228 -228
  21. data/lib/caricature/verification.rb +60 -60
  22. data/lib/caricature/version.rb +1 -1
  23. data/spec/bacon/integration/clr_to_clr_spec.rb +4 -4
  24. data/spec/bacon/integration/clr_to_ruby_spec.rb +227 -227
  25. data/spec/bacon/integration/event_spec.rb +2 -2
  26. data/spec/bacon/integration/ruby_to_ruby_spec.rb +270 -270
  27. data/spec/bacon/integration/syntax_spec.rb +43 -0
  28. data/spec/bacon/unit/core_ext_spec.rb +87 -87
  29. data/spec/bacon/unit/expectation_spec.rb +300 -300
  30. data/spec/bacon/unit/interop_spec.rb +29 -29
  31. data/spec/bacon/unit/isolation_spec.rb +86 -86
  32. data/spec/bacon/unit/isolator_spec.rb +219 -219
  33. data/spec/bacon/unit/messaging_spec.rb +310 -310
  34. data/spec/bacon/unit/method_call_spec.rb +342 -342
  35. data/spec/bin/ClrModels.dll.mdb +0 -0
  36. data/spec/rspec/unit/event_spec.rb +1 -1
  37. metadata +31 -11
  38. data/spec/models.notused/ClrModels.cs +0 -241
  39. data/spec/models.notused/ruby_models.rb +0 -151
@@ -1,61 +1,61 @@
1
- module Caricature
2
-
3
- # Describes a verification of a method call.
4
- # This corresponds kind of to an assertion
5
- class Verification
6
-
7
- # Initializes a new instance of a +Verification+
8
- def initialize(method_name, recorder, mode=:instance)
9
- @method_name, @args, @any_args, @recorder, @mode, @block_args = method_name, [], true, recorder, mode, nil
10
- init_plugin
11
- end
12
-
13
- def init_plugin
14
-
15
- end
16
-
17
- # indicates whether this verification can be for any arguments
18
- def any_args?
19
- @any_args
20
- end
21
-
22
- # constrain this verification to the provided arguments
23
- def with(*args)
24
- @any_args = args.first.is_a?(Symbol) and args.first == :any
25
- @args = args
26
- # @callback = b if b
27
- self
28
- end
29
-
30
- def with_block_args(*args)
31
- @block_args = args
32
- end
33
-
34
- # allow any arguments ignore the argument constraint
35
- def allow_any_arguments
36
- @any_args = true
37
- self
38
- end
39
-
40
- # figure out if this argument variation matches the provided args.
41
- def matches?(method_name, *args)
42
- @method_name == method_name and any_args? or @args == args
43
- end
44
-
45
- def error
46
- @recorder.error
47
- end
48
-
49
- # indicate that this method verification is successful
50
- def successful?
51
- a = any_args? ? [:any] : @args
52
- begin
53
- @recorder.was_called?(@method_name, @block_args, @mode, *a)
54
- rescue ArgumentError
55
- false
56
- end
57
- end
58
-
59
- end
60
-
1
+ module Caricature
2
+
3
+ # Describes a verification of a method call.
4
+ # This corresponds kind of to an assertion
5
+ class Verification
6
+
7
+ # Initializes a new instance of a +Verification+
8
+ def initialize(method_name, recorder, mode=:instance)
9
+ @method_name, @args, @any_args, @recorder, @mode, @block_args = method_name, [], true, recorder, mode, nil
10
+ init_plugin
11
+ end
12
+
13
+ def init_plugin
14
+
15
+ end
16
+
17
+ # indicates whether this verification can be for any arguments
18
+ def any_args?
19
+ @any_args
20
+ end
21
+
22
+ # constrain this verification to the provided arguments
23
+ def with(*args)
24
+ @any_args = args.first.is_a?(Symbol) and args.first == :any
25
+ @args = args
26
+ # @callback = b if b
27
+ self
28
+ end
29
+
30
+ def with_block_args(*args)
31
+ @block_args = args
32
+ end
33
+
34
+ # allow any arguments ignore the argument constraint
35
+ def allow_any_arguments
36
+ @any_args = true
37
+ self
38
+ end
39
+
40
+ # figure out if this argument variation matches the provided args.
41
+ def matches?(method_name, *args)
42
+ @method_name == method_name and any_args? or @args == args
43
+ end
44
+
45
+ def error
46
+ @recorder.error
47
+ end
48
+
49
+ # indicate that this method verification is successful
50
+ def successful?
51
+ a = any_args? ? [:any] : @args
52
+ begin
53
+ @recorder.was_called?(@method_name, @block_args, @mode, *a)
54
+ rescue ArgumentError
55
+ false
56
+ end
57
+ end
58
+
59
+ end
60
+
61
61
  end
@@ -1,6 +1,6 @@
1
1
  module Caricature
2
2
 
3
3
  # The version number of the +Caricature+ library
4
- VERSION = '0.7.6'
4
+ VERSION = '0.7.7'
5
5
 
6
6
  end
@@ -70,7 +70,7 @@ describe "CLR to CLR interactions" do
70
70
 
71
71
  before do
72
72
  @ninja = ClrModels::Ninja.new
73
- @weapon = isolate ClrModels::IWeapon
73
+ @weapon = isolation_for ClrModels::IWeapon
74
74
  end
75
75
 
76
76
 
@@ -81,7 +81,7 @@ describe "CLR to CLR interactions" do
81
81
  describe "when isolating CLR interfaces" do
82
82
  before do
83
83
  @ninja = ClrModels::Ninja.new
84
- @weapon = isolate ClrModels::IWeapon
84
+ @weapon = isolation_for ClrModels::IWeapon
85
85
  end
86
86
 
87
87
  it "should work without expectations" do
@@ -151,7 +151,7 @@ describe "CLR to CLR interactions" do
151
151
  describe "plain vanilla CLR classes" do
152
152
  before do
153
153
  @weapon = ClrModels::Sword.new
154
- @ninja = isolate ClrModels::Ninja
154
+ @ninja = isolation_for ClrModels::Ninja
155
155
  end
156
156
 
157
157
  it "should work without expectations" do
@@ -223,7 +223,7 @@ describe "CLR to CLR interactions" do
223
223
  result = @weapon.attack @ninja
224
224
  result.should.equal 5
225
225
 
226
- @ninja.should.not.have_received?(:survive_attack_with) {|v| v.with(isolate(ClrModels::IWeapon)) }
226
+ @ninja.should.not.have_received?(:survive_attack_with) {|v| v.with(isolation_for(ClrModels::IWeapon)) }
227
227
  end
228
228
 
229
229
  end
@@ -1,228 +1,228 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
2
-
3
- describe "CLR isolations for ruby objects" do
4
-
5
- describe "when isolating CLR interfaces" do
6
- before do
7
- @soldier = Soldier.new
8
- @weapon = Caricature::Isolation.for(ClrModels::IWeapon)
9
- end
10
-
11
- it "should work without expectations" do
12
- @soldier.attack Soldier.new, @weapon
13
-
14
- @weapon.did_receive?(:attack).should.be.successful
15
- end
16
-
17
- it "should work for expectations with an argument constraint" do
18
- soldier = Soldier.new
19
- @weapon.when_receiving(:attack).with(soldier).return(5)
20
-
21
- @soldier.attack(soldier, @weapon).should.equal 5
22
-
23
- @weapon.did_receive?(:attack).with(:any).should.be.successful
24
- end
25
-
26
- it "should work for expectations with an argument constraint when a wrong argument is passed in" do
27
- @weapon.when_receiving(:attack).with(Soldier.new).return(5)
28
-
29
- @soldier.attack(Soldier.new, @weapon).should.equal 0
30
- end
31
-
32
- it "should work for expectations with an argument constraint and an assertion argument constraint" do
33
- soldier = Soldier.new
34
- @weapon.when_receiving(:attack).with(soldier).return(5)
35
-
36
- @soldier.attack(soldier, @weapon).should.equal 5
37
-
38
- @weapon.did_receive?(:attack).with(soldier).should.be.successful
39
- end
40
-
41
- it "should fail for expectations with an argument constraint and an assertion argument constraint" do
42
- soldier = Soldier.new
43
- @weapon.when_receiving(:attack).with(soldier).return(5)
44
-
45
- @soldier.attack(soldier, @weapon).should.equal 5
46
-
47
- @weapon.did_receive?(:attack).with(Soldier.new).should.not.be.successful
48
- end
49
-
50
- it "should work with an expectation with any arguments" do
51
- @weapon.when_receiving(:damage).return(5)
52
-
53
- @soldier.is_killed_by?(@weapon).should.be.true?
54
- @weapon.did_receive?(:damage).should.be.successful
55
- end
56
-
57
- it "should work with an expectation getting different method call result" do
58
- @weapon.when_receiving(:damage).return(2)
59
-
60
- @soldier.is_killed_by?(@weapon).should.be.false?
61
- @weapon.did_receive?(:damage).should.be.successful
62
- end
63
-
64
- it "should work for an assertion on a specific argument" do
65
- @weapon.when_receiving(:damage).return(2)
66
-
67
- @soldier.is_killed_by?(@weapon).should.be.false?
68
- @weapon.did_receive?(:damage).should.be.successful
69
- end
70
-
71
- end
72
-
73
- describe "when isolating CLR classes" do
74
-
75
- before do
76
- @weapon = Dagger.new
77
- @ninja = Caricature::Isolation.for(ClrModels::Ninja)
78
- end
79
-
80
- it "should work without expectations" do
81
- result = @weapon.attack @ninja
82
- result.should.equal 0
83
-
84
- @ninja.did_receive?(:survive_attack_with).with(@weapon).should.be.successful
85
- end
86
-
87
- it "should work for expectations with an argument constraint" do
88
- @ninja.when_receiving(:survive_attack_with).with(@weapon).return(5)
89
-
90
- @weapon.attack(@ninja).should.equal 5
91
-
92
- @ninja.did_receive?(:survive_attack_with).with(:any).should.be.successful
93
- end
94
-
95
- it "should work for expectations with an argument constraint when a wrong argument is passed in" do
96
- @ninja.when_receiving(:survive_attack_with).with(@weapon).return(5)
97
-
98
- @weapon.attack(Soldier.new).should.equal 8
99
-
100
- @ninja.did_receive?(:survive_attack_with).with(@weapon).should.not.be.successful
101
- end
102
-
103
- it "should work for expectations with an argument constraint and an assertion argument constraint" do
104
- ninja = ClrModels::Ninja.new
105
- @ninja.when_receiving(:survive_attack_with).with(@weapon).return(5)
106
-
107
- @weapon.attack(@ninja).should.equal 5
108
-
109
- @ninja.did_receive?(:survive_attack_with).with(@weapon).should.be.successful
110
- end
111
-
112
- it "should fail for expectations with an argument constraint and an assertion argument constraint" do
113
- ninja = ClrModels::Ninja.new
114
- @ninja.when_receiving(:survive_attack_with).with(@weapon).return(5)
115
-
116
- @weapon.attack(@ninja).should.equal 5
117
-
118
- @ninja.did_receive?(:survive_attack_with).with(Dagger.new).should.not.be.successful
119
- end
120
-
121
- it "should work with an expectation for any arguments" do
122
- @ninja.when_receiving(:survive_attack_with).return(5)
123
-
124
- result = @weapon.attack @ninja
125
- result.should.equal 5
126
-
127
- @ninja.did_receive?(:survive_attack_with).with(:any).should.be.successful
128
- end
129
-
130
- it "should work with an assertion for specific arguments" do
131
- @ninja.when_receiving(:survive_attack_with) do |method_should|
132
- method_should.return(5)
133
- end
134
-
135
- result = @weapon.attack @ninja
136
- result.should.equal 5
137
-
138
- @ninja.did_receive?(:survive_attack_with).with(@weapon).should.be.successful
139
- end
140
-
141
- it "should fail for an assertion with wrong arguments" do
142
- @ninja.when_receiving(:survive_attack_with) do |method_should|
143
- method_should.return(5)
144
- end
145
-
146
- result = @weapon.attack @ninja
147
- result.should.equal 5
148
-
149
- @ninja.
150
- did_receive?(:survive_attack_with).
151
- with(Caricature::Isolation.for(ClrModels::IWeapon)).
152
- should.not.be.successful
153
- end
154
-
155
- end
156
-
157
- describe "when isolating CLR instances" do
158
-
159
- before do
160
- @weapon = Dagger.new
161
- @ninja = Caricature::Isolation.for(ClrModels::Ninja.new)
162
- end
163
-
164
- it "should work without expectations" do
165
- result = @weapon.attack @ninja
166
- result.should.equal 0
167
-
168
- @ninja.did_receive?(:survive_attack_with).with(@weapon).should.be.successful
169
- end
170
-
171
- it "should work for expectations with an argument constraint" do
172
- @ninja.when_receiving(:survive_attack_with).with(@weapon).return(5)
173
-
174
- @weapon.attack(@ninja).should.equal 5
175
-
176
- @ninja.did_receive?(:survive_attack_with).with(:any).should.be.successful
177
- end
178
-
179
- it "should work for expectations with an argument constraint when a wrong argument is passed in" do
180
- @ninja.when_receiving(:survive_attack_with).with(@weapon).return(5)
181
-
182
- @weapon.attack(Soldier.new).should.equal 8
183
-
184
- @ninja.did_receive?(:survive_attack_with).with(@weapon).should.not.be.successful
185
- end
186
-
187
- it "should work for expectations with an argument constraint and an assertion argument constraint" do
188
- ninja = ClrModels::Ninja.new
189
- @ninja.when_receiving(:survive_attack_with).with(@weapon).return(5)
190
-
191
- @weapon.attack(@ninja).should.equal 5
192
-
193
- @ninja.did_receive?(:survive_attack_with).with(@weapon).should.be.successful
194
- end
195
-
196
- it "should fail for expectations with an argument constraint and an assertion argument constraint" do
197
- ninja = ClrModels::Ninja.new
198
- @ninja.when_receiving(:survive_attack_with).with(@weapon).return(5)
199
-
200
- @weapon.attack(@ninja).should.equal 5
201
-
202
- @ninja.did_receive?(:survive_attack_with).with(Dagger.new).should.not.be.successful
203
- end
204
-
205
- it "should work with an expectation for any arguments" do
206
- @ninja.when_receiving(:survive_attack_with).return(5)
207
-
208
- result = @weapon.attack @ninja
209
- result.should.equal 5
210
-
211
- @ninja.did_receive?(:survive_attack_with).with(:any).should.be.successful
212
- end
213
-
214
- it "should fail for an assertion for specific arguments" do
215
- @ninja.when_receiving(:survive_attack_with) do |method_should|
216
- method_should.return(5)
217
- end
218
-
219
- result = @weapon.attack @ninja
220
- result.should.equal 5
221
- var = @ninja.did_receive?(:survive_attack_with).with(:any)
222
- @ninja.did_receive?(:survive_attack_with).with(@weapon).should.be.successful
223
- end
224
-
225
-
226
- end
227
-
1
+ require File.dirname(__FILE__) + "/../spec_helper"
2
+
3
+ describe "CLR isolations for ruby objects" do
4
+
5
+ describe "when isolating CLR interfaces" do
6
+ before do
7
+ @soldier = Soldier.new
8
+ @weapon = Caricature::Isolation.for(ClrModels::IWeapon)
9
+ end
10
+
11
+ it "should work without expectations" do
12
+ @soldier.attack Soldier.new, @weapon
13
+
14
+ @weapon.did_receive?(:attack).should.be.successful
15
+ end
16
+
17
+ it "should work for expectations with an argument constraint" do
18
+ soldier = Soldier.new
19
+ @weapon.when_receiving(:attack).with(soldier).return(5)
20
+
21
+ @soldier.attack(soldier, @weapon).should.equal 5
22
+
23
+ @weapon.did_receive?(:attack).with(:any).should.be.successful
24
+ end
25
+
26
+ it "should work for expectations with an argument constraint when a wrong argument is passed in" do
27
+ @weapon.when_receiving(:attack).with(Soldier.new).return(5)
28
+
29
+ @soldier.attack(Soldier.new, @weapon).should.equal 0
30
+ end
31
+
32
+ it "should work for expectations with an argument constraint and an assertion argument constraint" do
33
+ soldier = Soldier.new
34
+ @weapon.when_receiving(:attack).with(soldier).return(5)
35
+
36
+ @soldier.attack(soldier, @weapon).should.equal 5
37
+
38
+ @weapon.did_receive?(:attack).with(soldier).should.be.successful
39
+ end
40
+
41
+ it "should fail for expectations with an argument constraint and an assertion argument constraint" do
42
+ soldier = Soldier.new
43
+ @weapon.when_receiving(:attack).with(soldier).return(5)
44
+
45
+ @soldier.attack(soldier, @weapon).should.equal 5
46
+
47
+ @weapon.did_receive?(:attack).with(Soldier.new).should.not.be.successful
48
+ end
49
+
50
+ it "should work with an expectation with any arguments" do
51
+ @weapon.when_receiving(:damage).return(5)
52
+
53
+ @soldier.is_killed_by?(@weapon).should.be.true?
54
+ @weapon.did_receive?(:damage).should.be.successful
55
+ end
56
+
57
+ it "should work with an expectation getting different method call result" do
58
+ @weapon.when_receiving(:damage).return(2)
59
+
60
+ @soldier.is_killed_by?(@weapon).should.be.false?
61
+ @weapon.did_receive?(:damage).should.be.successful
62
+ end
63
+
64
+ it "should work for an assertion on a specific argument" do
65
+ @weapon.when_receiving(:damage).return(2)
66
+
67
+ @soldier.is_killed_by?(@weapon).should.be.false?
68
+ @weapon.did_receive?(:damage).should.be.successful
69
+ end
70
+
71
+ end
72
+
73
+ describe "when isolating CLR classes" do
74
+
75
+ before do
76
+ @weapon = Dagger.new
77
+ @ninja = Caricature::Isolation.for(ClrModels::Ninja)
78
+ end
79
+
80
+ it "should work without expectations" do
81
+ result = @weapon.attack @ninja
82
+ result.should.equal 0
83
+
84
+ @ninja.did_receive?(:survive_attack_with).with(@weapon).should.be.successful
85
+ end
86
+
87
+ it "should work for expectations with an argument constraint" do
88
+ @ninja.when_receiving(:survive_attack_with).with(@weapon).return(5)
89
+
90
+ @weapon.attack(@ninja).should.equal 5
91
+
92
+ @ninja.did_receive?(:survive_attack_with).with(:any).should.be.successful
93
+ end
94
+
95
+ it "should work for expectations with an argument constraint when a wrong argument is passed in" do
96
+ @ninja.when_receiving(:survive_attack_with).with(@weapon).return(5)
97
+
98
+ @weapon.attack(Soldier.new).should.equal 8
99
+
100
+ @ninja.did_receive?(:survive_attack_with).with(@weapon).should.not.be.successful
101
+ end
102
+
103
+ it "should work for expectations with an argument constraint and an assertion argument constraint" do
104
+ ninja = ClrModels::Ninja.new
105
+ @ninja.when_receiving(:survive_attack_with).with(@weapon).return(5)
106
+
107
+ @weapon.attack(@ninja).should.equal 5
108
+
109
+ @ninja.did_receive?(:survive_attack_with).with(@weapon).should.be.successful
110
+ end
111
+
112
+ it "should fail for expectations with an argument constraint and an assertion argument constraint" do
113
+ ninja = ClrModels::Ninja.new
114
+ @ninja.when_receiving(:survive_attack_with).with(@weapon).return(5)
115
+
116
+ @weapon.attack(@ninja).should.equal 5
117
+
118
+ @ninja.did_receive?(:survive_attack_with).with(Dagger.new).should.not.be.successful
119
+ end
120
+
121
+ it "should work with an expectation for any arguments" do
122
+ @ninja.when_receiving(:survive_attack_with).return(5)
123
+
124
+ result = @weapon.attack @ninja
125
+ result.should.equal 5
126
+
127
+ @ninja.did_receive?(:survive_attack_with).with(:any).should.be.successful
128
+ end
129
+
130
+ it "should work with an assertion for specific arguments" do
131
+ @ninja.when_receiving(:survive_attack_with) do |method_should|
132
+ method_should.return(5)
133
+ end
134
+
135
+ result = @weapon.attack @ninja
136
+ result.should.equal 5
137
+
138
+ @ninja.did_receive?(:survive_attack_with).with(@weapon).should.be.successful
139
+ end
140
+
141
+ it "should fail for an assertion with wrong arguments" do
142
+ @ninja.when_receiving(:survive_attack_with) do |method_should|
143
+ method_should.return(5)
144
+ end
145
+
146
+ result = @weapon.attack @ninja
147
+ result.should.equal 5
148
+
149
+ @ninja.
150
+ did_receive?(:survive_attack_with).
151
+ with(Caricature::Isolation.for(ClrModels::IWeapon)).
152
+ should.not.be.successful
153
+ end
154
+
155
+ end
156
+
157
+ describe "when isolating CLR instances" do
158
+
159
+ before do
160
+ @weapon = Dagger.new
161
+ @ninja = Caricature::Isolation.for(ClrModels::Ninja.new)
162
+ end
163
+
164
+ it "should work without expectations" do
165
+ result = @weapon.attack @ninja
166
+ result.should.equal 0
167
+
168
+ @ninja.did_receive?(:survive_attack_with).with(@weapon).should.be.successful
169
+ end
170
+
171
+ it "should work for expectations with an argument constraint" do
172
+ @ninja.when_receiving(:survive_attack_with).with(@weapon).return(5)
173
+
174
+ @weapon.attack(@ninja).should.equal 5
175
+
176
+ @ninja.did_receive?(:survive_attack_with).with(:any).should.be.successful
177
+ end
178
+
179
+ it "should work for expectations with an argument constraint when a wrong argument is passed in" do
180
+ @ninja.when_receiving(:survive_attack_with).with(@weapon).return(5)
181
+
182
+ @weapon.attack(Soldier.new).should.equal 8
183
+
184
+ @ninja.did_receive?(:survive_attack_with).with(@weapon).should.not.be.successful
185
+ end
186
+
187
+ it "should work for expectations with an argument constraint and an assertion argument constraint" do
188
+ ninja = ClrModels::Ninja.new
189
+ @ninja.when_receiving(:survive_attack_with).with(@weapon).return(5)
190
+
191
+ @weapon.attack(@ninja).should.equal 5
192
+
193
+ @ninja.did_receive?(:survive_attack_with).with(@weapon).should.be.successful
194
+ end
195
+
196
+ it "should fail for expectations with an argument constraint and an assertion argument constraint" do
197
+ ninja = ClrModels::Ninja.new
198
+ @ninja.when_receiving(:survive_attack_with).with(@weapon).return(5)
199
+
200
+ @weapon.attack(@ninja).should.equal 5
201
+
202
+ @ninja.did_receive?(:survive_attack_with).with(Dagger.new).should.not.be.successful
203
+ end
204
+
205
+ it "should work with an expectation for any arguments" do
206
+ @ninja.when_receiving(:survive_attack_with).return(5)
207
+
208
+ result = @weapon.attack @ninja
209
+ result.should.equal 5
210
+
211
+ @ninja.did_receive?(:survive_attack_with).with(:any).should.be.successful
212
+ end
213
+
214
+ it "should fail for an assertion for specific arguments" do
215
+ @ninja.when_receiving(:survive_attack_with) do |method_should|
216
+ method_should.return(5)
217
+ end
218
+
219
+ result = @weapon.attack @ninja
220
+ result.should.equal 5
221
+ var = @ninja.did_receive?(:survive_attack_with).with(:any)
222
+ @ninja.did_receive?(:survive_attack_with).with(@weapon).should.be.successful
223
+ end
224
+
225
+
226
+ end
227
+
228
228
  end