mocha 1.10.1 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (218) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -0
  3. data/.yardopts +1 -0
  4. data/CONTRIBUTING.md +1 -1
  5. data/README.md +28 -30
  6. data/RELEASE.md +69 -0
  7. data/Rakefile +7 -5
  8. data/lib/mocha/api.rb +78 -19
  9. data/lib/mocha/block_matcher.rb +31 -0
  10. data/lib/mocha/cardinality.rb +30 -27
  11. data/lib/mocha/configuration.rb +57 -1
  12. data/lib/mocha/deprecation.rb +2 -1
  13. data/lib/mocha/expectation.rb +72 -31
  14. data/lib/mocha/invocation.rb +20 -4
  15. data/lib/mocha/mock.rb +43 -17
  16. data/lib/mocha/mockery.rb +17 -27
  17. data/lib/mocha/parameter_matchers/has_entries.rb +2 -3
  18. data/lib/mocha/parameter_matchers/has_entry.rb +2 -3
  19. data/lib/mocha/parameter_matchers/has_key.rb +2 -3
  20. data/lib/mocha/parameter_matchers/has_value.rb +2 -3
  21. data/lib/mocha/parameter_matchers/is_a.rb +2 -3
  22. data/lib/mocha/parameter_matchers/not.rb +2 -3
  23. data/lib/mocha/state_machine.rb +31 -40
  24. data/lib/mocha/stubbed_method.rb +4 -6
  25. data/lib/mocha/version.rb +1 -1
  26. data/lib/mocha/yield_parameters.rb +5 -11
  27. data/mocha.gemspec +3 -1
  28. metadata +7 -195
  29. data/docs/CNAME +0 -1
  30. data/docs/Mocha.html +0 -254
  31. data/docs/Mocha/API.html +0 -1153
  32. data/docs/Mocha/ClassMethods.html +0 -264
  33. data/docs/Mocha/Configuration.html +0 -1383
  34. data/docs/Mocha/Expectation.html +0 -2654
  35. data/docs/Mocha/ExpectationError.html +0 -152
  36. data/docs/Mocha/ExpectationErrorFactory.html +0 -260
  37. data/docs/Mocha/Hooks.html +0 -370
  38. data/docs/Mocha/Integration.html +0 -125
  39. data/docs/Mocha/Integration/MiniTest.html +0 -123
  40. data/docs/Mocha/Integration/MiniTest/Adapter.html +0 -164
  41. data/docs/Mocha/Integration/TestUnit.html +0 -123
  42. data/docs/Mocha/Integration/TestUnit/Adapter.html +0 -164
  43. data/docs/Mocha/Mock.html +0 -1237
  44. data/docs/Mocha/ObjectMethods.html +0 -765
  45. data/docs/Mocha/ParameterMatchers.html +0 -2961
  46. data/docs/Mocha/ParameterMatchers/AllOf.html +0 -153
  47. data/docs/Mocha/ParameterMatchers/AnyOf.html +0 -153
  48. data/docs/Mocha/ParameterMatchers/AnyParameters.html +0 -153
  49. data/docs/Mocha/ParameterMatchers/Anything.html +0 -153
  50. data/docs/Mocha/ParameterMatchers/Base.html +0 -441
  51. data/docs/Mocha/ParameterMatchers/Equals.html +0 -153
  52. data/docs/Mocha/ParameterMatchers/EquivalentUri.html +0 -153
  53. data/docs/Mocha/ParameterMatchers/HasEntries.html +0 -153
  54. data/docs/Mocha/ParameterMatchers/HasEntry.html +0 -153
  55. data/docs/Mocha/ParameterMatchers/HasKey.html +0 -153
  56. data/docs/Mocha/ParameterMatchers/HasValue.html +0 -153
  57. data/docs/Mocha/ParameterMatchers/Includes.html +0 -153
  58. data/docs/Mocha/ParameterMatchers/InstanceOf.html +0 -153
  59. data/docs/Mocha/ParameterMatchers/IsA.html +0 -153
  60. data/docs/Mocha/ParameterMatchers/KindOf.html +0 -153
  61. data/docs/Mocha/ParameterMatchers/Not.html +0 -153
  62. data/docs/Mocha/ParameterMatchers/Optionally.html +0 -153
  63. data/docs/Mocha/ParameterMatchers/RegexpMatches.html +0 -153
  64. data/docs/Mocha/ParameterMatchers/RespondsWith.html +0 -153
  65. data/docs/Mocha/ParameterMatchers/YamlEquivalent.html +0 -153
  66. data/docs/Mocha/Sequence.html +0 -149
  67. data/docs/Mocha/StateMachine.html +0 -527
  68. data/docs/Mocha/StateMachine/State.html +0 -140
  69. data/docs/Mocha/StateMachine/StatePredicate.html +0 -140
  70. data/docs/Mocha/StubbingError.html +0 -150
  71. data/docs/_index.html +0 -519
  72. data/docs/class_list.html +0 -51
  73. data/docs/css/common.css +0 -1
  74. data/docs/css/full_list.css +0 -58
  75. data/docs/css/style.css +0 -496
  76. data/docs/file.COPYING.html +0 -81
  77. data/docs/file.MIT-LICENSE.html +0 -85
  78. data/docs/file.README.html +0 -448
  79. data/docs/file.RELEASE.html +0 -963
  80. data/docs/file_list.html +0 -71
  81. data/docs/frames.html +0 -17
  82. data/docs/index.html +0 -448
  83. data/docs/js/app.js +0 -303
  84. data/docs/js/full_list.js +0 -216
  85. data/docs/js/jquery.js +0 -4
  86. data/docs/method_list.html +0 -627
  87. data/docs/top-level-namespace.html +0 -118
  88. data/lib/mocha/multiple_yields.rb +0 -15
  89. data/lib/mocha/no_yields.rb +0 -5
  90. data/lib/mocha/pretty_parameters.rb +0 -24
  91. data/lib/mocha/single_yield.rb +0 -13
  92. data/test/acceptance/acceptance_test_helper.rb +0 -41
  93. data/test/acceptance/bug_18914_test.rb +0 -37
  94. data/test/acceptance/bug_21465_test.rb +0 -31
  95. data/test/acceptance/bug_21563_test.rb +0 -22
  96. data/test/acceptance/display_matching_invocations_alongside_expectations_test.rb +0 -69
  97. data/test/acceptance/exception_rescue_test.rb +0 -53
  98. data/test/acceptance/expectations_on_multiple_methods_test.rb +0 -55
  99. data/test/acceptance/expected_invocation_count_test.rb +0 -229
  100. data/test/acceptance/failure_messages_test.rb +0 -61
  101. data/test/acceptance/issue_272_test.rb +0 -50
  102. data/test/acceptance/issue_65_test.rb +0 -64
  103. data/test/acceptance/issue_70_test.rb +0 -53
  104. data/test/acceptance/mocha_example_test.rb +0 -96
  105. data/test/acceptance/mocha_test_result_test.rb +0 -83
  106. data/test/acceptance/mock_test.rb +0 -139
  107. data/test/acceptance/mocked_methods_dispatch_test.rb +0 -75
  108. data/test/acceptance/multiple_expectations_failure_message_test.rb +0 -66
  109. data/test/acceptance/optional_parameters_test.rb +0 -67
  110. data/test/acceptance/parameter_matcher_test.rb +0 -299
  111. data/test/acceptance/partial_mocks_test.rb +0 -44
  112. data/test/acceptance/prepend_test.rb +0 -86
  113. data/test/acceptance/prevent_use_of_mocha_outside_test_test.rb +0 -76
  114. data/test/acceptance/raise_exception_test.rb +0 -36
  115. data/test/acceptance/return_value_test.rb +0 -49
  116. data/test/acceptance/sequence_test.rb +0 -189
  117. data/test/acceptance/states_test.rb +0 -71
  118. data/test/acceptance/stub_any_instance_method_defined_on_superclass_test.rb +0 -64
  119. data/test/acceptance/stub_any_instance_method_test.rb +0 -301
  120. data/test/acceptance/stub_class_method_defined_on_active_record_association_proxy_test.rb +0 -105
  121. data/test/acceptance/stub_class_method_defined_on_class_test.rb +0 -78
  122. data/test/acceptance/stub_class_method_defined_on_module_test.rb +0 -73
  123. data/test/acceptance/stub_class_method_defined_on_superclass_test.rb +0 -144
  124. data/test/acceptance/stub_everything_test.rb +0 -53
  125. data/test/acceptance/stub_instance_method_defined_on_active_record_association_proxy_test.rb +0 -91
  126. data/test/acceptance/stub_instance_method_defined_on_class_and_aliased_test.rb +0 -67
  127. data/test/acceptance/stub_instance_method_defined_on_class_test.rb +0 -67
  128. data/test/acceptance/stub_instance_method_defined_on_kernel_module_test.rb +0 -136
  129. data/test/acceptance/stub_instance_method_defined_on_module_test.rb +0 -76
  130. data/test/acceptance/stub_instance_method_defined_on_object_class_test.rb +0 -75
  131. data/test/acceptance/stub_instance_method_defined_on_singleton_class_test.rb +0 -67
  132. data/test/acceptance/stub_instance_method_defined_on_superclass_test.rb +0 -70
  133. data/test/acceptance/stub_method_defined_on_module_and_aliased_test.rb +0 -38
  134. data/test/acceptance/stub_module_method_test.rb +0 -200
  135. data/test/acceptance/stub_test.rb +0 -49
  136. data/test/acceptance/stubba_example_test.rb +0 -93
  137. data/test/acceptance/stubba_test_result_test.rb +0 -71
  138. data/test/acceptance/stubbing_error_backtrace_test.rb +0 -63
  139. data/test/acceptance/stubbing_frozen_object_test.rb +0 -88
  140. data/test/acceptance/stubbing_method_accepting_block_parameter_test.rb +0 -52
  141. data/test/acceptance/stubbing_method_unnecessarily_test.rb +0 -63
  142. data/test/acceptance/stubbing_nil_test.rb +0 -60
  143. data/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +0 -157
  144. data/test/acceptance/stubbing_non_existent_class_method_test.rb +0 -157
  145. data/test/acceptance/stubbing_non_existent_instance_method_test.rb +0 -145
  146. data/test/acceptance/stubbing_non_public_any_instance_method_test.rb +0 -128
  147. data/test/acceptance/stubbing_non_public_class_method_test.rb +0 -163
  148. data/test/acceptance/stubbing_non_public_instance_method_test.rb +0 -141
  149. data/test/acceptance/stubbing_on_non_mock_object_test.rb +0 -70
  150. data/test/acceptance/stubbing_same_class_method_on_parent_and_child_classes_test.rb +0 -33
  151. data/test/acceptance/throw_test.rb +0 -42
  152. data/test/acceptance/unexpected_invocation_test.rb +0 -23
  153. data/test/acceptance/unstubbing_test.rb +0 -194
  154. data/test/assertions.rb +0 -8
  155. data/test/deprecation_disabler.rb +0 -15
  156. data/test/execution_point.rb +0 -36
  157. data/test/integration/mini_test_test.rb +0 -8
  158. data/test/integration/shared_tests.rb +0 -178
  159. data/test/integration/test_unit_test.rb +0 -8
  160. data/test/method_definer.rb +0 -16
  161. data/test/mini_test_result.rb +0 -96
  162. data/test/minitest_result.rb +0 -48
  163. data/test/simple_counter.rb +0 -11
  164. data/test/test_helper.rb +0 -58
  165. data/test/test_runner.rb +0 -58
  166. data/test/test_unit_result.rb +0 -22
  167. data/test/unit/any_instance_method_test.rb +0 -175
  168. data/test/unit/array_inspect_test.rb +0 -14
  169. data/test/unit/backtrace_filter_test.rb +0 -17
  170. data/test/unit/cardinality_test.rb +0 -72
  171. data/test/unit/central_test.rb +0 -98
  172. data/test/unit/change_state_side_effect_test.rb +0 -37
  173. data/test/unit/class_methods_test.rb +0 -69
  174. data/test/unit/configuration_test.rb +0 -37
  175. data/test/unit/date_time_inspect_test.rb +0 -19
  176. data/test/unit/exception_raiser_test.rb +0 -45
  177. data/test/unit/expectation_list_test.rb +0 -82
  178. data/test/unit/expectation_test.rb +0 -477
  179. data/test/unit/hash_inspect_test.rb +0 -14
  180. data/test/unit/hooks_test.rb +0 -35
  181. data/test/unit/in_state_ordering_constraint_test.rb +0 -39
  182. data/test/unit/instance_method_test.rb +0 -282
  183. data/test/unit/method_matcher_test.rb +0 -26
  184. data/test/unit/mock_test.rb +0 -372
  185. data/test/unit/mockery_test.rb +0 -171
  186. data/test/unit/module_methods_test.rb +0 -16
  187. data/test/unit/multiple_yields_test.rb +0 -16
  188. data/test/unit/no_yields_test.rb +0 -16
  189. data/test/unit/object_inspect_test.rb +0 -60
  190. data/test/unit/object_methods_test.rb +0 -63
  191. data/test/unit/parameter_matchers/all_of_test.rb +0 -24
  192. data/test/unit/parameter_matchers/any_of_test.rb +0 -24
  193. data/test/unit/parameter_matchers/anything_test.rb +0 -19
  194. data/test/unit/parameter_matchers/equals_test.rb +0 -23
  195. data/test/unit/parameter_matchers/equivalent_uri_test.rb +0 -41
  196. data/test/unit/parameter_matchers/has_entries_test.rb +0 -51
  197. data/test/unit/parameter_matchers/has_entry_test.rb +0 -128
  198. data/test/unit/parameter_matchers/has_key_test.rb +0 -54
  199. data/test/unit/parameter_matchers/has_value_test.rb +0 -55
  200. data/test/unit/parameter_matchers/includes_test.rb +0 -106
  201. data/test/unit/parameter_matchers/instance_of_test.rb +0 -23
  202. data/test/unit/parameter_matchers/is_a_test.rb +0 -23
  203. data/test/unit/parameter_matchers/kind_of_test.rb +0 -23
  204. data/test/unit/parameter_matchers/not_test.rb +0 -24
  205. data/test/unit/parameter_matchers/regexp_matches_test.rb +0 -45
  206. data/test/unit/parameter_matchers/responds_with_test.rb +0 -38
  207. data/test/unit/parameter_matchers/stub_matcher.rb +0 -23
  208. data/test/unit/parameter_matchers/yaml_equivalent_test.rb +0 -23
  209. data/test/unit/parameters_matcher_test.rb +0 -119
  210. data/test/unit/receivers_test.rb +0 -96
  211. data/test/unit/return_values_test.rb +0 -66
  212. data/test/unit/sequence_test.rb +0 -100
  213. data/test/unit/single_return_value_test.rb +0 -17
  214. data/test/unit/single_yield_test.rb +0 -16
  215. data/test/unit/state_machine_test.rb +0 -96
  216. data/test/unit/string_inspect_test.rb +0 -9
  217. data/test/unit/thrower_test.rb +0 -23
  218. data/test/unit/yield_parameters_test.rb +0 -91
@@ -1,152 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>
7
- Exception: Mocha::ExpectationError
8
-
9
- &mdash; Mocha 1.10.1
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
-
15
- <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
-
17
- <script type="text/javascript" charset="utf-8">
18
- pathId = "Mocha::ExpectationError";
19
- relpath = '../';
20
- </script>
21
-
22
-
23
- <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
-
25
- <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
-
27
-
28
- </head>
29
- <body>
30
- <div class="nav_wrap">
31
- <iframe id="nav" src="../class_list.html?1"></iframe>
32
- <div id="resizer"></div>
33
- </div>
34
-
35
- <div id="main" tabindex="-1">
36
- <div id="header">
37
- <div id="menu">
38
-
39
- <a href="../_index.html">Index (E)</a> &raquo;
40
- <span class='title'><span class='object_link'><a href="../Mocha.html" title="Mocha (module)">Mocha</a></span></span>
41
- &raquo;
42
- <span class="title">ExpectationError</span>
43
-
44
- </div>
45
-
46
- <div id="search">
47
-
48
- <a class="full_list_link" id="class_list_link"
49
- href="../class_list.html">
50
-
51
- <svg width="24" height="24">
52
- <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
- <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
- <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
- </svg>
56
- </a>
57
-
58
- </div>
59
- <div class="clear"></div>
60
- </div>
61
-
62
- <div id="content"><h1>Exception: Mocha::ExpectationError
63
-
64
-
65
-
66
- </h1>
67
- <div class="box_info">
68
-
69
- <dl>
70
- <dt>Inherits:</dt>
71
- <dd>
72
- <span class="inheritName">Exception</span>
73
-
74
- <ul class="fullTree">
75
- <li><span class='object_link'>Object</span></li>
76
-
77
- <li class="next">Exception</li>
78
-
79
- <li class="next">Mocha::ExpectationError</li>
80
-
81
- </ul>
82
- <a href="#" class="inheritanceTree">show all</a>
83
-
84
- </dd>
85
- </dl>
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
- <dl>
98
- <dt>Defined in:</dt>
99
- <dd>lib/mocha/expectation_error.rb</dd>
100
- </dl>
101
-
102
- </div>
103
-
104
- <h2>Overview</h2><div class="docstring">
105
- <div class="discussion">
106
-
107
- <p>Default exception class raised when an unexpected invocation or an unsatisfied expectation occurs.</p>
108
-
109
- <p>Authors of test libraries may use <code>Mocha::ExpectationErrorFactory</code> to have Mocha raise a different exception.</p>
110
-
111
-
112
- </div>
113
- </div>
114
- <div class="tags">
115
-
116
-
117
- <p class="tag_title">See Also:</p>
118
- <ul class="see">
119
-
120
- <li><span class='object_link'><a href="ExpectationErrorFactory.html" title="Mocha::ExpectationErrorFactory (class)">ExpectationErrorFactory</a></span></li>
121
-
122
- </ul>
123
-
124
- </div>
125
-
126
-
127
-
128
-
129
-
130
-
131
-
132
-
133
-
134
- <script async src="https://www.googletagmanager.com/gtag/js?id=UA-625523-7"></script>
135
- <script>
136
- window.dataLayer = window.dataLayer || [];
137
- function gtag(){dataLayer.push(arguments);}
138
- gtag('js', new Date());
139
-
140
- gtag('config', 'UA-625523-7');
141
- </script>
142
- </div>
143
-
144
- <div id="footer">
145
- Generated on Wed Dec 4 09:20:48 2019 by
146
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
147
- 0.9.20 (ruby-2.6.5).
148
- </div>
149
-
150
- </div>
151
- </body>
152
- </html>
@@ -1,260 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>
7
- Class: Mocha::ExpectationErrorFactory
8
-
9
- &mdash; Mocha 1.10.1
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
-
15
- <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
-
17
- <script type="text/javascript" charset="utf-8">
18
- pathId = "Mocha::ExpectationErrorFactory";
19
- relpath = '../';
20
- </script>
21
-
22
-
23
- <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
-
25
- <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
-
27
-
28
- </head>
29
- <body>
30
- <div class="nav_wrap">
31
- <iframe id="nav" src="../class_list.html?1"></iframe>
32
- <div id="resizer"></div>
33
- </div>
34
-
35
- <div id="main" tabindex="-1">
36
- <div id="header">
37
- <div id="menu">
38
-
39
- <a href="../_index.html">Index (E)</a> &raquo;
40
- <span class='title'><span class='object_link'><a href="../Mocha.html" title="Mocha (module)">Mocha</a></span></span>
41
- &raquo;
42
- <span class="title">ExpectationErrorFactory</span>
43
-
44
- </div>
45
-
46
- <div id="search">
47
-
48
- <a class="full_list_link" id="class_list_link"
49
- href="../class_list.html">
50
-
51
- <svg width="24" height="24">
52
- <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
- <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
- <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
- </svg>
56
- </a>
57
-
58
- </div>
59
- <div class="clear"></div>
60
- </div>
61
-
62
- <div id="content"><h1>Class: Mocha::ExpectationErrorFactory
63
-
64
-
65
-
66
- </h1>
67
- <div class="box_info">
68
-
69
- <dl>
70
- <dt>Inherits:</dt>
71
- <dd>
72
- <span class="inheritName"><span class='object_link'>Object</span></span>
73
-
74
- <ul class="fullTree">
75
- <li><span class='object_link'>Object</span></li>
76
-
77
- <li class="next">Mocha::ExpectationErrorFactory</li>
78
-
79
- </ul>
80
- <a href="#" class="inheritanceTree">show all</a>
81
-
82
- </dd>
83
- </dl>
84
-
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
- <dl>
96
- <dt>Defined in:</dt>
97
- <dd>lib/mocha/expectation_error_factory.rb</dd>
98
- </dl>
99
-
100
- </div>
101
-
102
- <h2>Overview</h2><div class="docstring">
103
- <div class="discussion">
104
-
105
- <p>This factory determines what class of exception should be raised when Mocha detects a test failure.</p>
106
-
107
- <p>This class should only be used by authors of test libraries and not by typical “users” of Mocha.</p>
108
-
109
- <p>For example, it is used by <code>Mocha::Integration::MiniTest::Adapter</code> in order to have Mocha raise a <code>MiniTest::Assertion</code> which can then be sensibly handled by <code>MiniTest::Unit::TestCase</code>.</p>
110
-
111
-
112
- </div>
113
- </div>
114
- <div class="tags">
115
-
116
-
117
- <p class="tag_title">See Also:</p>
118
- <ul class="see">
119
-
120
- <li><span class='object_link'><a href="Integration/MiniTest/Adapter.html" title="Mocha::Integration::MiniTest::Adapter (module)">Integration::MiniTest::Adapter</a></span></li>
121
-
122
- </ul>
123
-
124
- </div>
125
-
126
-
127
-
128
- <h2>Class Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
129
- <ul class="summary">
130
-
131
- <li class="public ">
132
- <span class="summary_signature">
133
-
134
- <a href="#exception_class-class_method" title="exception_class (class method)">.<strong>exception_class</strong> &#x21d2; Exception </a>
135
-
136
-
137
-
138
- </span>
139
-
140
-
141
-
142
-
143
-
144
-
145
-
146
-
147
-
148
-
149
-
150
-
151
- <span class="summary_desc"><div class='inline'>
152
- <p>Determines what class of exception should be raised when Mocha detects a test failure.</p>
153
- </div></span>
154
-
155
- </li>
156
-
157
-
158
- </ul>
159
-
160
-
161
-
162
-
163
-
164
- <div id="class_attr_details" class="attr_details">
165
- <h2>Class Attribute Details</h2>
166
-
167
-
168
- <span id="exception_class=-class_method"></span>
169
- <div class="method_details first">
170
- <h3 class="signature first" id="exception_class-class_method">
171
-
172
- .<strong>exception_class</strong> &#x21d2; <tt>Exception</tt>
173
-
174
-
175
-
176
-
177
-
178
- </h3><div class="docstring">
179
- <div class="discussion">
180
-
181
- <p>Determines what class of exception should be raised when Mocha detects a test failure.</p>
182
-
183
- <p>This attribute may be set by authors of test libraries in order to have Mocha raise exceptions of a specific class when there is an unexpected invocation or an unsatisfied expectation.</p>
184
-
185
- <p>By default a <code>Mocha::ExpectationError</code> will be raised.</p>
186
-
187
-
188
- </div>
189
- </div>
190
- <div class="tags">
191
-
192
- <p class="tag_title">Returns:</p>
193
- <ul class="return">
194
-
195
- <li>
196
-
197
-
198
- <span class='type'>(<tt>Exception</tt>)</span>
199
-
200
-
201
-
202
- &mdash;
203
- <div class='inline'>
204
- <p>class of exception to be raised when an expectation error occurs</p>
205
- </div>
206
-
207
- </li>
208
-
209
- </ul>
210
-
211
- <p class="tag_title">See Also:</p>
212
- <ul class="see">
213
-
214
- <li><span class='object_link'><a href="ExpectationError.html" title="Mocha::ExpectationError (class)">Mocha::ExpectationError</a></span></li>
215
-
216
- </ul>
217
-
218
- </div><table class="source_code">
219
- <tr>
220
- <td>
221
- <pre class="lines">
222
-
223
-
224
- 23
225
- 24
226
- 25</pre>
227
- </td>
228
- <td>
229
- <pre class="code"><span class="info file"># File 'lib/mocha/expectation_error_factory.rb', line 23</span>
230
-
231
- <span class='kw'>def</span> <span class='id identifier rubyid_exception_class'>exception_class</span>
232
- <span class='ivar'>@exception_class</span>
233
- <span class='kw'>end</span></pre>
234
- </td>
235
- </tr>
236
- </table>
237
- </div>
238
-
239
- </div>
240
-
241
-
242
- <script async src="https://www.googletagmanager.com/gtag/js?id=UA-625523-7"></script>
243
- <script>
244
- window.dataLayer = window.dataLayer || [];
245
- function gtag(){dataLayer.push(arguments);}
246
- gtag('js', new Date());
247
-
248
- gtag('config', 'UA-625523-7');
249
- </script>
250
- </div>
251
-
252
- <div id="footer">
253
- Generated on Wed Dec 4 09:20:48 2019 by
254
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
255
- 0.9.20 (ruby-2.6.5).
256
- </div>
257
-
258
- </div>
259
- </body>
260
- </html>
@@ -1,370 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>
7
- Module: Mocha::Hooks
8
-
9
- &mdash; Mocha 1.10.1
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
14
-
15
- <link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
16
-
17
- <script type="text/javascript" charset="utf-8">
18
- pathId = "Mocha::Hooks";
19
- relpath = '../';
20
- </script>
21
-
22
-
23
- <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
-
25
- <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
-
27
-
28
- </head>
29
- <body>
30
- <div class="nav_wrap">
31
- <iframe id="nav" src="../class_list.html?1"></iframe>
32
- <div id="resizer"></div>
33
- </div>
34
-
35
- <div id="main" tabindex="-1">
36
- <div id="header">
37
- <div id="menu">
38
-
39
- <a href="../_index.html">Index (H)</a> &raquo;
40
- <span class='title'><span class='object_link'><a href="../Mocha.html" title="Mocha (module)">Mocha</a></span></span>
41
- &raquo;
42
- <span class="title">Hooks</span>
43
-
44
- </div>
45
-
46
- <div id="search">
47
-
48
- <a class="full_list_link" id="class_list_link"
49
- href="../class_list.html">
50
-
51
- <svg width="24" height="24">
52
- <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
- <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
- <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
- </svg>
56
- </a>
57
-
58
- </div>
59
- <div class="clear"></div>
60
- </div>
61
-
62
- <div id="content"><h1>Module: Mocha::Hooks
63
-
64
-
65
-
66
- </h1>
67
- <div class="box_info">
68
-
69
-
70
-
71
-
72
-
73
-
74
-
75
-
76
-
77
- <dl>
78
- <dt>Included in:</dt>
79
- <dd><span class='object_link'><a href="API.html" title="Mocha::API (module)">API</a></span></dd>
80
- </dl>
81
-
82
-
83
-
84
- <dl>
85
- <dt>Defined in:</dt>
86
- <dd>lib/mocha/hooks.rb</dd>
87
- </dl>
88
-
89
- </div>
90
-
91
- <h2>Overview</h2><div class="docstring">
92
- <div class="discussion">
93
-
94
- <p>Integration hooks for test library authors.</p>
95
-
96
- <p>The methods in this module should be called from test libraries wishing to integrate with Mocha.</p>
97
-
98
- <p>This module is provided as part of the <code>Mocha::API</code> module and is therefore part of the public API, but should only be used by authors of test libraries and not by typical “users” of Mocha.</p>
99
-
100
- <p>Integration with Test::Unit and MiniTest are provided as part of Mocha, because they are (or were once) part of the Ruby standard library. Integration with other test libraries is not provided as <strong>part</strong> of Mocha, but is supported by means of the methods in this module.</p>
101
-
102
- <p>See the code in the <code>Adapter</code> modules for examples of how to use the methods in this module. <code>Mocha::ExpectationErrorFactory</code> may be used if you want <code>Mocha</code> to raise a different type of exception.</p>
103
-
104
-
105
- </div>
106
- </div>
107
- <div class="tags">
108
-
109
-
110
- <p class="tag_title">See Also:</p>
111
- <ul class="see">
112
-
113
- <li><span class='object_link'><a href="Integration/TestUnit/Adapter.html" title="Mocha::Integration::TestUnit::Adapter (module)">Integration::TestUnit::Adapter</a></span></li>
114
-
115
- <li><span class='object_link'><a href="Integration/MiniTest/Adapter.html" title="Mocha::Integration::MiniTest::Adapter (module)">Integration::MiniTest::Adapter</a></span></li>
116
-
117
- <li><span class='object_link'><a href="ExpectationErrorFactory.html" title="Mocha::ExpectationErrorFactory (class)">ExpectationErrorFactory</a></span></li>
118
-
119
- <li><span class='object_link'><a href="API.html" title="Mocha::API (module)">API</a></span></li>
120
-
121
- </ul>
122
-
123
- </div>
124
-
125
-
126
-
127
-
128
-
129
-
130
-
131
- <h2>
132
- Instance Method Summary
133
- <small><a href="#" class="summary_toggle">collapse</a></small>
134
- </h2>
135
-
136
- <ul class="summary">
137
-
138
- <li class="public ">
139
- <span class="summary_signature">
140
-
141
- <a href="#mocha_setup-instance_method" title="#mocha_setup (instance method)">#<strong>mocha_setup</strong> &#x21d2; Object </a>
142
-
143
-
144
-
145
- </span>
146
-
147
-
148
-
149
-
150
-
151
-
152
-
153
-
154
-
155
- <span class="summary_desc"><div class='inline'>
156
- <p>Prepares Mocha before a test (only for use by authors of test libraries).</p>
157
- </div></span>
158
-
159
- </li>
160
-
161
-
162
- <li class="public ">
163
- <span class="summary_signature">
164
-
165
- <a href="#mocha_teardown-instance_method" title="#mocha_teardown (instance method)">#<strong>mocha_teardown</strong> &#x21d2; Object </a>
166
-
167
-
168
-
169
- </span>
170
-
171
-
172
-
173
-
174
-
175
-
176
-
177
-
178
-
179
- <span class="summary_desc"><div class='inline'>
180
- <p>Resets Mocha after a test (only for use by authors of test libraries).</p>
181
- </div></span>
182
-
183
- </li>
184
-
185
-
186
- <li class="public ">
187
- <span class="summary_signature">
188
-
189
- <a href="#mocha_verify-instance_method" title="#mocha_verify (instance method)">#<strong>mocha_verify</strong>(assertion_counter = nil) &#x21d2; Object </a>
190
-
191
-
192
-
193
- </span>
194
-
195
-
196
-
197
-
198
-
199
-
200
-
201
-
202
-
203
- <span class="summary_desc"><div class='inline'>
204
- <p>Verifies that all mock expectations have been met (only for use by authors of test libraries).</p>
205
- </div></span>
206
-
207
- </li>
208
-
209
-
210
- </ul>
211
-
212
-
213
-
214
-
215
- <div id="instance_method_details" class="method_details_list">
216
- <h2>Instance Method Details</h2>
217
-
218
-
219
- <div class="method_details first">
220
- <h3 class="signature first" id="mocha_setup-instance_method">
221
-
222
- #<strong>mocha_setup</strong> &#x21d2; <tt><span class='object_link'>Object</span></tt>
223
-
224
-
225
-
226
-
227
-
228
- </h3><div class="docstring">
229
- <div class="discussion">
230
-
231
- <p>Prepares Mocha before a test (only for use by authors of test libraries).</p>
232
-
233
- <p>This method should be called before each individual test starts (including before any “setup” code).</p>
234
-
235
-
236
- </div>
237
- </div>
238
- <div class="tags">
239
-
240
-
241
- </div><table class="source_code">
242
- <tr>
243
- <td>
244
- <pre class="lines">
245
-
246
-
247
- 22
248
- 23
249
- 24</pre>
250
- </td>
251
- <td>
252
- <pre class="code"><span class="info file"># File 'lib/mocha/hooks.rb', line 22</span>
253
-
254
- <span class='kw'>def</span> <span class='id identifier rubyid_mocha_setup'>mocha_setup</span>
255
- <span class='const'>Mockery</span><span class='period'>.</span><span class='id identifier rubyid_setup'>setup</span>
256
- <span class='kw'>end</span></pre>
257
- </td>
258
- </tr>
259
- </table>
260
- </div>
261
-
262
- <div class="method_details ">
263
- <h3 class="signature " id="mocha_teardown-instance_method">
264
-
265
- #<strong>mocha_teardown</strong> &#x21d2; <tt><span class='object_link'>Object</span></tt>
266
-
267
-
268
-
269
-
270
-
271
- </h3><div class="docstring">
272
- <div class="discussion">
273
-
274
- <p>Resets Mocha after a test (only for use by authors of test libraries).</p>
275
-
276
- <p>This method should be called after each individual test has finished (including after any “teardown” code).</p>
277
-
278
-
279
- </div>
280
- </div>
281
- <div class="tags">
282
-
283
-
284
- </div><table class="source_code">
285
- <tr>
286
- <td>
287
- <pre class="lines">
288
-
289
-
290
- 38
291
- 39
292
- 40</pre>
293
- </td>
294
- <td>
295
- <pre class="code"><span class="info file"># File 'lib/mocha/hooks.rb', line 38</span>
296
-
297
- <span class='kw'>def</span> <span class='id identifier rubyid_mocha_teardown'>mocha_teardown</span>
298
- <span class='const'>Mockery</span><span class='period'>.</span><span class='id identifier rubyid_teardown'>teardown</span>
299
- <span class='kw'>end</span></pre>
300
- </td>
301
- </tr>
302
- </table>
303
- </div>
304
-
305
- <div class="method_details ">
306
- <h3 class="signature " id="mocha_verify-instance_method">
307
-
308
- #<strong>mocha_verify</strong>(assertion_counter = nil) &#x21d2; <tt><span class='object_link'>Object</span></tt>
309
-
310
-
311
-
312
-
313
-
314
- </h3><div class="docstring">
315
- <div class="discussion">
316
-
317
- <p>Verifies that all mock expectations have been met (only for use by authors of test libraries).</p>
318
-
319
- <p>This is equivalent to a series of “assertions”.</p>
320
-
321
- <p>This method should be called at the end of each individual test, before it has been determined whether or not the test has passed.</p>
322
-
323
-
324
- </div>
325
- </div>
326
- <div class="tags">
327
-
328
-
329
- </div><table class="source_code">
330
- <tr>
331
- <td>
332
- <pre class="lines">
333
-
334
-
335
- 31
336
- 32
337
- 33</pre>
338
- </td>
339
- <td>
340
- <pre class="code"><span class="info file"># File 'lib/mocha/hooks.rb', line 31</span>
341
-
342
- <span class='kw'>def</span> <span class='id identifier rubyid_mocha_verify'>mocha_verify</span><span class='lparen'>(</span><span class='id identifier rubyid_assertion_counter'>assertion_counter</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
343
- <span class='const'>Mockery</span><span class='period'>.</span><span class='id identifier rubyid_verify'>verify</span><span class='lparen'>(</span><span class='id identifier rubyid_assertion_counter'>assertion_counter</span><span class='rparen'>)</span>
344
- <span class='kw'>end</span></pre>
345
- </td>
346
- </tr>
347
- </table>
348
- </div>
349
-
350
- </div>
351
-
352
- <script async src="https://www.googletagmanager.com/gtag/js?id=UA-625523-7"></script>
353
- <script>
354
- window.dataLayer = window.dataLayer || [];
355
- function gtag(){dataLayer.push(arguments);}
356
- gtag('js', new Date());
357
-
358
- gtag('config', 'UA-625523-7');
359
- </script>
360
- </div>
361
-
362
- <div id="footer">
363
- Generated on Wed Dec 4 09:20:47 2019 by
364
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
365
- 0.9.20 (ruby-2.6.5).
366
- </div>
367
-
368
- </div>
369
- </body>
370
- </html>