caricature 0.6.3 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/README.rdoc +98 -0
  2. data/Rakefile +250 -47
  3. data/caricature.gemspec +79 -190
  4. data/lib/caricature/clr/descriptor.rb +14 -4
  5. data/lib/caricature/clr/isolation.rb +9 -0
  6. data/lib/caricature/clr/isolator.rb +4 -0
  7. data/lib/caricature/clr/messenger.rb +12 -17
  8. data/lib/caricature/clr.rb +1 -1
  9. data/lib/caricature/descriptor.rb +1 -1
  10. data/lib/caricature/expectation.rb +21 -11
  11. data/lib/caricature/isolation.rb +9 -3
  12. data/lib/caricature/isolator.rb +25 -9
  13. data/lib/caricature/messenger.rb +1 -1
  14. data/lib/caricature/verification.rb +2 -1
  15. data/lib/caricature/version.rb +6 -0
  16. data/lib/caricature.rb +8 -5
  17. data/spec/bacon_helper.rb +50 -30
  18. data/spec/bin/ClrModels.dll +0 -0
  19. data/spec/bin/ClrModels.dll.mdb +0 -0
  20. data/spec/integration/callback_spec.rb +157 -0
  21. data/spec/integration/ruby_to_ruby_spec.rb +12 -1
  22. data/spec/models/ClrModels.cs +8 -8
  23. data/spec/unit/expectation_spec.rb +35 -0
  24. metadata +35 -125
  25. data/.gitignore +0 -4
  26. data/README.markdown +0 -80
  27. data/VERSION +0 -1
  28. data/doc/Array.html +0 -251
  29. data/doc/Caricature/ArgumentRecording.html +0 -366
  30. data/doc/Caricature/ClrClassDescriptor.html +0 -303
  31. data/doc/Caricature/ClrClassMessenger.html +0 -263
  32. data/doc/Caricature/ClrInterfaceDescriptor.html +0 -295
  33. data/doc/Caricature/ClrInterfaceIsolator.html +0 -365
  34. data/doc/Caricature/ClrInterfaceMessenger.html +0 -260
  35. data/doc/Caricature/ClrIsolator.html +0 -425
  36. data/doc/Caricature/Expectation.html +0 -549
  37. data/doc/Caricature/ExpectationBuilder.html +0 -308
  38. data/doc/Caricature/ExpectationSyntax.html +0 -466
  39. data/doc/Caricature/Expectations.html +0 -347
  40. data/doc/Caricature/Interception/ClassMethods.html +0 -364
  41. data/doc/Caricature/Interception.html +0 -534
  42. data/doc/Caricature/Isolation.html +0 -763
  43. data/doc/Caricature/Isolator.html +0 -519
  44. data/doc/Caricature/MemberDescriptor.html +0 -335
  45. data/doc/Caricature/Messenger.html +0 -413
  46. data/doc/Caricature/MethodCallRecorder.html +0 -404
  47. data/doc/Caricature/MethodCallRecording.html +0 -493
  48. data/doc/Caricature/RubyIsolator.html +0 -416
  49. data/doc/Caricature/RubyMessenger.html +0 -261
  50. data/doc/Caricature/RubyObjectDescriptor.html +0 -289
  51. data/doc/Caricature/TypeDescriptor.html +0 -378
  52. data/doc/Caricature/Verification.html +0 -443
  53. data/doc/Caricature.html +0 -358
  54. data/doc/Class.html +0 -287
  55. data/doc/Hash.html +0 -255
  56. data/doc/Module.html +0 -287
  57. data/doc/Object.html +0 -409
  58. data/doc/README_markdown.html +0 -241
  59. data/doc/String.html +0 -369
  60. data/doc/System/String.html +0 -289
  61. data/doc/System/Type.html +0 -289
  62. data/doc/System.html +0 -207
  63. data/doc/created.rid +0 -1
  64. data/doc/images/brick.png +0 -0
  65. data/doc/images/brick_link.png +0 -0
  66. data/doc/images/bug.png +0 -0
  67. data/doc/images/bullet_black.png +0 -0
  68. data/doc/images/bullet_toggle_minus.png +0 -0
  69. data/doc/images/bullet_toggle_plus.png +0 -0
  70. data/doc/images/date.png +0 -0
  71. data/doc/images/find.png +0 -0
  72. data/doc/images/loadingAnimation.gif +0 -0
  73. data/doc/images/macFFBgHack.png +0 -0
  74. data/doc/images/package.png +0 -0
  75. data/doc/images/page_green.png +0 -0
  76. data/doc/images/page_white_text.png +0 -0
  77. data/doc/images/page_white_width.png +0 -0
  78. data/doc/images/plugin.png +0 -0
  79. data/doc/images/ruby.png +0 -0
  80. data/doc/images/tag_green.png +0 -0
  81. data/doc/images/wrench.png +0 -0
  82. data/doc/images/wrench_orange.png +0 -0
  83. data/doc/images/zoom.png +0 -0
  84. data/doc/index.html +0 -342
  85. data/doc/js/darkfish.js +0 -116
  86. data/doc/js/jquery.js +0 -32
  87. data/doc/js/quicksearch.js +0 -114
  88. data/doc/js/thickbox-compressed.js +0 -10
  89. data/doc/lib/caricature/clr/aspnet_mvc_rb.html +0 -52
  90. data/doc/lib/caricature/clr/descriptor_rb.html +0 -52
  91. data/doc/lib/caricature/clr/isolation_rb.html +0 -52
  92. data/doc/lib/caricature/clr/isolator_rb.html +0 -52
  93. data/doc/lib/caricature/clr/messenger_rb.html +0 -52
  94. data/doc/lib/caricature/clr_rb.html +0 -52
  95. data/doc/lib/caricature/descriptor_rb.html +0 -52
  96. data/doc/lib/caricature/expectation_rb.html +0 -52
  97. data/doc/lib/caricature/isolation_rb.html +0 -52
  98. data/doc/lib/caricature/isolator_rb.html +0 -52
  99. data/doc/lib/caricature/messaging_rb.html +0 -52
  100. data/doc/lib/caricature/messenger_rb.html +0 -52
  101. data/doc/lib/caricature/method_call_recorder_rb.html +0 -52
  102. data/doc/lib/caricature/verification_rb.html +0 -52
  103. data/doc/lib/caricature_rb.html +0 -52
  104. data/doc/lib/core_ext/array_rb.html +0 -52
  105. data/doc/lib/core_ext/class_rb.html +0 -52
  106. data/doc/lib/core_ext/core_ext_rb.html +0 -52
  107. data/doc/lib/core_ext/hash_rb.html +0 -52
  108. data/doc/lib/core_ext/module_rb.html +0 -52
  109. data/doc/lib/core_ext/object_rb.html +0 -52
  110. data/doc/lib/core_ext/string_rb.html +0 -52
  111. data/doc/lib/core_ext/system/string_rb.html +0 -52
  112. data/doc/lib/core_ext/system/type_rb.html +0 -52
  113. data/doc/rdoc.css +0 -696
  114. data/irb_init.rb +0 -9
  115. data/lib/bin/Workarounds.dll +0 -0
  116. data/lib/bin/Workarounds.pdb +0 -0
  117. data/pkg/.gitignore +0 -0
  118. data/pkg/caricature-0.1.0.gem +0 -0
  119. data/pkg/caricature-0.5.0.gem +0 -0
  120. data/pkg/caricature-0.6.0.gem +0 -0
  121. data/spec/bin/.gitignore +0 -0
  122. data/workarounds/ReflectionHelper.cs +0 -30
@@ -1,763 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
- <head>
6
- <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
7
-
8
- <title>Class: Caricature::Isolation</title>
9
-
10
- <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
-
12
- <script src="../js/jquery.js" type="text/javascript"
13
- charset="utf-8"></script>
14
- <script src="../js/thickbox-compressed.js" type="text/javascript"
15
- charset="utf-8"></script>
16
- <script src="../js/quicksearch.js" type="text/javascript"
17
- charset="utf-8"></script>
18
- <script src="../js/darkfish.js" type="text/javascript"
19
- charset="utf-8"></script>
20
-
21
- </head>
22
- <body class="class">
23
-
24
- <div id="metadata">
25
- <div id="file-metadata">
26
- <div id="file-list-section" class="section">
27
- <h3 class="section-header">In Files</h3>
28
- <div class="section-body">
29
- <ul>
30
-
31
- <li><a href="../lib/caricature/clr/isolation_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
32
- class="thickbox" title="lib/caricature/clr/isolation.rb">lib/caricature/clr/isolation.rb</a></li>
33
-
34
- <li><a href="../lib/caricature/isolation_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
35
- class="thickbox" title="lib/caricature/isolation.rb">lib/caricature/isolation.rb</a></li>
36
-
37
- </ul>
38
- </div>
39
- </div>
40
-
41
-
42
- </div>
43
-
44
- <div id="class-metadata">
45
-
46
- <!-- Parent Class -->
47
-
48
- <div id="parent-class-section" class="section">
49
- <h3 class="section-header">Parent</h3>
50
-
51
- <p class="link"><a href="../Object.html">Object</a></p>
52
-
53
- </div>
54
-
55
-
56
- <!-- Namespace Contents -->
57
-
58
-
59
- <!-- Method Quickref -->
60
-
61
- <div id="method-list-section" class="section">
62
- <h3 class="section-header">Methods</h3>
63
- <ul class="link-list">
64
-
65
- <li><a href="#M000008">::for</a></li>
66
-
67
- <li><a href="#M000050">::for</a></li>
68
-
69
- <li><a href="#M000009">::get_clr_isolation_strategy</a></li>
70
-
71
- <li><a href="#M000036">::new</a></li>
72
-
73
- <li><a href="#M000048">#class_verify</a></li>
74
-
75
- <li><a href="#M000046">#create_class_override</a></li>
76
-
77
- <li><a href="#M000043">#create_override</a></li>
78
-
79
- <li><a href="#M000052">#internal_create_override</a></li>
80
-
81
- <li><a href="#M000053">#internal_verify</a></li>
82
-
83
- <li><a href="#M000039">#send_class_message</a></li>
84
-
85
- <li><a href="#M000037">#send_message</a></li>
86
-
87
- <li><a href="#M000047">#verify</a></li>
88
-
89
- </ul>
90
- </div>
91
-
92
-
93
- <!-- Included Modules -->
94
-
95
- </div>
96
-
97
- <div id="project-metadata">
98
-
99
-
100
- <div id="fileindex-section" class="section project-section">
101
- <h3 class="section-header">Files</h3>
102
- <ul>
103
-
104
- <li class="file"><a href="../README_markdown.html">README.markdown</a></li>
105
-
106
- </ul>
107
- </div>
108
-
109
-
110
- <div id="classindex-section" class="section project-section">
111
- <h3 class="section-header">Class Index
112
- <span class="search-toggle"><img src="../images/find.png"
113
- height="16" width="16" alt="[+]"
114
- title="show/hide quicksearch" /></span></h3>
115
- <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
116
- <fieldset>
117
- <legend>Quicksearch</legend>
118
- <input type="text" name="quicksearch" value=""
119
- class="quicksearch-field" />
120
- </fieldset>
121
- </form>
122
-
123
- <ul class="link-list">
124
-
125
- <li><a href="../Caricature.html">Caricature</a></li>
126
-
127
- <li><a href="../Caricature/ArgumentRecording.html">Caricature::ArgumentRecording</a></li>
128
-
129
- <li><a href="../Caricature/ClrClassDescriptor.html">Caricature::ClrClassDescriptor</a></li>
130
-
131
- <li><a href="../Caricature/ClrClassMessenger.html">Caricature::ClrClassMessenger</a></li>
132
-
133
- <li><a href="../Caricature/ClrInterfaceDescriptor.html">Caricature::ClrInterfaceDescriptor</a></li>
134
-
135
- <li><a href="../Caricature/ClrInterfaceIsolator.html">Caricature::ClrInterfaceIsolator</a></li>
136
-
137
- <li><a href="../Caricature/ClrInterfaceMessenger.html">Caricature::ClrInterfaceMessenger</a></li>
138
-
139
- <li><a href="../Caricature/ClrIsolator.html">Caricature::ClrIsolator</a></li>
140
-
141
- <li><a href="../Caricature/Expectation.html">Caricature::Expectation</a></li>
142
-
143
- <li><a href="../Caricature/ExpectationBuilder.html">Caricature::ExpectationBuilder</a></li>
144
-
145
- <li><a href="../Caricature/ExpectationSyntax.html">Caricature::ExpectationSyntax</a></li>
146
-
147
- <li><a href="../Caricature/Expectations.html">Caricature::Expectations</a></li>
148
-
149
- <li><a href="../Caricature/Interception.html">Caricature::Interception</a></li>
150
-
151
- <li><a href="../Caricature/Interception/ClassMethods.html">Caricature::Interception::ClassMethods</a></li>
152
-
153
- <li><a href="../Caricature/Isolation.html">Caricature::Isolation</a></li>
154
-
155
- <li><a href="../Caricature/Isolator.html">Caricature::Isolator</a></li>
156
-
157
- <li><a href="../Caricature/MemberDescriptor.html">Caricature::MemberDescriptor</a></li>
158
-
159
- <li><a href="../Caricature/Messenger.html">Caricature::Messenger</a></li>
160
-
161
- <li><a href="../Caricature/MethodCallRecorder.html">Caricature::MethodCallRecorder</a></li>
162
-
163
- <li><a href="../Caricature/MethodCallRecording.html">Caricature::MethodCallRecording</a></li>
164
-
165
- <li><a href="../Caricature/RubyIsolator.html">Caricature::RubyIsolator</a></li>
166
-
167
- <li><a href="../Caricature/RubyMessenger.html">Caricature::RubyMessenger</a></li>
168
-
169
- <li><a href="../Caricature/RubyObjectDescriptor.html">Caricature::RubyObjectDescriptor</a></li>
170
-
171
- <li><a href="../Caricature/TypeDescriptor.html">Caricature::TypeDescriptor</a></li>
172
-
173
- <li><a href="../Caricature/Verification.html">Caricature::Verification</a></li>
174
-
175
- <li><a href="../System.html">System</a></li>
176
-
177
- <li><a href="../System/String.html">System::String</a></li>
178
-
179
- <li><a href="../System/Type.html">System::Type</a></li>
180
-
181
- <li><a href="../Array.html">Array</a></li>
182
-
183
- <li><a href="../Class.html">Class</a></li>
184
-
185
- <li><a href="../Hash.html">Hash</a></li>
186
-
187
- <li><a href="../Module.html">Module</a></li>
188
-
189
- <li><a href="../Object.html">Object</a></li>
190
-
191
- <li><a href="../String.html">String</a></li>
192
-
193
- </ul>
194
- <div id="no-class-search-results" style="display: none;">No matching classes.</div>
195
- </div>
196
-
197
-
198
- </div>
199
- </div>
200
-
201
- <div id="documentation">
202
- <h1 class="class">Caricature::Isolation</h1>
203
-
204
- <div id="description">
205
- <p>
206
- Instead of using confusing terms like Mocking and Stubbing which is
207
- basically the same. <a href="../Caricature.html">Caricature</a> tries to
208
- unify those concepts by using a term of <b>Isolation</b>. When you&#8217;re
209
- testing you typically want to be in control of what you&#8217;re testing.
210
- To do that you isolate dependencies and possibly define return values for
211
- methods on them. At a later stage you might be interested in which method
212
- was called, maybe even with which parameters or you might be interested in
213
- the amount of times it has been called.
214
- </p>
215
-
216
- </div>
217
-
218
- <!-- Constants -->
219
-
220
-
221
- <!-- Attributes -->
222
-
223
- <div id="attribute-method-details" class="method-section section">
224
- <h3 class="section-header">Attributes</h3>
225
-
226
-
227
- <div id="instance-attribute-method" class="method-detail">
228
- <a name="instance"></a>
229
-
230
- <div class="method-heading attribute-method-heading">
231
- <span class="method-name">instance</span><span
232
- class="attribute-access-type">[R]</span>
233
- </div>
234
-
235
- <div class="method-description">
236
-
237
- <p>
238
- the real instance of the isolated subject used to forward calls in partial
239
- mocks
240
- </p>
241
-
242
- </div>
243
- </div>
244
-
245
- <div id="recorder-attribute-method" class="method-detail">
246
- <a name="recorder"></a>
247
-
248
- <div class="method-heading attribute-method-heading">
249
- <span class="method-name">recorder</span><span
250
- class="attribute-access-type">[R]</span>
251
- </div>
252
-
253
- <div class="method-description">
254
-
255
- <p>
256
- the method call recorder
257
- </p>
258
-
259
- </div>
260
- </div>
261
-
262
- <div id="expectations-attribute-method" class="method-detail">
263
- <a name="expectations"></a>
264
-
265
- <div class="method-heading attribute-method-heading">
266
- <span class="method-name">expectations</span><span
267
- class="attribute-access-type">[R]</span>
268
- </div>
269
-
270
- <div class="method-description">
271
-
272
- <p>
273
- the expecations set for this isolation
274
- </p>
275
-
276
- </div>
277
- </div>
278
-
279
- </div>
280
-
281
-
282
- <!-- Methods -->
283
-
284
- <div id="public-class-method-details" class="method-section section">
285
- <h3 class="section-header">Public Class Methods</h3>
286
-
287
-
288
- <div id="for-method" class="method-detail ">
289
- <a name="M000008"></a>
290
-
291
- <div class="method-heading">
292
-
293
- <span class="method-name">for</span><span
294
- class="method-args">(subject, recorder = MethodCallRecorder.new, expectations = Expectations.new)</span>
295
- <span class="method-click-advice">click to toggle source</span>
296
-
297
- </div>
298
-
299
- <div class="method-description">
300
-
301
- <p>
302
- Creates an isolation object complete with proxy and method call recorder It
303
- works out which isolation it needs to create and provide and initializes
304
- the method call recorder
305
- </p>
306
-
307
-
308
-
309
- <div class="method-source-code"
310
- id="for-source">
311
- <pre>
312
- <span class="ruby-comment cmt"># File lib/caricature/clr/isolation.rb, line 10</span>
313
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">for</span>(<span class="ruby-identifier">subject</span>, <span class="ruby-identifier">recorder</span> = <span class="ruby-constant">MethodCallRecorder</span>.<span class="ruby-identifier">new</span>, <span class="ruby-identifier">expectations</span> = <span class="ruby-constant">Expectations</span>.<span class="ruby-identifier">new</span>)
314
- <span class="ruby-identifier">context</span> = <span class="ruby-constant">IsolatorContext</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">subject</span>, <span class="ruby-identifier">recorder</span>, <span class="ruby-identifier">expectations</span>
315
- <span class="ruby-identifier">isolation_strategy</span> = <span class="ruby-identifier">subject</span>.<span class="ruby-identifier">is_clr_type?</span> <span class="ruby-value">? </span><span class="ruby-identifier">get_clr_isolation_strategy</span>(<span class="ruby-identifier">subject</span>) <span class="ruby-operator">:</span> <span class="ruby-constant">RubyIsolator</span>
316
-
317
- <span class="ruby-identifier">isolator</span> = <span class="ruby-identifier">isolation_strategy</span>.<span class="ruby-identifier">for</span> <span class="ruby-identifier">context</span>
318
- <span class="ruby-identifier">isolation</span> = <span class="ruby-identifier">new</span>(<span class="ruby-identifier">isolator</span>, <span class="ruby-identifier">context</span>)
319
- <span class="ruby-identifier">isolator</span>.<span class="ruby-identifier">isolation</span>
320
- <span class="ruby-keyword kw">end</span></pre>
321
- </div>
322
-
323
- </div>
324
-
325
-
326
- </div>
327
-
328
-
329
- <div id="for-method" class="method-detail ">
330
- <a name="M000050"></a>
331
-
332
- <div class="method-heading">
333
-
334
- <span class="method-name">for</span><span
335
- class="method-args">(subject, recorder = MethodCallRecorder.new, expectations = Expectations.new)</span>
336
- <span class="method-click-advice">click to toggle source</span>
337
-
338
- </div>
339
-
340
- <div class="method-description">
341
-
342
- <p>
343
- Creates an isolation object complete with proxy and method call recorder It
344
- works out which isolation it needs to create and provide and initializes
345
- the method call recorder
346
- </p>
347
-
348
-
349
-
350
- <div class="method-source-code"
351
- id="for-source">
352
- <pre>
353
- <span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line 113</span>
354
- <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">for</span>(<span class="ruby-identifier">subject</span>, <span class="ruby-identifier">recorder</span> = <span class="ruby-constant">MethodCallRecorder</span>.<span class="ruby-identifier">new</span>, <span class="ruby-identifier">expectations</span> = <span class="ruby-constant">Expectations</span>.<span class="ruby-identifier">new</span>)
355
- <span class="ruby-identifier">context</span> = <span class="ruby-constant">IsolatorContext</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">subject</span>, <span class="ruby-identifier">recorder</span>, <span class="ruby-identifier">expectations</span>
356
-
357
- <span class="ruby-identifier">isolator</span> = <span class="ruby-constant">RubyIsolator</span>.<span class="ruby-identifier">for</span> <span class="ruby-identifier">context</span>
358
- <span class="ruby-identifier">isolation</span> = <span class="ruby-identifier">new</span>(<span class="ruby-identifier">isolator</span>, <span class="ruby-identifier">context</span>)
359
- <span class="ruby-identifier">isolator</span>.<span class="ruby-identifier">isolation</span>
360
- <span class="ruby-keyword kw">end</span></pre>
361
- </div>
362
-
363
- </div>
364
-
365
-
366
- </div>
367
-
368
-
369
- <div id="new-method" class="method-detail ">
370
- <a name="M000036"></a>
371
-
372
- <div class="method-heading">
373
-
374
- <span class="method-name">new</span><span
375
- class="method-args">(isolator, context)</span>
376
- <span class="method-click-advice">click to toggle source</span>
377
-
378
- </div>
379
-
380
- <div class="method-description">
381
-
382
- <p>
383
- Initializes a new instance of this isolation.
384
- </p>
385
-
386
-
387
-
388
- <div class="method-source-code"
389
- id="new-source">
390
- <pre>
391
- <span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line 65</span>
392
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">isolator</span>, <span class="ruby-identifier">context</span>)
393
- <span class="ruby-ivar">@instance</span> = <span class="ruby-identifier">isolator</span>.<span class="ruby-identifier">subject</span>
394
- <span class="ruby-ivar">@recorder</span> = <span class="ruby-identifier">context</span>.<span class="ruby-identifier">recorder</span>
395
- <span class="ruby-ivar">@messenger</span> = <span class="ruby-identifier">context</span>.<span class="ruby-identifier">messenger</span>
396
- <span class="ruby-ivar">@expectations</span> = <span class="ruby-identifier">context</span>.<span class="ruby-identifier">expectations</span>
397
- <span class="ruby-identifier">isolator</span>.<span class="ruby-identifier">isolation</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-value str">&quot;@___context___&quot;</span>, <span class="ruby-keyword kw">self</span>)
398
- <span class="ruby-keyword kw">end</span></pre>
399
- </div>
400
-
401
- </div>
402
-
403
-
404
- </div>
405
-
406
-
407
- </div>
408
-
409
- <div id="private-class-method-details" class="method-section section">
410
- <h3 class="section-header">Private Class Methods</h3>
411
-
412
-
413
- <div id="get-clr-isolation-strategy-method" class="method-detail ">
414
- <a name="M000009"></a>
415
-
416
- <div class="method-heading">
417
-
418
- <span class="method-name">get_clr_isolation_strategy</span><span
419
- class="method-args">(subject)</span>
420
- <span class="method-click-advice">click to toggle source</span>
421
-
422
- </div>
423
-
424
- <div class="method-description">
425
-
426
- <p>
427
- decides which startegy to use for mocking a CLR object. When the provided
428
- subject is an interface it will return a <tt>ClrInterfaceIsolator</tt>
429
- otherwise it will return a <tt>ClrIsolator</tt>
430
- </p>
431
-
432
-
433
-
434
- <div class="method-source-code"
435
- id="get-clr-isolation-strategy-source">
436
- <pre>
437
- <span class="ruby-comment cmt"># File lib/caricature/clr/isolation.rb, line 24</span>
438
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_clr_isolation_strategy</span>(<span class="ruby-identifier">subject</span>)
439
- <span class="ruby-keyword kw">return</span> <span class="ruby-constant">ClrInterfaceIsolator</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">subject</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:class_eval</span> <span class="ruby-keyword kw">and</span> <span class="ruby-operator">!</span><span class="ruby-identifier">subject</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:new</span>
440
- <span class="ruby-constant">ClrIsolator</span>
441
- <span class="ruby-keyword kw">end</span></pre>
442
- </div>
443
-
444
- </div>
445
-
446
-
447
- </div>
448
-
449
-
450
- </div>
451
-
452
- <div id="public-instance-method-details" class="method-section section">
453
- <h3 class="section-header">Public Instance Methods</h3>
454
-
455
-
456
- <div id="class-verify-method" class="method-detail ">
457
- <a name="M000048"></a>
458
-
459
- <div class="method-heading">
460
-
461
- <span class="method-name">class_verify</span><span
462
- class="method-args">(method_name, &block)</span>
463
- <span class="method-click-advice">click to toggle source</span>
464
-
465
- </div>
466
-
467
- <div class="method-description">
468
-
469
- <p>
470
- asserts whether the method has been called for the specified configuration
471
- </p>
472
-
473
-
474
-
475
- <div class="method-source-code"
476
- id="class-verify-source">
477
- <pre>
478
- <span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line 104</span>
479
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">class_verify</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
480
- <span class="ruby-identifier">internal_verify</span> <span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">:class</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
481
- <span class="ruby-keyword kw">end</span></pre>
482
- </div>
483
-
484
- </div>
485
-
486
-
487
- </div>
488
-
489
-
490
- <div id="create-class-override-method" class="method-detail ">
491
- <a name="M000046"></a>
492
-
493
- <div class="method-heading">
494
-
495
- <span class="method-name">create_class_override</span><span
496
- class="method-args">(method_name, &block)</span>
497
- <span class="method-click-advice">click to toggle source</span>
498
-
499
- </div>
500
-
501
- <div class="method-description">
502
-
503
- <p>
504
- builds up an expectation for a class method, allows for overriding the
505
- result returned by the class method
506
- </p>
507
-
508
-
509
-
510
- <div class="method-source-code"
511
- id="create-class-override-source">
512
- <pre>
513
- <span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line 93</span>
514
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_class_override</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
515
- <span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;creating override&quot;</span>
516
- <span class="ruby-identifier">internal_create_override</span> <span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">:class</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
517
- <span class="ruby-keyword kw">end</span></pre>
518
- </div>
519
-
520
- </div>
521
-
522
-
523
- </div>
524
-
525
-
526
- <div id="create-override-method" class="method-detail ">
527
- <a name="M000043"></a>
528
-
529
- <div class="method-heading">
530
-
531
- <span class="method-name">create_override</span><span
532
- class="method-args">(method_name, &block)</span>
533
- <span class="method-click-advice">click to toggle source</span>
534
-
535
- </div>
536
-
537
- <div class="method-description">
538
-
539
- <p>
540
- builds up an expectation for an instance method, allows for overriding the
541
- result returned by the method
542
- </p>
543
-
544
-
545
-
546
- <div class="method-source-code"
547
- id="create-override-source">
548
- <pre>
549
- <span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line 88</span>
550
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_override</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
551
- <span class="ruby-identifier">internal_create_override</span> <span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">:instance</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
552
- <span class="ruby-keyword kw">end</span></pre>
553
- </div>
554
-
555
- </div>
556
-
557
-
558
- </div>
559
-
560
-
561
- <div id="send-class-message-method" class="method-detail ">
562
- <a name="M000039"></a>
563
-
564
- <div class="method-heading">
565
-
566
- <span class="method-name">send_class_message</span><span
567
- class="method-args">(method_name, return_type, *args, &b)</span>
568
- <span class="method-click-advice">click to toggle source</span>
569
-
570
- </div>
571
-
572
- <div class="method-description">
573
-
574
- <p>
575
- record and send the message to the isolation. takes care of following
576
- expectations rules when sending messages.
577
- </p>
578
-
579
-
580
-
581
- <div class="method-source-code"
582
- id="send-class-message-source">
583
- <pre>
584
- <span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line 82</span>
585
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_class_message</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">&amp;</span><span class="ruby-identifier">b</span>)
586
- <span class="ruby-identifier">recorder</span>.<span class="ruby-identifier">record_call</span> <span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">:class</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>
587
- <span class="ruby-ivar">@messenger</span>.<span class="ruby-identifier">deliver_to_class</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">&amp;</span><span class="ruby-identifier">b</span>)
588
- <span class="ruby-keyword kw">end</span></pre>
589
- </div>
590
-
591
- </div>
592
-
593
-
594
- </div>
595
-
596
-
597
- <div id="send-message-method" class="method-detail ">
598
- <a name="M000037"></a>
599
-
600
- <div class="method-heading">
601
-
602
- <span class="method-name">send_message</span><span
603
- class="method-args">(method_name, return_type, *args, &b)</span>
604
- <span class="method-click-advice">click to toggle source</span>
605
-
606
- </div>
607
-
608
- <div class="method-description">
609
-
610
- <p>
611
- record and send the message to the isolation. takes care of following
612
- expectations rules when sending messages.
613
- </p>
614
-
615
-
616
-
617
- <div class="method-source-code"
618
- id="send-message-source">
619
- <pre>
620
- <span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line 75</span>
621
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_message</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">&amp;</span><span class="ruby-identifier">b</span>)
622
- <span class="ruby-identifier">recorder</span>.<span class="ruby-identifier">record_call</span> <span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">:instance</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>
623
- <span class="ruby-ivar">@messenger</span>.<span class="ruby-identifier">deliver</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">&amp;</span><span class="ruby-identifier">b</span>)
624
- <span class="ruby-keyword kw">end</span></pre>
625
- </div>
626
-
627
- </div>
628
-
629
-
630
- </div>
631
-
632
-
633
- <div id="verify-method" class="method-detail ">
634
- <a name="M000047"></a>
635
-
636
- <div class="method-heading">
637
-
638
- <span class="method-name">verify</span><span
639
- class="method-args">(method_name, &block)</span>
640
- <span class="method-click-advice">click to toggle source</span>
641
-
642
- </div>
643
-
644
- <div class="method-description">
645
-
646
- <p>
647
- asserts whether the method has been called for the specified configuration
648
- </p>
649
-
650
-
651
-
652
- <div class="method-source-code"
653
- id="verify-source">
654
- <pre>
655
- <span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line 99</span>
656
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">verify</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
657
- <span class="ruby-identifier">internal_verify</span> <span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">:instance</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>
658
- <span class="ruby-keyword kw">end</span></pre>
659
- </div>
660
-
661
- </div>
662
-
663
-
664
- </div>
665
-
666
-
667
- </div>
668
-
669
- <div id="protected-instance-method-details" class="method-section section">
670
- <h3 class="section-header">Protected Instance Methods</h3>
671
-
672
-
673
- <div id="internal-create-override-method" class="method-detail ">
674
- <a name="M000052"></a>
675
-
676
- <div class="method-heading">
677
-
678
- <span class="method-name">internal_create_override</span><span
679
- class="method-args">(method_name, mode=:instance, &block)</span>
680
- <span class="method-click-advice">click to toggle source</span>
681
-
682
- </div>
683
-
684
- <div class="method-description">
685
-
686
- <p class="missing-docs">(Not documented)</p>
687
-
688
-
689
-
690
- <div class="method-source-code"
691
- id="internal-create-override-source">
692
- <pre>
693
- <span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line 125</span>
694
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">internal_create_override</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">mode</span>=<span class="ruby-identifier">:instance</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
695
- <span class="ruby-identifier">builder</span> = <span class="ruby-constant">ExpectationBuilder</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">method_name</span>
696
- <span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span> <span class="ruby-identifier">builder</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">nil?</span>
697
- <span class="ruby-identifier">exp</span> = <span class="ruby-identifier">builder</span>.<span class="ruby-identifier">build</span>
698
- <span class="ruby-identifier">expectations</span>.<span class="ruby-identifier">add_expectation</span> <span class="ruby-identifier">exp</span>, <span class="ruby-identifier">mode</span>
699
- <span class="ruby-identifier">exp</span>
700
- <span class="ruby-keyword kw">end</span></pre>
701
- </div>
702
-
703
- </div>
704
-
705
-
706
- </div>
707
-
708
-
709
- <div id="internal-verify-method" class="method-detail ">
710
- <a name="M000053"></a>
711
-
712
- <div class="method-heading">
713
-
714
- <span class="method-name">internal_verify</span><span
715
- class="method-args">(method_name, mode=:instance, &block)</span>
716
- <span class="method-click-advice">click to toggle source</span>
717
-
718
- </div>
719
-
720
- <div class="method-description">
721
-
722
- <p class="missing-docs">(Not documented)</p>
723
-
724
-
725
-
726
- <div class="method-source-code"
727
- id="internal-verify-source">
728
- <pre>
729
- <span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line 133</span>
730
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">internal_verify</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">mode</span>=<span class="ruby-identifier">:instance</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
731
- <span class="ruby-identifier">verification</span> = <span class="ruby-constant">Verification</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-identifier">recorder</span>, <span class="ruby-identifier">mode</span>)
732
- <span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span> <span class="ruby-identifier">verification</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">nil?</span>
733
- <span class="ruby-identifier">verification</span>
734
- <span class="ruby-keyword kw">end</span></pre>
735
- </div>
736
-
737
- </div>
738
-
739
-
740
- </div>
741
-
742
-
743
- </div>
744
-
745
-
746
- </div>
747
-
748
-
749
- <div id="rdoc-debugging-section-dump" class="debugging-section">
750
-
751
- <p>Disabled; run with --debug to generate this.</p>
752
-
753
- </div>
754
-
755
- <div id="validator-badges">
756
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
757
- <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
758
- Rdoc Generator</a> 1.1.6</small>.</p>
759
- </div>
760
-
761
- </body>
762
- </html>
763
-