caricature 0.6.3 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +98 -0
- data/Rakefile +250 -47
- data/caricature.gemspec +79 -190
- data/lib/caricature/clr/descriptor.rb +14 -4
- data/lib/caricature/clr/isolation.rb +9 -0
- data/lib/caricature/clr/isolator.rb +4 -0
- data/lib/caricature/clr/messenger.rb +12 -17
- data/lib/caricature/clr.rb +1 -1
- data/lib/caricature/descriptor.rb +1 -1
- data/lib/caricature/expectation.rb +21 -11
- data/lib/caricature/isolation.rb +9 -3
- data/lib/caricature/isolator.rb +25 -9
- data/lib/caricature/messenger.rb +1 -1
- data/lib/caricature/verification.rb +2 -1
- data/lib/caricature/version.rb +6 -0
- data/lib/caricature.rb +8 -5
- data/spec/bacon_helper.rb +50 -30
- data/spec/bin/ClrModels.dll +0 -0
- data/spec/bin/ClrModels.dll.mdb +0 -0
- data/spec/integration/callback_spec.rb +157 -0
- data/spec/integration/ruby_to_ruby_spec.rb +12 -1
- data/spec/models/ClrModels.cs +8 -8
- data/spec/unit/expectation_spec.rb +35 -0
- metadata +35 -125
- data/.gitignore +0 -4
- data/README.markdown +0 -80
- data/VERSION +0 -1
- data/doc/Array.html +0 -251
- data/doc/Caricature/ArgumentRecording.html +0 -366
- data/doc/Caricature/ClrClassDescriptor.html +0 -303
- data/doc/Caricature/ClrClassMessenger.html +0 -263
- data/doc/Caricature/ClrInterfaceDescriptor.html +0 -295
- data/doc/Caricature/ClrInterfaceIsolator.html +0 -365
- data/doc/Caricature/ClrInterfaceMessenger.html +0 -260
- data/doc/Caricature/ClrIsolator.html +0 -425
- data/doc/Caricature/Expectation.html +0 -549
- data/doc/Caricature/ExpectationBuilder.html +0 -308
- data/doc/Caricature/ExpectationSyntax.html +0 -466
- data/doc/Caricature/Expectations.html +0 -347
- data/doc/Caricature/Interception/ClassMethods.html +0 -364
- data/doc/Caricature/Interception.html +0 -534
- data/doc/Caricature/Isolation.html +0 -763
- data/doc/Caricature/Isolator.html +0 -519
- data/doc/Caricature/MemberDescriptor.html +0 -335
- data/doc/Caricature/Messenger.html +0 -413
- data/doc/Caricature/MethodCallRecorder.html +0 -404
- data/doc/Caricature/MethodCallRecording.html +0 -493
- data/doc/Caricature/RubyIsolator.html +0 -416
- data/doc/Caricature/RubyMessenger.html +0 -261
- data/doc/Caricature/RubyObjectDescriptor.html +0 -289
- data/doc/Caricature/TypeDescriptor.html +0 -378
- data/doc/Caricature/Verification.html +0 -443
- data/doc/Caricature.html +0 -358
- data/doc/Class.html +0 -287
- data/doc/Hash.html +0 -255
- data/doc/Module.html +0 -287
- data/doc/Object.html +0 -409
- data/doc/README_markdown.html +0 -241
- data/doc/String.html +0 -369
- data/doc/System/String.html +0 -289
- data/doc/System/Type.html +0 -289
- data/doc/System.html +0 -207
- data/doc/created.rid +0 -1
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +0 -342
- data/doc/js/darkfish.js +0 -116
- data/doc/js/jquery.js +0 -32
- data/doc/js/quicksearch.js +0 -114
- data/doc/js/thickbox-compressed.js +0 -10
- data/doc/lib/caricature/clr/aspnet_mvc_rb.html +0 -52
- data/doc/lib/caricature/clr/descriptor_rb.html +0 -52
- data/doc/lib/caricature/clr/isolation_rb.html +0 -52
- data/doc/lib/caricature/clr/isolator_rb.html +0 -52
- data/doc/lib/caricature/clr/messenger_rb.html +0 -52
- data/doc/lib/caricature/clr_rb.html +0 -52
- data/doc/lib/caricature/descriptor_rb.html +0 -52
- data/doc/lib/caricature/expectation_rb.html +0 -52
- data/doc/lib/caricature/isolation_rb.html +0 -52
- data/doc/lib/caricature/isolator_rb.html +0 -52
- data/doc/lib/caricature/messaging_rb.html +0 -52
- data/doc/lib/caricature/messenger_rb.html +0 -52
- data/doc/lib/caricature/method_call_recorder_rb.html +0 -52
- data/doc/lib/caricature/verification_rb.html +0 -52
- data/doc/lib/caricature_rb.html +0 -52
- data/doc/lib/core_ext/array_rb.html +0 -52
- data/doc/lib/core_ext/class_rb.html +0 -52
- data/doc/lib/core_ext/core_ext_rb.html +0 -52
- data/doc/lib/core_ext/hash_rb.html +0 -52
- data/doc/lib/core_ext/module_rb.html +0 -52
- data/doc/lib/core_ext/object_rb.html +0 -52
- data/doc/lib/core_ext/string_rb.html +0 -52
- data/doc/lib/core_ext/system/string_rb.html +0 -52
- data/doc/lib/core_ext/system/type_rb.html +0 -52
- data/doc/rdoc.css +0 -696
- data/irb_init.rb +0 -9
- data/lib/bin/Workarounds.dll +0 -0
- data/lib/bin/Workarounds.pdb +0 -0
- data/pkg/.gitignore +0 -0
- data/pkg/caricature-0.1.0.gem +0 -0
- data/pkg/caricature-0.5.0.gem +0 -0
- data/pkg/caricature-0.6.0.gem +0 -0
- data/spec/bin/.gitignore +0 -0
- data/workarounds/ReflectionHelper.cs +0 -30
data/spec/bacon_helper.rb
CHANGED
@@ -7,16 +7,13 @@ $: << File.dirname(__FILE__) + "/../lib"
|
|
7
7
|
|
8
8
|
# load the caricature library
|
9
9
|
require "caricature"
|
10
|
-
require 'caricature/clr'
|
11
10
|
|
11
|
+
require 'rubygems'
|
12
12
|
# load the bacon library
|
13
13
|
require 'bacon'
|
14
14
|
|
15
|
-
# Add the .NET framework
|
16
|
-
require 'mscorlib'
|
17
|
-
|
18
15
|
# load the assembly with the C# code
|
19
|
-
|
16
|
+
require 'ClrModels.dll' if defined? IRONRUBY_VERSION
|
20
17
|
|
21
18
|
class Soldier
|
22
19
|
|
@@ -105,44 +102,67 @@ class WithClassMethods
|
|
105
102
|
"Goodbye world!"
|
106
103
|
end
|
107
104
|
|
105
|
+
end
|
106
|
+
|
107
|
+
class Sheath
|
108
|
+
attr_reader :dagger
|
109
|
+
|
110
|
+
def initialize(dagger)
|
111
|
+
@dagger = dagger
|
112
|
+
end
|
113
|
+
|
114
|
+
def insert(dagger)
|
115
|
+
raise "There is already a dagger in here" if @dagger
|
116
|
+
@dagger = dagger
|
117
|
+
end
|
118
|
+
|
119
|
+
def draw
|
120
|
+
raise "Dagger is nowhere to be found" unless @dagger
|
121
|
+
d = @dagger
|
122
|
+
@dagger = nil
|
123
|
+
d
|
124
|
+
end
|
108
125
|
end
|
109
126
|
|
110
|
-
|
127
|
+
if defined? IRONRUBY_VERSION
|
111
128
|
|
112
|
-
module
|
113
|
-
include ClrModels::IWarrior
|
114
|
-
end
|
129
|
+
module Caricature
|
115
130
|
|
116
|
-
|
131
|
+
module InterfaceIncludingModule
|
132
|
+
include ClrModels::IWarrior
|
133
|
+
end
|
134
|
+
|
135
|
+
module PureRubyModule
|
117
136
|
|
118
|
-
|
137
|
+
end
|
119
138
|
|
120
|
-
|
121
|
-
|
122
|
-
|
139
|
+
module RubyModuleIncludingModule
|
140
|
+
include PureRubyModule
|
141
|
+
end
|
123
142
|
|
124
|
-
|
125
|
-
|
126
|
-
|
143
|
+
module InterfaceUpTheWazoo
|
144
|
+
include InterfaceIncludingModule
|
145
|
+
end
|
127
146
|
|
128
|
-
|
129
|
-
|
130
|
-
|
147
|
+
class InterfaceIncludingClass
|
148
|
+
include ClrModels::IWarrior
|
149
|
+
end
|
131
150
|
|
132
|
-
|
151
|
+
class SubClassingClrClass < ClrModels::Ninja
|
133
152
|
|
134
|
-
|
153
|
+
end
|
135
154
|
|
136
|
-
|
137
|
-
|
138
|
-
|
155
|
+
class InterfaceUpTheWazooClass
|
156
|
+
include InterfaceUpTheWazoo
|
157
|
+
end
|
139
158
|
|
140
|
-
|
159
|
+
class SubclassingRubyClass < Soldier
|
141
160
|
|
142
|
-
|
161
|
+
end
|
143
162
|
|
144
|
-
|
145
|
-
|
163
|
+
class ModuleIncludingClass
|
164
|
+
include RubyModuleIncludingModule
|
165
|
+
end
|
146
166
|
end
|
147
|
-
end
|
148
167
|
|
168
|
+
end
|
Binary file
|
Binary file
|
@@ -0,0 +1,157 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/../bacon_helper"
|
2
|
+
|
3
|
+
describe "Callbacks on expectations" do
|
4
|
+
|
5
|
+
describe "CLR to CLR interactions" do
|
6
|
+
|
7
|
+
describe "when isolating CLR interfaces" do
|
8
|
+
|
9
|
+
before do
|
10
|
+
@ninja = ClrModels::Ninja.new
|
11
|
+
@weapon = Caricature::Isolation.for(ClrModels::IWeapon)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should execute the callback when the expectation is invoked" do
|
15
|
+
ninja = ClrModels::Ninja.new
|
16
|
+
cnt = 0
|
17
|
+
@weapon.when_receiving(:attack).with(:any) do |*args|
|
18
|
+
cnt += 1
|
19
|
+
end
|
20
|
+
@ninja.attack ninja, @weapon
|
21
|
+
|
22
|
+
cnt.should == 1
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "when isolating CLR classes" do
|
28
|
+
|
29
|
+
before do
|
30
|
+
@ninja = ClrModels::Ninja.new
|
31
|
+
@weapon = Caricature::Isolation.for(ClrModels::Sword)
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should execute the callback when the expectation is invoked" do
|
35
|
+
ninja = ClrModels::Ninja.new
|
36
|
+
cnt = 0
|
37
|
+
@weapon.when_receiving(:attack).with(:any) do |*args|
|
38
|
+
cnt += 1
|
39
|
+
end
|
40
|
+
@ninja.attack ninja, @weapon
|
41
|
+
|
42
|
+
cnt.should == 1
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
describe "when isolating CLR instances" do
|
48
|
+
before do
|
49
|
+
@ninja = ClrModels::Ninja.new
|
50
|
+
@weapon = Caricature::Isolation.for(ClrModels::Sword.new)
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should execute the callback when the expectation is invoked" do
|
54
|
+
ninja = ClrModels::Ninja.new
|
55
|
+
cnt = 0
|
56
|
+
@weapon.when_receiving(:attack).with(ninja) do |*args|
|
57
|
+
cnt += 1
|
58
|
+
end
|
59
|
+
@ninja.attack ninja, @weapon
|
60
|
+
|
61
|
+
cnt.should == 1
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
describe "CLR to ruby interactions" do
|
68
|
+
|
69
|
+
describe "when isolating CLR interfaces" do
|
70
|
+
|
71
|
+
before do
|
72
|
+
@ninja = Soldier.new
|
73
|
+
@weapon = Caricature::Isolation.for(ClrModels::IWeapon)
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should execute the callback when the expectation is invoked" do
|
77
|
+
ninja = Soldier.new
|
78
|
+
cnt = 0
|
79
|
+
@weapon.when_receiving(:attack).with(:any) do |*args|
|
80
|
+
cnt += 1
|
81
|
+
end
|
82
|
+
@ninja.attack ninja, @weapon
|
83
|
+
|
84
|
+
cnt.should == 1
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
describe "when isolating CLR classes" do
|
90
|
+
|
91
|
+
before do
|
92
|
+
@ninja = Soldier.new
|
93
|
+
@weapon = Caricature::Isolation.for(ClrModels::Sword)
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should execute the callback when the expectation is invoked" do
|
97
|
+
ninja = Soldier.new
|
98
|
+
cnt = 0
|
99
|
+
@weapon.when_receiving(:attack).with(:any) do |*args|
|
100
|
+
cnt += 1
|
101
|
+
end
|
102
|
+
@ninja.attack ninja, @weapon
|
103
|
+
|
104
|
+
cnt.should == 1
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
108
|
+
|
109
|
+
describe "when isolating CLR instances" do
|
110
|
+
before do
|
111
|
+
@ninja = Soldier.new
|
112
|
+
@weapon = Caricature::Isolation.for(ClrModels::Sword.new)
|
113
|
+
end
|
114
|
+
|
115
|
+
it "should execute the callback when the expectation is invoked" do
|
116
|
+
ninja = Soldier.new
|
117
|
+
cnt = 0
|
118
|
+
@weapon.when_receiving(:attack).with(ninja) do |*args|
|
119
|
+
cnt += 1
|
120
|
+
end
|
121
|
+
@ninja.attack ninja, @weapon
|
122
|
+
|
123
|
+
cnt.should == 1
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
|
128
|
+
end
|
129
|
+
|
130
|
+
describe "Ruby to Ruby interactions" do
|
131
|
+
|
132
|
+
it "should execute a callback when an expectation is being invoked and with is not defined in a block" do
|
133
|
+
iso = Caricature::Isolation.for(Dagger)
|
134
|
+
cnt = 0
|
135
|
+
iso.when_receiving(:damage).with(:any) do |*args|
|
136
|
+
cnt += 1
|
137
|
+
end
|
138
|
+
iso.damage
|
139
|
+
cnt.should == 1
|
140
|
+
end
|
141
|
+
|
142
|
+
it "should execute a callback when an expectation is being invoked and with is not defined in a block" do
|
143
|
+
cnt = 0
|
144
|
+
iso = Caricature::Isolation.for(Dagger)
|
145
|
+
iso.when_receiving(:damage) do |exp|
|
146
|
+
exp.with(:any) do |*args|
|
147
|
+
cnt += 1
|
148
|
+
end
|
149
|
+
end
|
150
|
+
iso.damage
|
151
|
+
cnt.should == 1
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
end
|
@@ -254,7 +254,18 @@ describe "Ruby to Ruby interactions" do
|
|
254
254
|
|
255
255
|
@soldier.did_receive?(:survive_attack_with).should.be.successful
|
256
256
|
end
|
257
|
+
|
258
|
+
it "should be able to isolate objects with constructor params" do
|
259
|
+
sheath = Caricature::Isolation.for(Sheath)
|
260
|
+
sheath.when_receiving(:insert).raise("Overridden")
|
261
|
+
lambda { sheath.insert(@dagger) }.should.raise.message.should.match(/Overridden/)
|
262
|
+
end
|
263
|
+
|
264
|
+
it "should be able to isolate objects with constructor params" do
|
265
|
+
sheath = Caricature::Isolation.for(Sheath)
|
266
|
+
lambda { sheath.insert(@dagger) }.should.not.raise
|
267
|
+
end
|
257
268
|
|
258
|
-
end
|
269
|
+
end
|
259
270
|
|
260
271
|
end
|
data/spec/models/ClrModels.cs
CHANGED
@@ -86,16 +86,16 @@ namespace ClrModels{
|
|
86
86
|
|
87
87
|
}
|
88
88
|
|
89
|
-
public class Sword : IWeapon{
|
89
|
+
public class Sword : IWeapon {
|
90
90
|
|
91
|
-
|
92
|
-
|
93
|
-
|
91
|
+
public virtual int Attack(IWarrior warrior){
|
92
|
+
return warrior.SurviveAttackWith(this);
|
93
|
+
}
|
94
94
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
}
|
95
|
+
public int Damage(){
|
96
|
+
return 4;
|
97
|
+
}
|
98
|
+
}
|
99
99
|
|
100
100
|
public class SwordWithStatics : Sword{
|
101
101
|
|
@@ -36,6 +36,10 @@ describe "Caricature::ExpectationBuilder" do
|
|
36
36
|
|
37
37
|
it "should have no return_value" do
|
38
38
|
@expectation.return_value.should.equal nil
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should have no callback" do
|
42
|
+
@expectation.should.not.has_callback?
|
39
43
|
end
|
40
44
|
|
41
45
|
end
|
@@ -66,6 +70,10 @@ describe "Caricature::ExpectationBuilder" do
|
|
66
70
|
|
67
71
|
it "should have no return_value" do
|
68
72
|
@expectation.return_value.should.equal nil
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should have no callback" do
|
76
|
+
@expectation.should.not.has_callback?
|
69
77
|
end
|
70
78
|
|
71
79
|
end
|
@@ -189,6 +197,33 @@ describe "Caricature::ExpectationBuilder" do
|
|
189
197
|
@expectation.return_value.should.equal 5
|
190
198
|
end
|
191
199
|
|
200
|
+
end
|
201
|
+
|
202
|
+
describe "when giving a block to the arguments constraint it should register it as a callback" do
|
203
|
+
|
204
|
+
before do
|
205
|
+
builder = Caricature::ExpectationBuilder.new :some_method
|
206
|
+
@counter, @args = 0, []
|
207
|
+
builder.with(5) do |*args|
|
208
|
+
@counter += 1
|
209
|
+
@args = args
|
210
|
+
end
|
211
|
+
@expectation = builder.build
|
212
|
+
end
|
213
|
+
|
214
|
+
it "should have a callback" do
|
215
|
+
@expectation.should.has_callback?
|
216
|
+
end
|
217
|
+
|
218
|
+
it "should call the callback when the expectation is called" do
|
219
|
+
@expectation.execute
|
220
|
+
@counter.should == 1
|
221
|
+
end
|
222
|
+
|
223
|
+
it "should pass on the correct arguments" do
|
224
|
+
@expectation.execute 1, 2, 3
|
225
|
+
@args.should == [1, 2, 3]
|
226
|
+
end
|
192
227
|
end
|
193
228
|
|
194
229
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caricature
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Porto Carrero
|
@@ -9,113 +9,31 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-09-09 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
|
-
dependencies:
|
15
|
-
|
16
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: uuidtools
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 2.0.0
|
24
|
+
version:
|
25
|
+
description: Caricature brings simple mocking to Ruby, DLR and CLR.
|
17
26
|
email: ivan@flanders.co.nz
|
18
27
|
executables: []
|
19
28
|
|
20
29
|
extensions: []
|
21
30
|
|
22
31
|
extra_rdoc_files:
|
23
|
-
- README.
|
32
|
+
- README.rdoc
|
24
33
|
files:
|
25
|
-
- .
|
26
|
-
- README.markdown
|
34
|
+
- README.rdoc
|
27
35
|
- Rakefile
|
28
|
-
- VERSION
|
29
36
|
- caricature.gemspec
|
30
|
-
- doc/Array.html
|
31
|
-
- doc/Caricature.html
|
32
|
-
- doc/Caricature/ArgumentRecording.html
|
33
|
-
- doc/Caricature/ClrClassDescriptor.html
|
34
|
-
- doc/Caricature/ClrClassMessenger.html
|
35
|
-
- doc/Caricature/ClrInterfaceDescriptor.html
|
36
|
-
- doc/Caricature/ClrInterfaceIsolator.html
|
37
|
-
- doc/Caricature/ClrInterfaceMessenger.html
|
38
|
-
- doc/Caricature/ClrIsolator.html
|
39
|
-
- doc/Caricature/Expectation.html
|
40
|
-
- doc/Caricature/ExpectationBuilder.html
|
41
|
-
- doc/Caricature/ExpectationSyntax.html
|
42
|
-
- doc/Caricature/Expectations.html
|
43
|
-
- doc/Caricature/Interception.html
|
44
|
-
- doc/Caricature/Interception/ClassMethods.html
|
45
|
-
- doc/Caricature/Isolation.html
|
46
|
-
- doc/Caricature/Isolator.html
|
47
|
-
- doc/Caricature/MemberDescriptor.html
|
48
|
-
- doc/Caricature/Messenger.html
|
49
|
-
- doc/Caricature/MethodCallRecorder.html
|
50
|
-
- doc/Caricature/MethodCallRecording.html
|
51
|
-
- doc/Caricature/RubyIsolator.html
|
52
|
-
- doc/Caricature/RubyMessenger.html
|
53
|
-
- doc/Caricature/RubyObjectDescriptor.html
|
54
|
-
- doc/Caricature/TypeDescriptor.html
|
55
|
-
- doc/Caricature/Verification.html
|
56
|
-
- doc/Class.html
|
57
|
-
- doc/Hash.html
|
58
|
-
- doc/Module.html
|
59
|
-
- doc/Object.html
|
60
|
-
- doc/README_markdown.html
|
61
|
-
- doc/String.html
|
62
|
-
- doc/System.html
|
63
|
-
- doc/System/String.html
|
64
|
-
- doc/System/Type.html
|
65
|
-
- doc/created.rid
|
66
|
-
- doc/images/brick.png
|
67
|
-
- doc/images/brick_link.png
|
68
|
-
- doc/images/bug.png
|
69
|
-
- doc/images/bullet_black.png
|
70
|
-
- doc/images/bullet_toggle_minus.png
|
71
|
-
- doc/images/bullet_toggle_plus.png
|
72
|
-
- doc/images/date.png
|
73
|
-
- doc/images/find.png
|
74
|
-
- doc/images/loadingAnimation.gif
|
75
|
-
- doc/images/macFFBgHack.png
|
76
|
-
- doc/images/package.png
|
77
|
-
- doc/images/page_green.png
|
78
|
-
- doc/images/page_white_text.png
|
79
|
-
- doc/images/page_white_width.png
|
80
|
-
- doc/images/plugin.png
|
81
|
-
- doc/images/ruby.png
|
82
|
-
- doc/images/tag_green.png
|
83
|
-
- doc/images/wrench.png
|
84
|
-
- doc/images/wrench_orange.png
|
85
|
-
- doc/images/zoom.png
|
86
|
-
- doc/index.html
|
87
|
-
- doc/js/darkfish.js
|
88
|
-
- doc/js/jquery.js
|
89
|
-
- doc/js/quicksearch.js
|
90
|
-
- doc/js/thickbox-compressed.js
|
91
|
-
- doc/lib/caricature/clr/aspnet_mvc_rb.html
|
92
|
-
- doc/lib/caricature/clr/descriptor_rb.html
|
93
|
-
- doc/lib/caricature/clr/isolation_rb.html
|
94
|
-
- doc/lib/caricature/clr/isolator_rb.html
|
95
|
-
- doc/lib/caricature/clr/messenger_rb.html
|
96
|
-
- doc/lib/caricature/clr_rb.html
|
97
|
-
- doc/lib/caricature/descriptor_rb.html
|
98
|
-
- doc/lib/caricature/expectation_rb.html
|
99
|
-
- doc/lib/caricature/isolation_rb.html
|
100
|
-
- doc/lib/caricature/isolator_rb.html
|
101
|
-
- doc/lib/caricature/messaging_rb.html
|
102
|
-
- doc/lib/caricature/messenger_rb.html
|
103
|
-
- doc/lib/caricature/method_call_recorder_rb.html
|
104
|
-
- doc/lib/caricature/verification_rb.html
|
105
|
-
- doc/lib/caricature_rb.html
|
106
|
-
- doc/lib/core_ext/array_rb.html
|
107
|
-
- doc/lib/core_ext/class_rb.html
|
108
|
-
- doc/lib/core_ext/core_ext_rb.html
|
109
|
-
- doc/lib/core_ext/hash_rb.html
|
110
|
-
- doc/lib/core_ext/module_rb.html
|
111
|
-
- doc/lib/core_ext/object_rb.html
|
112
|
-
- doc/lib/core_ext/string_rb.html
|
113
|
-
- doc/lib/core_ext/system/string_rb.html
|
114
|
-
- doc/lib/core_ext/system/type_rb.html
|
115
|
-
- doc/rdoc.css
|
116
|
-
- irb_init.rb
|
117
|
-
- lib/bin/Workarounds.dll
|
118
|
-
- lib/bin/Workarounds.pdb
|
119
37
|
- lib/caricature.rb
|
120
38
|
- lib/caricature/clr.rb
|
121
39
|
- lib/caricature/clr/aspnet_mvc.rb
|
@@ -130,6 +48,7 @@ files:
|
|
130
48
|
- lib/caricature/messenger.rb
|
131
49
|
- lib/caricature/method_call_recorder.rb
|
132
50
|
- lib/caricature/verification.rb
|
51
|
+
- lib/caricature/version.rb
|
133
52
|
- lib/core_ext/array.rb
|
134
53
|
- lib/core_ext/class.rb
|
135
54
|
- lib/core_ext/core_ext.rb
|
@@ -139,12 +58,10 @@ files:
|
|
139
58
|
- lib/core_ext/string.rb
|
140
59
|
- lib/core_ext/system/string.rb
|
141
60
|
- lib/core_ext/system/type.rb
|
142
|
-
- pkg/.gitignore
|
143
|
-
- pkg/caricature-0.1.0.gem
|
144
|
-
- pkg/caricature-0.5.0.gem
|
145
|
-
- pkg/caricature-0.6.0.gem
|
146
61
|
- spec/bacon_helper.rb
|
147
|
-
- spec/bin
|
62
|
+
- spec/bin/ClrModels.dll
|
63
|
+
- spec/bin/ClrModels.dll.mdb
|
64
|
+
- spec/integration/callback_spec.rb
|
148
65
|
- spec/integration/clr_to_clr_spec.rb
|
149
66
|
- spec/integration/clr_to_ruby_spec.rb
|
150
67
|
- spec/integration/indexer_spec.rb
|
@@ -160,21 +77,28 @@ files:
|
|
160
77
|
- spec/unit/method_call_spec.rb
|
161
78
|
- spec/unit/sword_spec.rb
|
162
79
|
- spec/unit/verification_spec.rb
|
163
|
-
- workarounds/ReflectionHelper.cs
|
164
80
|
has_rdoc: true
|
165
|
-
homepage: http://github.com/
|
81
|
+
homepage: http://casualjim.github.com/caricature
|
166
82
|
licenses: []
|
167
83
|
|
168
84
|
post_install_message:
|
169
85
|
rdoc_options:
|
170
|
-
- --
|
86
|
+
- --quiet
|
87
|
+
- --title
|
88
|
+
- Caricature brings simple mocking to Ruby, DLR and CLR.
|
89
|
+
- --main
|
90
|
+
- lib/caricature/isolation.rb
|
91
|
+
- --line-numbers
|
92
|
+
- --inline-source
|
93
|
+
- --format
|
94
|
+
- darkfish
|
171
95
|
require_paths:
|
172
96
|
- lib
|
173
97
|
required_ruby_version: !ruby/object:Gem::Requirement
|
174
98
|
requirements:
|
175
99
|
- - ">="
|
176
100
|
- !ruby/object:Gem::Version
|
177
|
-
version:
|
101
|
+
version: 1.8.4
|
178
102
|
version:
|
179
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
104
|
requirements:
|
@@ -185,23 +109,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
109
|
requirements: []
|
186
110
|
|
187
111
|
rubyforge_project: caricature
|
188
|
-
rubygems_version: 1.3.
|
112
|
+
rubygems_version: 1.3.5
|
189
113
|
signing_key:
|
190
114
|
specification_version: 3
|
191
|
-
summary: Caricature
|
192
|
-
test_files:
|
193
|
-
|
194
|
-
- spec/integration/clr_to_clr_spec.rb
|
195
|
-
- spec/integration/clr_to_ruby_spec.rb
|
196
|
-
- spec/integration/indexer_spec.rb
|
197
|
-
- spec/integration/ruby_to_ruby_spec.rb
|
198
|
-
- spec/unit/core_ext_spec.rb
|
199
|
-
- spec/unit/descriptor_spec.rb
|
200
|
-
- spec/unit/expectation_spec.rb
|
201
|
-
- spec/unit/interop_spec.rb
|
202
|
-
- spec/unit/isolation_spec.rb
|
203
|
-
- spec/unit/isolator_spec.rb
|
204
|
-
- spec/unit/messaging_spec.rb
|
205
|
-
- spec/unit/method_call_spec.rb
|
206
|
-
- spec/unit/sword_spec.rb
|
207
|
-
- spec/unit/verification_spec.rb
|
115
|
+
summary: Caricature brings simple mocking to Ruby, DLR and CLR.
|
116
|
+
test_files: []
|
117
|
+
|
data/.gitignore
DELETED
data/README.markdown
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
Caricature - Bringing simple mocking to the DLR
|
2
|
-
===============================================
|
3
|
-
|
4
|
-
This project aims to make interop between IronRuby objects and .NET objects easier.
|
5
|
-
The idea is that it integrates nicely with bacon and later rspec and that it transparently lets you mock ironruby ojbects
|
6
|
-
as well as CLR objects/interfaces.
|
7
|
-
Caricature handles interfaces, interface inheritance, CLR objects, CLR object instances, Ruby classes and instances of Ruby classes.
|
8
|
-
|
9
|
-
From the start I wanted to do away with names like mock, stub, record, replay, verify etc.
|
10
|
-
Instead I took the advice from Roy Osherhove and went with a name of Isolation for creating a mock.
|
11
|
-
|
12
|
-
An Isolation will create what in Rhino.Mocks would be called a DynamicMock (but can be a partial too) :)
|
13
|
-
In Moq it would be the Loose mocking strategy.
|
14
|
-
|
15
|
-
The naming of the methods for creating mocks is the one that JP Boodhoo proposed WhenToldTo and WasToldTo.
|
16
|
-
To specify a stub/expectation on an isolation you have one and only one way of doing that with the method called when_receiving.
|
17
|
-
Then only if you're interested in asserting if a method has been called you can use the did_receive? method for this.
|
18
|
-
|
19
|
-
<pre>
|
20
|
-
isolation = Isolation.for(Ninja)
|
21
|
-
isolation.when_receiving(:attack) do |exp|
|
22
|
-
exp.with(:shuriken)
|
23
|
-
exp.return(3)
|
24
|
-
end
|
25
|
-
|
26
|
-
Battle.new(mock)
|
27
|
-
battle.combat
|
28
|
-
|
29
|
-
isolation.did_receive?(:attack).should.be.true?
|
30
|
-
</pre>
|
31
|
-
|
32
|
-
It may be very important to note that when you're going to be isolating CLR classes to be used in other CLR classes
|
33
|
-
you still need to obide by the CLR rules. That means if you want to redefine a method you'll need to make sure it's
|
34
|
-
marked as virtual. Static types are still governed by static type rules. I'm working on a solution around those
|
35
|
-
problems but for the time being this is how it has to be.
|
36
|
-
|
37
|
-
License:
|
38
|
-
--------
|
39
|
-
|
40
|
-
Caricature -- A simple mocking framework for IronRuby
|
41
|
-
|
42
|
-
Copyright (c) 2009, Caricature Team
|
43
|
-
http://github.com/casualjim/caricature
|
44
|
-
All rights reserved.
|
45
|
-
|
46
|
-
Redistribution and use in source and binary forms,
|
47
|
-
with or without modification, are permitted provided
|
48
|
-
that the following conditions are met:
|
49
|
-
|
50
|
-
* Redistributions of source code must retain the
|
51
|
-
above copyright notice, this list of conditions and
|
52
|
-
the following disclaimer.
|
53
|
-
|
54
|
-
* Redistributions in binary form must reproduce
|
55
|
-
the above copyright notice, this list of conditions
|
56
|
-
and the following disclaimer in the documentation
|
57
|
-
and/or other materials provided with the distribution.
|
58
|
-
|
59
|
-
* Neither the name of the Caricature Team nor the
|
60
|
-
names of its contributors may be used to endorse
|
61
|
-
or promote products derived from this software
|
62
|
-
without specific prior written permission.
|
63
|
-
|
64
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
65
|
-
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
66
|
-
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
67
|
-
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
68
|
-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
69
|
-
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
70
|
-
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
71
|
-
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
72
|
-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
73
|
-
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
74
|
-
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
75
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
76
|
-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
77
|
-
SUCH DAMAGE.
|
78
|
-
|
79
|
-
[This is the BSD license, see
|
80
|
-
http://www.opensource.org/licenses/bsd-license.php]
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.6.3
|