caricature 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/caricature.gemspec +5 -2
- data/doc/Array.html +2 -2
- data/doc/Caricature/ArgumentRecording.html +4 -4
- data/doc/Caricature/ClrClassMessenger.html +22 -22
- data/doc/Caricature/ClrInterfaceMessenger.html +19 -19
- data/doc/Caricature/ClrIsolator.html +1 -1
- data/doc/Caricature/Expectation.html +12 -12
- data/doc/Caricature/ExpectationBuilder.html +6 -6
- data/doc/Caricature/ExpectationSyntax.html +10 -10
- data/doc/Caricature/Expectations.html +19 -16
- data/doc/Caricature/Interception/ClassMethods.html +120 -2
- data/doc/Caricature/Interception.html +130 -12
- data/doc/Caricature/Isolation.html +207 -22
- data/doc/Caricature/Isolator.html +18 -18
- data/doc/Caricature/Messenger.html +87 -9
- data/doc/Caricature/MethodCallRecorder.html +20 -56
- data/doc/Caricature/MethodCallRecording.html +10 -10
- data/doc/Caricature/RubyIsolator.html +13 -13
- data/doc/Caricature/RubyMessenger.html +24 -23
- data/doc/Caricature/RubyObjectDescriptor.html +4 -4
- data/doc/Caricature/TypeDescriptor.html +4 -4
- data/doc/Caricature/Verification.html +16 -16
- data/doc/Caricature.html +2 -2
- data/doc/Class.html +4 -4
- data/doc/Hash.html +2 -2
- data/doc/Module.html +4 -4
- data/doc/Object.html +6 -6
- data/doc/String.html +4 -4
- data/doc/System/String.html +4 -4
- data/doc/System/Type.html +4 -4
- data/doc/created.rid +1 -1
- data/doc/index.html +102 -82
- data/doc/lib/caricature/clr/isolator_rb.html +1 -1
- data/doc/lib/caricature/clr/messenger_rb.html +1 -1
- data/doc/lib/caricature/clr_rb.html +1 -1
- data/doc/lib/caricature/expectation_rb.html +1 -1
- data/doc/lib/caricature/isolation_rb.html +1 -1
- data/doc/lib/caricature/isolator_rb.html +1 -1
- data/doc/lib/caricature/messenger_rb.html +52 -0
- data/doc/lib/caricature/method_call_recorder_rb.html +1 -1
- data/doc/lib/caricature/verification_rb.html +1 -1
- data/doc/lib/caricature_rb.html +1 -1
- data/lib/caricature/clr/aspnet_mvc.rb +51 -0
- data/lib/caricature/clr/isolator.rb +2 -1
- data/lib/caricature/expectation.rb +4 -3
- data/lib/caricature/method_call_recorder.rb +2 -2
- data/lib/caricature/verification.rb +1 -1
- data/pkg/caricature-0.5.0.gem +0 -0
- data/spec/isolator_spec.rb +7 -1
- metadata +5 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.0
|
data/caricature.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{caricature}
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.6.0"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Ivan Porto Carrero"]
|
9
|
-
s.date = %q{2009-05-
|
9
|
+
s.date = %q{2009-05-21}
|
10
10
|
s.description = %q{This project aims to make interop between IronRuby objects and .NET objects easier. The idea is that it integrates nicely with bacon and later rspec and that it transparently lets you mock ironruby ojbects as well as CLR objects/interfaces. Caricature handles interfaces, interface inheritance, CLR objects, CLR object instances, Ruby classes and instances of Ruby classes.}
|
11
11
|
s.email = %q{ivan@flanders.co.nz}
|
12
12
|
s.extra_rdoc_files = [
|
@@ -89,6 +89,7 @@ Gem::Specification.new do |s|
|
|
89
89
|
"doc/lib/caricature/isolation_rb.html",
|
90
90
|
"doc/lib/caricature/isolator_rb.html",
|
91
91
|
"doc/lib/caricature/messaging_rb.html",
|
92
|
+
"doc/lib/caricature/messenger_rb.html",
|
92
93
|
"doc/lib/caricature/method_call_recorder_rb.html",
|
93
94
|
"doc/lib/caricature/verification_rb.html",
|
94
95
|
"doc/lib/caricature_rb.html",
|
@@ -107,6 +108,7 @@ Gem::Specification.new do |s|
|
|
107
108
|
"lib/bin/Workarounds.pdb",
|
108
109
|
"lib/caricature.rb",
|
109
110
|
"lib/caricature/clr.rb",
|
111
|
+
"lib/caricature/clr/aspnet_mvc.rb",
|
110
112
|
"lib/caricature/clr/descriptor.rb",
|
111
113
|
"lib/caricature/clr/isolation.rb",
|
112
114
|
"lib/caricature/clr/isolator.rb",
|
@@ -129,6 +131,7 @@ Gem::Specification.new do |s|
|
|
129
131
|
"lib/core_ext/system/type.rb",
|
130
132
|
"pkg/.gitignore",
|
131
133
|
"pkg/caricature-0.1.0.gem",
|
134
|
+
"pkg/caricature-0.5.0.gem",
|
132
135
|
"spec/bacon_helper.rb",
|
133
136
|
"spec/bin/.gitignore",
|
134
137
|
"spec/core_ext_spec.rb",
|
data/doc/Array.html
CHANGED
@@ -59,7 +59,7 @@
|
|
59
59
|
<h3 class="section-header">Methods</h3>
|
60
60
|
<ul class="link-list">
|
61
61
|
|
62
|
-
<li><a href="#
|
62
|
+
<li><a href="#M000087">#to_h</a></li>
|
63
63
|
|
64
64
|
</ul>
|
65
65
|
</div>
|
@@ -193,7 +193,7 @@
|
|
193
193
|
|
194
194
|
|
195
195
|
<div id="to-h-method" class="method-detail ">
|
196
|
-
<a name="
|
196
|
+
<a name="M000087"></a>
|
197
197
|
|
198
198
|
<div class="method-heading">
|
199
199
|
|
@@ -59,9 +59,9 @@
|
|
59
59
|
<h3 class="section-header">Methods</h3>
|
60
60
|
<ul class="link-list">
|
61
61
|
|
62
|
-
<li><a href="#
|
62
|
+
<li><a href="#M000064">::new</a></li>
|
63
63
|
|
64
|
-
<li><a href="#
|
64
|
+
<li><a href="#M000066">#==</a></li>
|
65
65
|
|
66
66
|
</ul>
|
67
67
|
</div>
|
@@ -264,7 +264,7 @@ the number of the call that has the following parameters
|
|
264
264
|
|
265
265
|
|
266
266
|
<div id="new-method" class="method-detail ">
|
267
|
-
<a name="
|
267
|
+
<a name="M000064"></a>
|
268
268
|
|
269
269
|
<div class="method-heading">
|
270
270
|
|
@@ -307,7 +307,7 @@ call count and the args as an <tt>Array</tt>
|
|
307
307
|
|
308
308
|
|
309
309
|
<div id="--method" class="method-detail ">
|
310
|
-
<a name="
|
310
|
+
<a name="M000066"></a>
|
311
311
|
|
312
312
|
<div class="method-heading">
|
313
313
|
|
@@ -59,7 +59,7 @@
|
|
59
59
|
<h3 class="section-header">Methods</h3>
|
60
60
|
<ul class="link-list">
|
61
61
|
|
62
|
-
<li><a href="#M000010">#
|
62
|
+
<li><a href="#M000010">#internal_deliver</a></li>
|
63
63
|
|
64
64
|
</ul>
|
65
65
|
</div>
|
@@ -191,17 +191,17 @@ Encapsulates sending messages to CLR class or instance isolations
|
|
191
191
|
|
192
192
|
<!-- Methods -->
|
193
193
|
|
194
|
-
<div id="
|
195
|
-
<h3 class="section-header">
|
194
|
+
<div id="protected-instance-method-details" class="method-section section">
|
195
|
+
<h3 class="section-header">Protected Instance Methods</h3>
|
196
196
|
|
197
197
|
|
198
|
-
<div id="deliver-method" class="method-detail ">
|
198
|
+
<div id="internal-deliver-method" class="method-detail ">
|
199
199
|
<a name="M000010"></a>
|
200
200
|
|
201
201
|
<div class="method-heading">
|
202
202
|
|
203
|
-
<span class="method-name">
|
204
|
-
class="method-args">(method_name, return_type, *args, &b)</span>
|
203
|
+
<span class="method-name">internal_deliver</span><span
|
204
|
+
class="method-args">(mode, method_name, return_type, *args, &b)</span>
|
205
205
|
<span class="method-click-advice">click to toggle source</span>
|
206
206
|
|
207
207
|
</div>
|
@@ -215,23 +215,23 @@ deliver the message to the receiving isolation
|
|
215
215
|
|
216
216
|
|
217
217
|
<div class="method-source-code"
|
218
|
-
id="deliver-source">
|
218
|
+
id="internal-deliver-source">
|
219
219
|
<pre>
|
220
|
-
<span class="ruby-comment cmt"># File lib/caricature/clr/messenger.rb, line
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
220
|
+
<span class="ruby-comment cmt"># File lib/caricature/clr/messenger.rb, line 9</span>
|
221
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">internal_deliver</span>(<span class="ruby-identifier">mode</span>, <span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">return_type</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">b</span>)
|
222
|
+
<span class="ruby-identifier">exp</span> = <span class="ruby-identifier">expectations</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">mode</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
223
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exp</span>
|
224
|
+
<span class="ruby-identifier">res</span> = <span class="ruby-identifier">instance</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">b</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exp</span>.<span class="ruby-identifier">super_before?</span>
|
225
|
+
<span class="ruby-identifier">res</span> = <span class="ruby-identifier">exp</span>.<span class="ruby-identifier">execute</span> <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>
|
226
|
+
<span class="ruby-identifier">res</span> = <span class="ruby-identifier">instance</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">b</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">exp</span>.<span class="ruby-identifier">super_before?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">exp</span>.<span class="ruby-identifier">call_super?</span>
|
227
|
+
<span class="ruby-identifier">res</span>
|
228
|
+
<span class="ruby-keyword kw">else</span>
|
229
|
+
<span class="ruby-identifier">rt</span> = <span class="ruby-keyword kw">nil</span>
|
230
|
+
<span class="ruby-identifier">is_value_type</span> = <span class="ruby-identifier">return_type</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">return_type</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">System</span><span class="ruby-operator">::</span><span class="ruby-constant">Void</span>.<span class="ruby-identifier">to_clr_type</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">return_type</span>.<span class="ruby-identifier">is_value_type</span>
|
231
|
+
<span class="ruby-identifier">rt</span> = <span class="ruby-constant">System</span><span class="ruby-operator">::</span><span class="ruby-constant">Activator</span>.<span class="ruby-identifier">create_instance</span>(<span class="ruby-identifier">return_type</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">is_value_type</span>
|
232
|
+
<span class="ruby-identifier">rt</span>
|
233
|
+
<span class="ruby-keyword kw">end</span>
|
234
|
+
<span class="ruby-keyword kw">end</span></pre>
|
235
235
|
</div>
|
236
236
|
|
237
237
|
</div>
|
@@ -59,7 +59,7 @@
|
|
59
59
|
<h3 class="section-header">Methods</h3>
|
60
60
|
<ul class="link-list">
|
61
61
|
|
62
|
-
<li><a href="#M000014">#
|
62
|
+
<li><a href="#M000014">#internal_deliver</a></li>
|
63
63
|
|
64
64
|
</ul>
|
65
65
|
</div>
|
@@ -191,17 +191,17 @@ Encapsulates sending messages to CLR interface isolations
|
|
191
191
|
|
192
192
|
<!-- Methods -->
|
193
193
|
|
194
|
-
<div id="
|
195
|
-
<h3 class="section-header">
|
194
|
+
<div id="protected-instance-method-details" class="method-section section">
|
195
|
+
<h3 class="section-header">Protected Instance Methods</h3>
|
196
196
|
|
197
197
|
|
198
|
-
<div id="deliver-method" class="method-detail ">
|
198
|
+
<div id="internal-deliver-method" class="method-detail ">
|
199
199
|
<a name="M000014"></a>
|
200
200
|
|
201
201
|
<div class="method-heading">
|
202
202
|
|
203
|
-
<span class="method-name">
|
204
|
-
class="method-args">(method_name, return_type, *args, &b)</span>
|
203
|
+
<span class="method-name">internal_deliver</span><span
|
204
|
+
class="method-args">(mode, method_name, return_type, *args, &b)</span>
|
205
205
|
<span class="method-click-advice">click to toggle source</span>
|
206
206
|
|
207
207
|
</div>
|
@@ -215,20 +215,20 @@ deliver the message to the receiving isolation
|
|
215
215
|
|
216
216
|
|
217
217
|
<div class="method-source-code"
|
218
|
-
id="deliver-source">
|
218
|
+
id="internal-deliver-source">
|
219
219
|
<pre>
|
220
|
-
<span class="ruby-comment cmt"># File lib/caricature/clr/messenger.rb, line
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
220
|
+
<span class="ruby-comment cmt"># File lib/caricature/clr/messenger.rb, line 32</span>
|
221
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">internal_deliver</span>(<span class="ruby-identifier">mode</span>, <span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">return_type</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">b</span>)
|
222
|
+
<span class="ruby-identifier">exp</span> = <span class="ruby-identifier">expectations</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">mode</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
223
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exp</span>
|
224
|
+
<span class="ruby-identifier">res</span> = <span class="ruby-identifier">exp</span>.<span class="ruby-identifier">execute</span> <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>
|
225
|
+
<span class="ruby-identifier">res</span>
|
226
|
+
<span class="ruby-keyword kw">else</span>
|
227
|
+
<span class="ruby-identifier">rt</span> = <span class="ruby-keyword kw">nil</span>
|
228
|
+
<span class="ruby-identifier">rt</span> = <span class="ruby-constant">System</span><span class="ruby-operator">::</span><span class="ruby-constant">Activator</span>.<span class="ruby-identifier">create_instance</span>(<span class="ruby-identifier">return_type</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">return_type</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">return_type</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">System</span><span class="ruby-operator">::</span><span class="ruby-constant">Void</span>.<span class="ruby-identifier">to_clr_type</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">return_type</span>.<span class="ruby-identifier">is_value_type</span>
|
229
|
+
<span class="ruby-identifier">rt</span>
|
230
|
+
<span class="ruby-keyword kw">end</span>
|
231
|
+
<span class="ruby-keyword kw">end</span></pre>
|
232
232
|
</div>
|
233
233
|
|
234
234
|
</div>
|
@@ -351,7 +351,7 @@ subject
|
|
351
351
|
<span class="ruby-identifier">define_cmethod</span> <span class="ruby-identifier">mn</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-operator">*</span><span class="ruby-identifier">args</span><span class="ruby-operator">|</span>
|
352
352
|
<span class="ruby-identifier">b</span> = <span class="ruby-keyword kw">nil</span>
|
353
353
|
<span class="ruby-identifier">b</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> { <span class="ruby-keyword kw">yield</span> } <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
354
|
-
<span class="ruby-identifier">isolation_context</span>.<span class="ruby-identifier">
|
354
|
+
<span class="ruby-identifier">isolation_context</span>.<span class="ruby-identifier">send_class_message</span>(<span class="ruby-identifier">mn</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">b</span>)
|
355
355
|
<span class="ruby-keyword kw">end</span>
|
356
356
|
<span class="ruby-keyword kw">end</span>
|
357
357
|
|
@@ -61,15 +61,15 @@
|
|
61
61
|
|
62
62
|
<li><a href="#M000031">::new</a></li>
|
63
63
|
|
64
|
-
<li><a href="#
|
64
|
+
<li><a href="#M000036">#call_super?</a></li>
|
65
65
|
|
66
|
-
<li><a href="#
|
66
|
+
<li><a href="#M000037">#execute</a></li>
|
67
67
|
|
68
68
|
<li><a href="#M000032">#has_error_args?</a></li>
|
69
69
|
|
70
70
|
<li><a href="#M000033">#has_return_value?</a></li>
|
71
71
|
|
72
|
-
<li><a href="#
|
72
|
+
<li><a href="#M000035">#super_before?</a></li>
|
73
73
|
|
74
74
|
</ul>
|
75
75
|
</div>
|
@@ -333,7 +333,7 @@ Initializes a new instance of an expectation
|
|
333
333
|
<div class="method-source-code"
|
334
334
|
id="new-source">
|
335
335
|
<pre>
|
336
|
-
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line
|
336
|
+
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line 101</span>
|
337
337
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">error_args</span>, <span class="ruby-identifier">return_value</span>, <span class="ruby-identifier">super_mode</span>)
|
338
338
|
<span class="ruby-ivar">@method_name</span>, <span class="ruby-ivar">@args</span>, <span class="ruby-ivar">@error_args</span>, <span class="ruby-ivar">@return_value</span>, <span class="ruby-ivar">@super</span> =
|
339
339
|
<span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">error_args</span>, <span class="ruby-identifier">return_value</span>, <span class="ruby-identifier">super_mode</span>
|
@@ -354,7 +354,7 @@ Initializes a new instance of an expectation
|
|
354
354
|
|
355
355
|
|
356
356
|
<div id="call-super--method" class="method-detail ">
|
357
|
-
<a name="
|
357
|
+
<a name="M000036"></a>
|
358
358
|
|
359
359
|
<div class="method-heading">
|
360
360
|
|
@@ -375,7 +375,7 @@ indicates whether super needs to be called somewhere
|
|
375
375
|
<div class="method-source-code"
|
376
376
|
id="call-super--source">
|
377
377
|
<pre>
|
378
|
-
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line
|
378
|
+
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line 123</span>
|
379
379
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call_super?</span>
|
380
380
|
<span class="ruby-operator">!</span><span class="ruby-ivar">@super</span>.<span class="ruby-identifier">nil?</span>
|
381
381
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -388,7 +388,7 @@ indicates whether super needs to be called somewhere
|
|
388
388
|
|
389
389
|
|
390
390
|
<div id="execute-method" class="method-detail ">
|
391
|
-
<a name="
|
391
|
+
<a name="M000037"></a>
|
392
392
|
|
393
393
|
<div class="method-heading">
|
394
394
|
|
@@ -409,7 +409,7 @@ executes this expectation with its configuration
|
|
409
409
|
<div class="method-source-code"
|
410
410
|
id="execute-source">
|
411
411
|
<pre>
|
412
|
-
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line
|
412
|
+
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line 128</span>
|
413
413
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">execute</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">margs</span>)
|
414
414
|
<span class="ruby-identifier">ags</span> = <span class="ruby-identifier">any_args?</span> <span class="ruby-value">? </span>(<span class="ruby-identifier">margs</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-value">? </span><span class="ruby-operator">:</span><span class="ruby-identifier">any</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">margs</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">args</span>
|
415
415
|
<span class="ruby-identifier">raise</span> <span class="ruby-operator">*</span><span class="ruby-ivar">@error_args</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">has_error_args?</span>
|
@@ -446,7 +446,7 @@ indicates whether this expecation will raise an event.
|
|
446
446
|
<div class="method-source-code"
|
447
447
|
id="has-error-args--source">
|
448
448
|
<pre>
|
449
|
-
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line
|
449
|
+
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line 108</span>
|
450
450
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">has_error_args?</span>
|
451
451
|
<span class="ruby-operator">!</span><span class="ruby-ivar">@error_args</span>.<span class="ruby-identifier">nil?</span>
|
452
452
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -480,7 +480,7 @@ indicates whether this expectation will return a value.
|
|
480
480
|
<div class="method-source-code"
|
481
481
|
id="has-return-value--source">
|
482
482
|
<pre>
|
483
|
-
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line
|
483
|
+
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line 113</span>
|
484
484
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">has_return_value?</span>
|
485
485
|
<span class="ruby-operator">!</span><span class="ruby-ivar">@return_value</span>.<span class="ruby-identifier">nil?</span>
|
486
486
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -493,7 +493,7 @@ indicates whether this expectation will return a value.
|
|
493
493
|
|
494
494
|
|
495
495
|
<div id="super-before--method" class="method-detail ">
|
496
|
-
<a name="
|
496
|
+
<a name="M000035"></a>
|
497
497
|
|
498
498
|
<div class="method-heading">
|
499
499
|
|
@@ -514,7 +514,7 @@ call the super before the expectation
|
|
514
514
|
<div class="method-source-code"
|
515
515
|
id="super-before--source">
|
516
516
|
<pre>
|
517
|
-
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line
|
517
|
+
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line 118</span>
|
518
518
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">super_before?</span>
|
519
519
|
<span class="ruby-ivar">@super</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:before</span>
|
520
520
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -59,9 +59,9 @@
|
|
59
59
|
<h3 class="section-header">Methods</h3>
|
60
60
|
<ul class="link-list">
|
61
61
|
|
62
|
-
<li><a href="#
|
62
|
+
<li><a href="#M000040">::new</a></li>
|
63
63
|
|
64
|
-
<li><a href="#
|
64
|
+
<li><a href="#M000042">#build</a></li>
|
65
65
|
|
66
66
|
</ul>
|
67
67
|
</div>
|
@@ -210,7 +210,7 @@ and usage of the expectation
|
|
210
210
|
|
211
211
|
|
212
212
|
<div id="new-method" class="method-detail ">
|
213
|
-
<a name="
|
213
|
+
<a name="M000040"></a>
|
214
214
|
|
215
215
|
<div class="method-heading">
|
216
216
|
|
@@ -232,7 +232,7 @@ passed into the block to allow only certain operations in the block.
|
|
232
232
|
<div class="method-source-code"
|
233
233
|
id="new-source">
|
234
234
|
<pre>
|
235
|
-
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line
|
235
|
+
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line 145</span>
|
236
236
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">method_name</span>)
|
237
237
|
<span class="ruby-ivar">@method_name</span>, <span class="ruby-ivar">@return_value</span>, <span class="ruby-ivar">@super</span>, <span class="ruby-ivar">@block</span>, <span class="ruby-ivar">@error_args</span>, <span class="ruby-ivar">@args</span>, <span class="ruby-ivar">@any_args</span> =
|
238
238
|
<span class="ruby-identifier">method_name</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">nil</span>, [], <span class="ruby-keyword kw">true</span>
|
@@ -252,7 +252,7 @@ passed into the block to allow only certain operations in the block.
|
|
252
252
|
|
253
253
|
|
254
254
|
<div id="build-method" class="method-detail ">
|
255
|
-
<a name="
|
255
|
+
<a name="M000042"></a>
|
256
256
|
|
257
257
|
<div class="method-heading">
|
258
258
|
|
@@ -273,7 +273,7 @@ build up the expectation with the provided arguments
|
|
273
273
|
<div class="method-source-code"
|
274
274
|
id="build-source">
|
275
275
|
<pre>
|
276
|
-
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line
|
276
|
+
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line 153</span>
|
277
277
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build</span>
|
278
278
|
<span class="ruby-constant">Expectation</span>.<span class="ruby-identifier">new</span> <span class="ruby-ivar">@method_name</span>, <span class="ruby-ivar">@args</span>, <span class="ruby-ivar">@error_args</span>, <span class="ruby-ivar">@return_value</span>, <span class="ruby-ivar">@super</span>
|
279
279
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -56,13 +56,13 @@
|
|
56
56
|
|
57
57
|
<li><a href="#M000027">#raise</a></li>
|
58
58
|
|
59
|
-
<li><a href="#
|
59
|
+
<li><a href="#M000026">#return</a></li>
|
60
60
|
|
61
61
|
<li><a href="#M000029">#super_after</a></li>
|
62
62
|
|
63
63
|
<li><a href="#M000028">#super_before</a></li>
|
64
64
|
|
65
|
-
<li><a href="#
|
65
|
+
<li><a href="#M000025">#with</a></li>
|
66
66
|
|
67
67
|
</ul>
|
68
68
|
</div>
|
@@ -222,7 +222,7 @@ for the specified arguments
|
|
222
222
|
<div class="method-source-code"
|
223
223
|
id="any-args--source">
|
224
224
|
<pre>
|
225
|
-
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line
|
225
|
+
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line 74</span>
|
226
226
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">any_args?</span>
|
227
227
|
<span class="ruby-ivar">@any_args</span>
|
228
228
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -257,7 +257,7 @@ arguments
|
|
257
257
|
<div class="method-source-code"
|
258
258
|
id="raise-source">
|
259
259
|
<pre>
|
260
|
-
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line
|
260
|
+
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line 57</span>
|
261
261
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">raise</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
262
262
|
<span class="ruby-ivar">@error_args</span> = <span class="ruby-identifier">args</span>
|
263
263
|
<span class="ruby-keyword kw">self</span>
|
@@ -271,7 +271,7 @@ arguments
|
|
271
271
|
|
272
272
|
|
273
273
|
<div id="return-method" class="method-detail ">
|
274
|
-
<a name="
|
274
|
+
<a name="M000026"></a>
|
275
275
|
|
276
276
|
<div class="method-heading">
|
277
277
|
|
@@ -293,7 +293,7 @@ the block you provide to this method.
|
|
293
293
|
<div class="method-source-code"
|
294
294
|
id="return-source">
|
295
295
|
<pre>
|
296
|
-
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line
|
296
|
+
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line 50</span>
|
297
297
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">return</span>(<span class="ruby-identifier">value</span>=<span class="ruby-keyword kw">nil</span>)
|
298
298
|
<span class="ruby-ivar">@return_value</span> = <span class="ruby-identifier">value</span>
|
299
299
|
<span class="ruby-ivar">@return_value</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword kw">yield</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
@@ -330,7 +330,7 @@ execution
|
|
330
330
|
<div class="method-source-code"
|
331
331
|
id="super-after-source">
|
332
332
|
<pre>
|
333
|
-
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line
|
333
|
+
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line 68</span>
|
334
334
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">super_after</span>
|
335
335
|
<span class="ruby-ivar">@super</span> = <span class="ruby-identifier">:after</span>
|
336
336
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -365,7 +365,7 @@ exectution
|
|
365
365
|
<div class="method-source-code"
|
366
366
|
id="super-before-source">
|
367
367
|
<pre>
|
368
|
-
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line
|
368
|
+
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line 63</span>
|
369
369
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">super_before</span>
|
370
370
|
<span class="ruby-ivar">@super</span> = <span class="ruby-identifier">:before</span>
|
371
371
|
<span class="ruby-keyword kw">end</span></pre>
|
@@ -378,7 +378,7 @@ exectution
|
|
378
378
|
|
379
379
|
|
380
380
|
<div id="with-method" class="method-detail ">
|
381
|
-
<a name="
|
381
|
+
<a name="M000025"></a>
|
382
382
|
|
383
383
|
<div class="method-heading">
|
384
384
|
|
@@ -401,7 +401,7 @@ any arguments
|
|
401
401
|
<div class="method-source-code"
|
402
402
|
id="with-source">
|
403
403
|
<pre>
|
404
|
-
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line
|
404
|
+
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line 42</span>
|
405
405
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">with</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
406
406
|
<span class="ruby-ivar">@any_args</span> = <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:any</span>
|
407
407
|
<span class="ruby-ivar">@args</span> = <span class="ruby-identifier">args</span>
|
@@ -61,9 +61,9 @@
|
|
61
61
|
|
62
62
|
<li><a href="#M000016">::new</a></li>
|
63
63
|
|
64
|
-
<li><a href="#
|
64
|
+
<li><a href="#M000018">#add_expectation</a></li>
|
65
65
|
|
66
|
-
<li><a href="#
|
66
|
+
<li><a href="#M000020">#find</a></li>
|
67
67
|
|
68
68
|
</ul>
|
69
69
|
</div>
|
@@ -225,7 +225,8 @@ initializes a new empty instance of the <tt>Expectation</tt> collection
|
|
225
225
|
<pre>
|
226
226
|
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line 8</span>
|
227
227
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
|
228
|
-
<span class="ruby-ivar">@
|
228
|
+
<span class="ruby-ivar">@instance_expectations</span> = []
|
229
|
+
<span class="ruby-ivar">@class_expectations</span> = []
|
229
230
|
<span class="ruby-keyword kw">end</span></pre>
|
230
231
|
</div>
|
231
232
|
|
@@ -241,13 +242,13 @@ initializes a new empty instance of the <tt>Expectation</tt> collection
|
|
241
242
|
<h3 class="section-header">Public Instance Methods</h3>
|
242
243
|
|
243
244
|
|
244
|
-
<div id="
|
245
|
-
<a name="
|
245
|
+
<div id="add-expectation-method" class="method-detail ">
|
246
|
+
<a name="M000018"></a>
|
246
247
|
|
247
248
|
<div class="method-heading">
|
248
249
|
|
249
|
-
<span class="method-name"
|
250
|
-
class="method-args">(expectation)</span>
|
250
|
+
<span class="method-name">add_expectation</span><span
|
251
|
+
class="method-args">(expectation, mode=:instance)</span>
|
251
252
|
<span class="method-click-advice">click to toggle source</span>
|
252
253
|
|
253
254
|
</div>
|
@@ -262,11 +263,12 @@ collection.
|
|
262
263
|
|
263
264
|
|
264
265
|
<div class="method-source-code"
|
265
|
-
id="
|
266
|
+
id="add-expectation-source">
|
266
267
|
<pre>
|
267
|
-
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line
|
268
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-
|
269
|
-
<span class="ruby-ivar">@
|
268
|
+
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line 14</span>
|
269
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_expectation</span>(<span class="ruby-identifier">expectation</span>, <span class="ruby-identifier">mode</span>=<span class="ruby-identifier">:instance</span>)
|
270
|
+
<span class="ruby-ivar">@instance_expectations</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">expectation</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">mode</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:class</span>
|
271
|
+
<span class="ruby-ivar">@class_expectations</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">expectation</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">mode</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:class</span>
|
270
272
|
<span class="ruby-keyword kw">end</span></pre>
|
271
273
|
</div>
|
272
274
|
|
@@ -277,12 +279,12 @@ collection.
|
|
277
279
|
|
278
280
|
|
279
281
|
<div id="find-method" class="method-detail ">
|
280
|
-
<a name="
|
282
|
+
<a name="M000020"></a>
|
281
283
|
|
282
284
|
<div class="method-heading">
|
283
285
|
|
284
286
|
<span class="method-name">find</span><span
|
285
|
-
class="method-args">(method_name, *args)</span>
|
287
|
+
class="method-args">(method_name, mode=:instance, *args)</span>
|
286
288
|
<span class="method-click-advice">click to toggle source</span>
|
287
289
|
|
288
290
|
</div>
|
@@ -304,9 +306,10 @@ also return the first result it can find.
|
|
304
306
|
<div class="method-source-code"
|
305
307
|
id="find-source">
|
306
308
|
<pre>
|
307
|
-
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line
|
308
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
309
|
-
<span class="ruby-identifier">
|
309
|
+
<span class="ruby-comment cmt"># File lib/caricature/expectation.rb, line 24</span>
|
310
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">mode</span>=<span class="ruby-identifier">:instance</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
311
|
+
<span class="ruby-identifier">expectations</span> = <span class="ruby-identifier">mode</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:class</span> <span class="ruby-operator">?</span> <span class="ruby-ivar">@class_expectations</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@instance_expectations</span>
|
312
|
+
<span class="ruby-identifier">candidates</span> = <span class="ruby-identifier">expectations</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">exp</span><span class="ruby-operator">|</span> <span class="ruby-identifier">exp</span>.<span class="ruby-identifier">method_name</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">to_sym</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">method_name</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">to_sym</span> }
|
310
313
|
<span class="ruby-identifier">is_single</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:any</span> <span class="ruby-operator">||</span> (<span class="ruby-identifier">candidates</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">candidates</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">any_args?</span>)
|
311
314
|
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">candidates</span>.<span class="ruby-identifier">first</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">is_single</span>
|
312
315
|
|