caricature 0.3.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. data/.gitignore +4 -0
  2. data/Rakefile +100 -0
  3. data/VERSION +1 -0
  4. data/caricature.gemspec +177 -0
  5. data/doc/Array.html +251 -0
  6. data/doc/Caricature/ArgumentRecording.html +366 -0
  7. data/doc/Caricature/ClrClassDescriptor.html +303 -0
  8. data/doc/Caricature/ClrClassMessenger.html +263 -0
  9. data/doc/Caricature/ClrInterfaceDescriptor.html +295 -0
  10. data/doc/Caricature/ClrInterfaceIsolator.html +365 -0
  11. data/doc/Caricature/ClrInterfaceMessenger.html +260 -0
  12. data/doc/Caricature/ClrIsolator.html +424 -0
  13. data/doc/Caricature/Expectation.html +549 -0
  14. data/doc/Caricature/ExpectationBuilder.html +308 -0
  15. data/doc/Caricature/ExpectationSyntax.html +438 -0
  16. data/doc/Caricature/Expectations.html +344 -0
  17. data/doc/Caricature/Interception/ClassMethods.html +246 -0
  18. data/doc/Caricature/Interception.html +416 -0
  19. data/doc/Caricature/Isolation.html +578 -0
  20. data/doc/Caricature/Isolator.html +519 -0
  21. data/doc/Caricature/MemberDescriptor.html +335 -0
  22. data/doc/Caricature/Messenger.html +335 -0
  23. data/doc/Caricature/MethodCallRecorder.html +440 -0
  24. data/doc/Caricature/MethodCallRecording.html +493 -0
  25. data/doc/Caricature/RubyIsolator.html +416 -0
  26. data/doc/Caricature/RubyMessenger.html +260 -0
  27. data/doc/Caricature/RubyObjectDescriptor.html +289 -0
  28. data/doc/Caricature/TypeDescriptor.html +378 -0
  29. data/doc/Caricature/Verification.html +443 -0
  30. data/doc/Caricature.html +358 -0
  31. data/doc/Class.html +287 -0
  32. data/doc/Hash.html +255 -0
  33. data/doc/Module.html +287 -0
  34. data/doc/Object.html +322 -0
  35. data/doc/README_markdown.html +241 -0
  36. data/doc/String.html +289 -0
  37. data/doc/System/String.html +289 -0
  38. data/doc/System/Type.html +289 -0
  39. data/doc/System.html +207 -0
  40. data/doc/created.rid +1 -0
  41. data/doc/images/brick.png +0 -0
  42. data/doc/images/brick_link.png +0 -0
  43. data/doc/images/bug.png +0 -0
  44. data/doc/images/bullet_black.png +0 -0
  45. data/doc/images/bullet_toggle_minus.png +0 -0
  46. data/doc/images/bullet_toggle_plus.png +0 -0
  47. data/doc/images/date.png +0 -0
  48. data/doc/images/find.png +0 -0
  49. data/doc/images/loadingAnimation.gif +0 -0
  50. data/doc/images/macFFBgHack.png +0 -0
  51. data/doc/images/package.png +0 -0
  52. data/doc/images/page_green.png +0 -0
  53. data/doc/images/page_white_text.png +0 -0
  54. data/doc/images/page_white_width.png +0 -0
  55. data/doc/images/plugin.png +0 -0
  56. data/doc/images/ruby.png +0 -0
  57. data/doc/images/tag_green.png +0 -0
  58. data/doc/images/wrench.png +0 -0
  59. data/doc/images/wrench_orange.png +0 -0
  60. data/doc/images/zoom.png +0 -0
  61. data/doc/index.html +312 -0
  62. data/doc/js/darkfish.js +116 -0
  63. data/doc/js/jquery.js +32 -0
  64. data/doc/js/quicksearch.js +114 -0
  65. data/doc/js/thickbox-compressed.js +10 -0
  66. data/doc/lib/caricature/clr/descriptor_rb.html +52 -0
  67. data/doc/lib/caricature/clr/isolation_rb.html +52 -0
  68. data/doc/lib/caricature/clr/isolator_rb.html +52 -0
  69. data/doc/lib/caricature/clr/messenger_rb.html +52 -0
  70. data/doc/lib/caricature/clr_rb.html +52 -0
  71. data/doc/lib/caricature/descriptor_rb.html +52 -0
  72. data/doc/lib/caricature/expectation_rb.html +52 -0
  73. data/doc/lib/caricature/isolation_rb.html +52 -0
  74. data/doc/lib/caricature/isolator_rb.html +52 -0
  75. data/doc/lib/caricature/messaging_rb.html +52 -0
  76. data/doc/lib/caricature/method_call_recorder_rb.html +52 -0
  77. data/doc/lib/caricature/verification_rb.html +52 -0
  78. data/doc/lib/caricature_rb.html +52 -0
  79. data/doc/lib/core_ext/array_rb.html +52 -0
  80. data/doc/lib/core_ext/class_rb.html +52 -0
  81. data/doc/lib/core_ext/core_ext_rb.html +52 -0
  82. data/doc/lib/core_ext/hash_rb.html +52 -0
  83. data/doc/lib/core_ext/module_rb.html +52 -0
  84. data/doc/lib/core_ext/object_rb.html +52 -0
  85. data/doc/lib/core_ext/string_rb.html +52 -0
  86. data/doc/lib/core_ext/system/string_rb.html +52 -0
  87. data/doc/lib/core_ext/system/type_rb.html +52 -0
  88. data/doc/rdoc.css +696 -0
  89. data/irb_init.rb +9 -0
  90. data/lib/bin/Workarounds.dll +0 -0
  91. data/lib/bin/Workarounds.pdb +0 -0
  92. data/lib/caricature/clr/descriptor.rb +55 -0
  93. data/lib/caricature/clr/isolation.rb +33 -0
  94. data/lib/caricature/clr/isolator.rb +112 -0
  95. data/lib/caricature/clr/messenger.rb +46 -0
  96. data/lib/caricature/clr.rb +6 -0
  97. data/lib/caricature/descriptor.rb +74 -0
  98. data/lib/caricature/expectation.rb +159 -0
  99. data/lib/caricature/isolation.rb +146 -0
  100. data/lib/caricature/isolator.rb +287 -0
  101. data/lib/caricature/messenger.rb +57 -0
  102. data/lib/caricature/method_call_recorder.rb +130 -0
  103. data/lib/caricature/verification.rb +43 -0
  104. data/lib/caricature.rb +11 -0
  105. data/lib/core_ext/array.rb +10 -0
  106. data/lib/core_ext/class.rb +15 -0
  107. data/lib/core_ext/core_ext.rb +8 -0
  108. data/lib/core_ext/hash.rb +13 -0
  109. data/lib/core_ext/module.rb +15 -0
  110. data/lib/core_ext/object.rb +19 -0
  111. data/lib/core_ext/string.rb +17 -0
  112. data/lib/core_ext/system/string.rb +21 -0
  113. data/lib/core_ext/system/type.rb +21 -0
  114. data/pkg/.gitignore +0 -0
  115. data/pkg/caricature-0.1.0.gem +0 -0
  116. data/spec/bacon_helper.rb +49 -3
  117. data/spec/bin/.gitignore +0 -0
  118. data/spec/core_ext_spec.rb +9 -0
  119. data/spec/descriptor_spec.rb +142 -0
  120. data/spec/expectation_spec.rb +11 -7
  121. data/spec/integration_spec.rb +94 -2
  122. data/spec/isolation_spec.rb +0 -42
  123. data/spec/isolator_spec.rb +72 -66
  124. data/spec/messaging_spec.rb +172 -0
  125. data/spec/method_call_spec.rb +21 -21
  126. data/spec/models/ClrModels.cs +185 -0
  127. data/spec/verification_spec.rb +1 -1
  128. data/workarounds/ReflectionHelper.cs +30 -0
  129. metadata +133 -2
@@ -0,0 +1,578 @@
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="#M000001">::for</a></li>
66
+
67
+ <li><a href="#M000045">::for</a></li>
68
+
69
+ <li><a href="#M000002">::get_clr_isolation_strategy</a></li>
70
+
71
+ <li><a href="#M000037">::new</a></li>
72
+
73
+ <li><a href="#M000041">#create_override</a></li>
74
+
75
+ <li><a href="#M000039">#send_message</a></li>
76
+
77
+ <li><a href="#M000042">#verify</a></li>
78
+
79
+ </ul>
80
+ </div>
81
+
82
+
83
+ <!-- Included Modules -->
84
+
85
+ </div>
86
+
87
+ <div id="project-metadata">
88
+
89
+
90
+ <div id="fileindex-section" class="section project-section">
91
+ <h3 class="section-header">Files</h3>
92
+ <ul>
93
+
94
+ <li class="file"><a href="../README_markdown.html">README.markdown</a></li>
95
+
96
+ </ul>
97
+ </div>
98
+
99
+
100
+ <div id="classindex-section" class="section project-section">
101
+ <h3 class="section-header">Class Index
102
+ <span class="search-toggle"><img src="../images/find.png"
103
+ height="16" width="16" alt="[+]"
104
+ title="show/hide quicksearch" /></span></h3>
105
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
106
+ <fieldset>
107
+ <legend>Quicksearch</legend>
108
+ <input type="text" name="quicksearch" value=""
109
+ class="quicksearch-field" />
110
+ </fieldset>
111
+ </form>
112
+
113
+ <ul class="link-list">
114
+
115
+ <li><a href="../Caricature.html">Caricature</a></li>
116
+
117
+ <li><a href="../Caricature/ArgumentRecording.html">Caricature::ArgumentRecording</a></li>
118
+
119
+ <li><a href="../Caricature/ClrClassDescriptor.html">Caricature::ClrClassDescriptor</a></li>
120
+
121
+ <li><a href="../Caricature/ClrClassMessenger.html">Caricature::ClrClassMessenger</a></li>
122
+
123
+ <li><a href="../Caricature/ClrInterfaceDescriptor.html">Caricature::ClrInterfaceDescriptor</a></li>
124
+
125
+ <li><a href="../Caricature/ClrInterfaceIsolator.html">Caricature::ClrInterfaceIsolator</a></li>
126
+
127
+ <li><a href="../Caricature/ClrInterfaceMessenger.html">Caricature::ClrInterfaceMessenger</a></li>
128
+
129
+ <li><a href="../Caricature/ClrIsolator.html">Caricature::ClrIsolator</a></li>
130
+
131
+ <li><a href="../Caricature/Expectation.html">Caricature::Expectation</a></li>
132
+
133
+ <li><a href="../Caricature/ExpectationBuilder.html">Caricature::ExpectationBuilder</a></li>
134
+
135
+ <li><a href="../Caricature/ExpectationSyntax.html">Caricature::ExpectationSyntax</a></li>
136
+
137
+ <li><a href="../Caricature/Expectations.html">Caricature::Expectations</a></li>
138
+
139
+ <li><a href="../Caricature/Interception.html">Caricature::Interception</a></li>
140
+
141
+ <li><a href="../Caricature/Interception/ClassMethods.html">Caricature::Interception::ClassMethods</a></li>
142
+
143
+ <li><a href="../Caricature/Isolation.html">Caricature::Isolation</a></li>
144
+
145
+ <li><a href="../Caricature/Isolator.html">Caricature::Isolator</a></li>
146
+
147
+ <li><a href="../Caricature/MemberDescriptor.html">Caricature::MemberDescriptor</a></li>
148
+
149
+ <li><a href="../Caricature/Messenger.html">Caricature::Messenger</a></li>
150
+
151
+ <li><a href="../Caricature/MethodCallRecorder.html">Caricature::MethodCallRecorder</a></li>
152
+
153
+ <li><a href="../Caricature/MethodCallRecording.html">Caricature::MethodCallRecording</a></li>
154
+
155
+ <li><a href="../Caricature/RubyIsolator.html">Caricature::RubyIsolator</a></li>
156
+
157
+ <li><a href="../Caricature/RubyMessenger.html">Caricature::RubyMessenger</a></li>
158
+
159
+ <li><a href="../Caricature/RubyObjectDescriptor.html">Caricature::RubyObjectDescriptor</a></li>
160
+
161
+ <li><a href="../Caricature/TypeDescriptor.html">Caricature::TypeDescriptor</a></li>
162
+
163
+ <li><a href="../Caricature/Verification.html">Caricature::Verification</a></li>
164
+
165
+ <li><a href="../System.html">System</a></li>
166
+
167
+ <li><a href="../System/String.html">System::String</a></li>
168
+
169
+ <li><a href="../System/Type.html">System::Type</a></li>
170
+
171
+ <li><a href="../Array.html">Array</a></li>
172
+
173
+ <li><a href="../Class.html">Class</a></li>
174
+
175
+ <li><a href="../Hash.html">Hash</a></li>
176
+
177
+ <li><a href="../Module.html">Module</a></li>
178
+
179
+ <li><a href="../Object.html">Object</a></li>
180
+
181
+ <li><a href="../String.html">String</a></li>
182
+
183
+ </ul>
184
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
185
+ </div>
186
+
187
+
188
+ </div>
189
+ </div>
190
+
191
+ <div id="documentation">
192
+ <h1 class="class">Caricature::Isolation</h1>
193
+
194
+ <div id="description">
195
+ <p>
196
+ Instead of using confusing terms like Mocking and Stubbing which is
197
+ basically the same. <a href="../Caricature.html">Caricature</a> tries to
198
+ unify those concepts by using a term of <b>Isolation</b>. When you&#8217;re
199
+ testing you typically want to be in control of what you&#8217;re testing.
200
+ To do that you isolate dependencies and possibly define return values for
201
+ methods on them. At a later stage you might be interested in which method
202
+ was called, maybe even with which parameters or you might be interested in
203
+ the amount of times it has been called.
204
+ </p>
205
+
206
+ </div>
207
+
208
+ <!-- Constants -->
209
+
210
+
211
+ <!-- Attributes -->
212
+
213
+ <div id="attribute-method-details" class="method-section section">
214
+ <h3 class="section-header">Attributes</h3>
215
+
216
+
217
+ <div id="instance-attribute-method" class="method-detail">
218
+ <a name="instance"></a>
219
+
220
+ <div class="method-heading attribute-method-heading">
221
+ <span class="method-name">instance</span><span
222
+ class="attribute-access-type">[R]</span>
223
+ </div>
224
+
225
+ <div class="method-description">
226
+
227
+ <p>
228
+ the real instance of the isolated subject used to forward calls in partial
229
+ mocks
230
+ </p>
231
+
232
+ </div>
233
+ </div>
234
+
235
+ <div id="recorder-attribute-method" class="method-detail">
236
+ <a name="recorder"></a>
237
+
238
+ <div class="method-heading attribute-method-heading">
239
+ <span class="method-name">recorder</span><span
240
+ class="attribute-access-type">[R]</span>
241
+ </div>
242
+
243
+ <div class="method-description">
244
+
245
+ <p>
246
+ the method call recorder
247
+ </p>
248
+
249
+ </div>
250
+ </div>
251
+
252
+ <div id="expectations-attribute-method" class="method-detail">
253
+ <a name="expectations"></a>
254
+
255
+ <div class="method-heading attribute-method-heading">
256
+ <span class="method-name">expectations</span><span
257
+ class="attribute-access-type">[R]</span>
258
+ </div>
259
+
260
+ <div class="method-description">
261
+
262
+ <p>
263
+ the expecations set for this isolation
264
+ </p>
265
+
266
+ </div>
267
+ </div>
268
+
269
+ </div>
270
+
271
+
272
+ <!-- Methods -->
273
+
274
+ <div id="public-class-method-details" class="method-section section">
275
+ <h3 class="section-header">Public Class Methods</h3>
276
+
277
+
278
+ <div id="for-method" class="method-detail ">
279
+ <a name="M000001"></a>
280
+
281
+ <div class="method-heading">
282
+
283
+ <span class="method-name">for</span><span
284
+ class="method-args">(subject, recorder = MethodCallRecorder.new, expectations = Expectations.new)</span>
285
+ <span class="method-click-advice">click to toggle source</span>
286
+
287
+ </div>
288
+
289
+ <div class="method-description">
290
+
291
+ <p>
292
+ Creates an isolation object complete with proxy and method call recorder It
293
+ works out which isolation it needs to create and provide and initializes
294
+ the method call recorder
295
+ </p>
296
+
297
+
298
+
299
+ <div class="method-source-code"
300
+ id="for-source">
301
+ <pre>
302
+ <span class="ruby-comment cmt"># File lib/caricature/clr/isolation.rb, line 10</span>
303
+ <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>)
304
+ <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>
305
+ <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>
306
+
307
+ <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>
308
+ <span class="ruby-identifier">isolation</span> = <span class="ruby-identifier">new</span>(<span class="ruby-identifier">isolator</span>, <span class="ruby-identifier">context</span>)
309
+ <span class="ruby-identifier">isolator</span>.<span class="ruby-identifier">isolation</span>
310
+ <span class="ruby-keyword kw">end</span></pre>
311
+ </div>
312
+
313
+ </div>
314
+
315
+
316
+ </div>
317
+
318
+
319
+ <div id="for-method" class="method-detail ">
320
+ <a name="M000045"></a>
321
+
322
+ <div class="method-heading">
323
+
324
+ <span class="method-name">for</span><span
325
+ class="method-args">(subject, recorder = MethodCallRecorder.new, expectations = Expectations.new)</span>
326
+ <span class="method-click-advice">click to toggle source</span>
327
+
328
+ </div>
329
+
330
+ <div class="method-description">
331
+
332
+ <p>
333
+ Creates an isolation object complete with proxy and method call recorder It
334
+ works out which isolation it needs to create and provide and initializes
335
+ the method call recorder
336
+ </p>
337
+
338
+
339
+
340
+ <div class="method-source-code"
341
+ id="for-source">
342
+ <pre>
343
+ <span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line 102</span>
344
+ <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>)
345
+ <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>
346
+
347
+ <span class="ruby-identifier">isolator</span> = <span class="ruby-constant">RubyIsolator</span>.<span class="ruby-identifier">for</span> <span class="ruby-identifier">context</span>
348
+ <span class="ruby-identifier">isolation</span> = <span class="ruby-identifier">new</span>(<span class="ruby-identifier">isolator</span>, <span class="ruby-identifier">context</span>)
349
+ <span class="ruby-identifier">isolator</span>.<span class="ruby-identifier">isolation</span>
350
+ <span class="ruby-keyword kw">end</span></pre>
351
+ </div>
352
+
353
+ </div>
354
+
355
+
356
+ </div>
357
+
358
+
359
+ <div id="new-method" class="method-detail ">
360
+ <a name="M000037"></a>
361
+
362
+ <div class="method-heading">
363
+
364
+ <span class="method-name">new</span><span
365
+ class="method-args">(isolator, context)</span>
366
+ <span class="method-click-advice">click to toggle source</span>
367
+
368
+ </div>
369
+
370
+ <div class="method-description">
371
+
372
+ <p>
373
+ Initializes a new instance of this isolation.
374
+ </p>
375
+
376
+
377
+
378
+ <div class="method-source-code"
379
+ id="new-source">
380
+ <pre>
381
+ <span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line 65</span>
382
+ <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>)
383
+ <span class="ruby-ivar">@instance</span> = <span class="ruby-identifier">isolator</span>.<span class="ruby-identifier">subject</span>
384
+ <span class="ruby-ivar">@recorder</span> = <span class="ruby-identifier">context</span>.<span class="ruby-identifier">recorder</span>
385
+ <span class="ruby-ivar">@messenger</span> = <span class="ruby-identifier">context</span>.<span class="ruby-identifier">messenger</span>
386
+ <span class="ruby-ivar">@expectations</span> = <span class="ruby-identifier">context</span>.<span class="ruby-identifier">expectations</span>
387
+ <span class="ruby-comment cmt"># isolator.isolation.instance_variable_set(&quot;@___context___&quot;, self)</span>
388
+ <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>)
389
+ <span class="ruby-keyword kw">end</span></pre>
390
+ </div>
391
+
392
+ </div>
393
+
394
+
395
+ </div>
396
+
397
+
398
+ </div>
399
+
400
+ <div id="private-class-method-details" class="method-section section">
401
+ <h3 class="section-header">Private Class Methods</h3>
402
+
403
+
404
+ <div id="get-clr-isolation-strategy-method" class="method-detail ">
405
+ <a name="M000002"></a>
406
+
407
+ <div class="method-heading">
408
+
409
+ <span class="method-name">get_clr_isolation_strategy</span><span
410
+ class="method-args">(subject)</span>
411
+ <span class="method-click-advice">click to toggle source</span>
412
+
413
+ </div>
414
+
415
+ <div class="method-description">
416
+
417
+ <p>
418
+ decides which startegy to use for mocking a CLR object. When the provided
419
+ subject is an interface it will return a <tt>ClrInterfaceIsolator</tt>
420
+ otherwise it will return a <tt>ClrIsolator</tt>
421
+ </p>
422
+
423
+
424
+
425
+ <div class="method-source-code"
426
+ id="get-clr-isolation-strategy-source">
427
+ <pre>
428
+ <span class="ruby-comment cmt"># File lib/caricature/clr/isolation.rb, line 24</span>
429
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_clr_isolation_strategy</span>(<span class="ruby-identifier">subject</span>)
430
+ <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>
431
+ <span class="ruby-constant">ClrIsolator</span>
432
+ <span class="ruby-keyword kw">end</span></pre>
433
+ </div>
434
+
435
+ </div>
436
+
437
+
438
+ </div>
439
+
440
+
441
+ </div>
442
+
443
+ <div id="public-instance-method-details" class="method-section section">
444
+ <h3 class="section-header">Public Instance Methods</h3>
445
+
446
+
447
+ <div id="create-override-method" class="method-detail ">
448
+ <a name="M000041"></a>
449
+
450
+ <div class="method-heading">
451
+
452
+ <span class="method-name">create_override</span><span
453
+ class="method-args">(method_name, &block)</span>
454
+ <span class="method-click-advice">click to toggle source</span>
455
+
456
+ </div>
457
+
458
+ <div class="method-description">
459
+
460
+ <p>
461
+ builds up an expectation, allows for overriding the result returned by the
462
+ method
463
+ </p>
464
+
465
+
466
+
467
+ <div class="method-source-code"
468
+ id="create-override-source">
469
+ <pre>
470
+ <span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line 82</span>
471
+ <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>)
472
+ <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>
473
+ <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>
474
+ <span class="ruby-identifier">exp</span> = <span class="ruby-identifier">builder</span>.<span class="ruby-identifier">build</span>
475
+ <span class="ruby-identifier">expectations</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">exp</span>
476
+ <span class="ruby-identifier">exp</span>
477
+ <span class="ruby-keyword kw">end</span></pre>
478
+ </div>
479
+
480
+ </div>
481
+
482
+
483
+ </div>
484
+
485
+
486
+ <div id="send-message-method" class="method-detail ">
487
+ <a name="M000039"></a>
488
+
489
+ <div class="method-heading">
490
+
491
+ <span class="method-name">send_message</span><span
492
+ class="method-args">(method_name, return_type, *args, &b)</span>
493
+ <span class="method-click-advice">click to toggle source</span>
494
+
495
+ </div>
496
+
497
+ <div class="method-description">
498
+
499
+ <p>
500
+ record and send the message to the isolation. takes care of following
501
+ expectations rules when sending messages.
502
+ </p>
503
+
504
+
505
+
506
+ <div class="method-source-code"
507
+ id="send-message-source">
508
+ <pre>
509
+ <span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line 76</span>
510
+ <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>)
511
+ <span class="ruby-identifier">recorder</span>.<span class="ruby-identifier">record_call</span> <span class="ruby-identifier">method_name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">b</span>
512
+ <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>)
513
+ <span class="ruby-keyword kw">end</span></pre>
514
+ </div>
515
+
516
+ </div>
517
+
518
+
519
+ </div>
520
+
521
+
522
+ <div id="verify-method" class="method-detail ">
523
+ <a name="M000042"></a>
524
+
525
+ <div class="method-heading">
526
+
527
+ <span class="method-name">verify</span><span
528
+ class="method-args">(method_name, &block)</span>
529
+ <span class="method-click-advice">click to toggle source</span>
530
+
531
+ </div>
532
+
533
+ <div class="method-description">
534
+
535
+ <p>
536
+ asserts whether the method has been called for the specified configuration
537
+ </p>
538
+
539
+
540
+
541
+ <div class="method-source-code"
542
+ id="verify-source">
543
+ <pre>
544
+ <span class="ruby-comment cmt"># File lib/caricature/isolation.rb, line 91</span>
545
+ <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>)
546
+ <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>)
547
+ <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>
548
+ <span class="ruby-identifier">verification</span>
549
+ <span class="ruby-keyword kw">end</span></pre>
550
+ </div>
551
+
552
+ </div>
553
+
554
+
555
+ </div>
556
+
557
+
558
+ </div>
559
+
560
+
561
+ </div>
562
+
563
+
564
+ <div id="rdoc-debugging-section-dump" class="debugging-section">
565
+
566
+ <p>Disabled; run with --debug to generate this.</p>
567
+
568
+ </div>
569
+
570
+ <div id="validator-badges">
571
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
572
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
573
+ Rdoc Generator</a> 1.1.6</small>.</p>
574
+ </div>
575
+
576
+ </body>
577
+ </html>
578
+