mocha 1.10.1 → 1.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +1 -0
- data/.yardopts +1 -0
- data/CONTRIBUTING.md +1 -1
- data/README.md +28 -30
- data/RELEASE.md +69 -0
- data/Rakefile +7 -5
- data/lib/mocha/api.rb +78 -19
- data/lib/mocha/block_matcher.rb +31 -0
- data/lib/mocha/cardinality.rb +30 -27
- data/lib/mocha/configuration.rb +57 -1
- data/lib/mocha/deprecation.rb +2 -1
- data/lib/mocha/expectation.rb +72 -31
- data/lib/mocha/invocation.rb +20 -4
- data/lib/mocha/mock.rb +43 -17
- data/lib/mocha/mockery.rb +17 -27
- data/lib/mocha/parameter_matchers/has_entries.rb +2 -3
- data/lib/mocha/parameter_matchers/has_entry.rb +2 -3
- data/lib/mocha/parameter_matchers/has_key.rb +2 -3
- data/lib/mocha/parameter_matchers/has_value.rb +2 -3
- data/lib/mocha/parameter_matchers/is_a.rb +2 -3
- data/lib/mocha/parameter_matchers/not.rb +2 -3
- data/lib/mocha/state_machine.rb +31 -40
- data/lib/mocha/stubbed_method.rb +4 -6
- data/lib/mocha/version.rb +1 -1
- data/lib/mocha/yield_parameters.rb +5 -11
- data/mocha.gemspec +3 -1
- metadata +7 -195
- data/docs/CNAME +0 -1
- data/docs/Mocha.html +0 -254
- data/docs/Mocha/API.html +0 -1153
- data/docs/Mocha/ClassMethods.html +0 -264
- data/docs/Mocha/Configuration.html +0 -1383
- data/docs/Mocha/Expectation.html +0 -2654
- data/docs/Mocha/ExpectationError.html +0 -152
- data/docs/Mocha/ExpectationErrorFactory.html +0 -260
- data/docs/Mocha/Hooks.html +0 -370
- data/docs/Mocha/Integration.html +0 -125
- data/docs/Mocha/Integration/MiniTest.html +0 -123
- data/docs/Mocha/Integration/MiniTest/Adapter.html +0 -164
- data/docs/Mocha/Integration/TestUnit.html +0 -123
- data/docs/Mocha/Integration/TestUnit/Adapter.html +0 -164
- data/docs/Mocha/Mock.html +0 -1237
- data/docs/Mocha/ObjectMethods.html +0 -765
- data/docs/Mocha/ParameterMatchers.html +0 -2961
- data/docs/Mocha/ParameterMatchers/AllOf.html +0 -153
- data/docs/Mocha/ParameterMatchers/AnyOf.html +0 -153
- data/docs/Mocha/ParameterMatchers/AnyParameters.html +0 -153
- data/docs/Mocha/ParameterMatchers/Anything.html +0 -153
- data/docs/Mocha/ParameterMatchers/Base.html +0 -441
- data/docs/Mocha/ParameterMatchers/Equals.html +0 -153
- data/docs/Mocha/ParameterMatchers/EquivalentUri.html +0 -153
- data/docs/Mocha/ParameterMatchers/HasEntries.html +0 -153
- data/docs/Mocha/ParameterMatchers/HasEntry.html +0 -153
- data/docs/Mocha/ParameterMatchers/HasKey.html +0 -153
- data/docs/Mocha/ParameterMatchers/HasValue.html +0 -153
- data/docs/Mocha/ParameterMatchers/Includes.html +0 -153
- data/docs/Mocha/ParameterMatchers/InstanceOf.html +0 -153
- data/docs/Mocha/ParameterMatchers/IsA.html +0 -153
- data/docs/Mocha/ParameterMatchers/KindOf.html +0 -153
- data/docs/Mocha/ParameterMatchers/Not.html +0 -153
- data/docs/Mocha/ParameterMatchers/Optionally.html +0 -153
- data/docs/Mocha/ParameterMatchers/RegexpMatches.html +0 -153
- data/docs/Mocha/ParameterMatchers/RespondsWith.html +0 -153
- data/docs/Mocha/ParameterMatchers/YamlEquivalent.html +0 -153
- data/docs/Mocha/Sequence.html +0 -149
- data/docs/Mocha/StateMachine.html +0 -527
- data/docs/Mocha/StateMachine/State.html +0 -140
- data/docs/Mocha/StateMachine/StatePredicate.html +0 -140
- data/docs/Mocha/StubbingError.html +0 -150
- data/docs/_index.html +0 -519
- data/docs/class_list.html +0 -51
- data/docs/css/common.css +0 -1
- data/docs/css/full_list.css +0 -58
- data/docs/css/style.css +0 -496
- data/docs/file.COPYING.html +0 -81
- data/docs/file.MIT-LICENSE.html +0 -85
- data/docs/file.README.html +0 -448
- data/docs/file.RELEASE.html +0 -963
- data/docs/file_list.html +0 -71
- data/docs/frames.html +0 -17
- data/docs/index.html +0 -448
- data/docs/js/app.js +0 -303
- data/docs/js/full_list.js +0 -216
- data/docs/js/jquery.js +0 -4
- data/docs/method_list.html +0 -627
- data/docs/top-level-namespace.html +0 -118
- data/lib/mocha/multiple_yields.rb +0 -15
- data/lib/mocha/no_yields.rb +0 -5
- data/lib/mocha/pretty_parameters.rb +0 -24
- data/lib/mocha/single_yield.rb +0 -13
- data/test/acceptance/acceptance_test_helper.rb +0 -41
- data/test/acceptance/bug_18914_test.rb +0 -37
- data/test/acceptance/bug_21465_test.rb +0 -31
- data/test/acceptance/bug_21563_test.rb +0 -22
- data/test/acceptance/display_matching_invocations_alongside_expectations_test.rb +0 -69
- data/test/acceptance/exception_rescue_test.rb +0 -53
- data/test/acceptance/expectations_on_multiple_methods_test.rb +0 -55
- data/test/acceptance/expected_invocation_count_test.rb +0 -229
- data/test/acceptance/failure_messages_test.rb +0 -61
- data/test/acceptance/issue_272_test.rb +0 -50
- data/test/acceptance/issue_65_test.rb +0 -64
- data/test/acceptance/issue_70_test.rb +0 -53
- data/test/acceptance/mocha_example_test.rb +0 -96
- data/test/acceptance/mocha_test_result_test.rb +0 -83
- data/test/acceptance/mock_test.rb +0 -139
- data/test/acceptance/mocked_methods_dispatch_test.rb +0 -75
- data/test/acceptance/multiple_expectations_failure_message_test.rb +0 -66
- data/test/acceptance/optional_parameters_test.rb +0 -67
- data/test/acceptance/parameter_matcher_test.rb +0 -299
- data/test/acceptance/partial_mocks_test.rb +0 -44
- data/test/acceptance/prepend_test.rb +0 -86
- data/test/acceptance/prevent_use_of_mocha_outside_test_test.rb +0 -76
- data/test/acceptance/raise_exception_test.rb +0 -36
- data/test/acceptance/return_value_test.rb +0 -49
- data/test/acceptance/sequence_test.rb +0 -189
- data/test/acceptance/states_test.rb +0 -71
- data/test/acceptance/stub_any_instance_method_defined_on_superclass_test.rb +0 -64
- data/test/acceptance/stub_any_instance_method_test.rb +0 -301
- data/test/acceptance/stub_class_method_defined_on_active_record_association_proxy_test.rb +0 -105
- data/test/acceptance/stub_class_method_defined_on_class_test.rb +0 -78
- data/test/acceptance/stub_class_method_defined_on_module_test.rb +0 -73
- data/test/acceptance/stub_class_method_defined_on_superclass_test.rb +0 -144
- data/test/acceptance/stub_everything_test.rb +0 -53
- data/test/acceptance/stub_instance_method_defined_on_active_record_association_proxy_test.rb +0 -91
- data/test/acceptance/stub_instance_method_defined_on_class_and_aliased_test.rb +0 -67
- data/test/acceptance/stub_instance_method_defined_on_class_test.rb +0 -67
- data/test/acceptance/stub_instance_method_defined_on_kernel_module_test.rb +0 -136
- data/test/acceptance/stub_instance_method_defined_on_module_test.rb +0 -76
- data/test/acceptance/stub_instance_method_defined_on_object_class_test.rb +0 -75
- data/test/acceptance/stub_instance_method_defined_on_singleton_class_test.rb +0 -67
- data/test/acceptance/stub_instance_method_defined_on_superclass_test.rb +0 -70
- data/test/acceptance/stub_method_defined_on_module_and_aliased_test.rb +0 -38
- data/test/acceptance/stub_module_method_test.rb +0 -200
- data/test/acceptance/stub_test.rb +0 -49
- data/test/acceptance/stubba_example_test.rb +0 -93
- data/test/acceptance/stubba_test_result_test.rb +0 -71
- data/test/acceptance/stubbing_error_backtrace_test.rb +0 -63
- data/test/acceptance/stubbing_frozen_object_test.rb +0 -88
- data/test/acceptance/stubbing_method_accepting_block_parameter_test.rb +0 -52
- data/test/acceptance/stubbing_method_unnecessarily_test.rb +0 -63
- data/test/acceptance/stubbing_nil_test.rb +0 -60
- data/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +0 -157
- data/test/acceptance/stubbing_non_existent_class_method_test.rb +0 -157
- data/test/acceptance/stubbing_non_existent_instance_method_test.rb +0 -145
- data/test/acceptance/stubbing_non_public_any_instance_method_test.rb +0 -128
- data/test/acceptance/stubbing_non_public_class_method_test.rb +0 -163
- data/test/acceptance/stubbing_non_public_instance_method_test.rb +0 -141
- data/test/acceptance/stubbing_on_non_mock_object_test.rb +0 -70
- data/test/acceptance/stubbing_same_class_method_on_parent_and_child_classes_test.rb +0 -33
- data/test/acceptance/throw_test.rb +0 -42
- data/test/acceptance/unexpected_invocation_test.rb +0 -23
- data/test/acceptance/unstubbing_test.rb +0 -194
- data/test/assertions.rb +0 -8
- data/test/deprecation_disabler.rb +0 -15
- data/test/execution_point.rb +0 -36
- data/test/integration/mini_test_test.rb +0 -8
- data/test/integration/shared_tests.rb +0 -178
- data/test/integration/test_unit_test.rb +0 -8
- data/test/method_definer.rb +0 -16
- data/test/mini_test_result.rb +0 -96
- data/test/minitest_result.rb +0 -48
- data/test/simple_counter.rb +0 -11
- data/test/test_helper.rb +0 -58
- data/test/test_runner.rb +0 -58
- data/test/test_unit_result.rb +0 -22
- data/test/unit/any_instance_method_test.rb +0 -175
- data/test/unit/array_inspect_test.rb +0 -14
- data/test/unit/backtrace_filter_test.rb +0 -17
- data/test/unit/cardinality_test.rb +0 -72
- data/test/unit/central_test.rb +0 -98
- data/test/unit/change_state_side_effect_test.rb +0 -37
- data/test/unit/class_methods_test.rb +0 -69
- data/test/unit/configuration_test.rb +0 -37
- data/test/unit/date_time_inspect_test.rb +0 -19
- data/test/unit/exception_raiser_test.rb +0 -45
- data/test/unit/expectation_list_test.rb +0 -82
- data/test/unit/expectation_test.rb +0 -477
- data/test/unit/hash_inspect_test.rb +0 -14
- data/test/unit/hooks_test.rb +0 -35
- data/test/unit/in_state_ordering_constraint_test.rb +0 -39
- data/test/unit/instance_method_test.rb +0 -282
- data/test/unit/method_matcher_test.rb +0 -26
- data/test/unit/mock_test.rb +0 -372
- data/test/unit/mockery_test.rb +0 -171
- data/test/unit/module_methods_test.rb +0 -16
- data/test/unit/multiple_yields_test.rb +0 -16
- data/test/unit/no_yields_test.rb +0 -16
- data/test/unit/object_inspect_test.rb +0 -60
- data/test/unit/object_methods_test.rb +0 -63
- data/test/unit/parameter_matchers/all_of_test.rb +0 -24
- data/test/unit/parameter_matchers/any_of_test.rb +0 -24
- data/test/unit/parameter_matchers/anything_test.rb +0 -19
- data/test/unit/parameter_matchers/equals_test.rb +0 -23
- data/test/unit/parameter_matchers/equivalent_uri_test.rb +0 -41
- data/test/unit/parameter_matchers/has_entries_test.rb +0 -51
- data/test/unit/parameter_matchers/has_entry_test.rb +0 -128
- data/test/unit/parameter_matchers/has_key_test.rb +0 -54
- data/test/unit/parameter_matchers/has_value_test.rb +0 -55
- data/test/unit/parameter_matchers/includes_test.rb +0 -106
- data/test/unit/parameter_matchers/instance_of_test.rb +0 -23
- data/test/unit/parameter_matchers/is_a_test.rb +0 -23
- data/test/unit/parameter_matchers/kind_of_test.rb +0 -23
- data/test/unit/parameter_matchers/not_test.rb +0 -24
- data/test/unit/parameter_matchers/regexp_matches_test.rb +0 -45
- data/test/unit/parameter_matchers/responds_with_test.rb +0 -38
- data/test/unit/parameter_matchers/stub_matcher.rb +0 -23
- data/test/unit/parameter_matchers/yaml_equivalent_test.rb +0 -23
- data/test/unit/parameters_matcher_test.rb +0 -119
- data/test/unit/receivers_test.rb +0 -96
- data/test/unit/return_values_test.rb +0 -66
- data/test/unit/sequence_test.rb +0 -100
- data/test/unit/single_return_value_test.rb +0 -17
- data/test/unit/single_yield_test.rb +0 -16
- data/test/unit/state_machine_test.rb +0 -96
- data/test/unit/string_inspect_test.rb +0 -9
- data/test/unit/thrower_test.rb +0 -23
- 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
|
-
— 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> »
|
40
|
-
<span class='title'><span class='object_link'><a href="../Mocha.html" title="Mocha (module)">Mocha</a></span></span>
|
41
|
-
»
|
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
|
-
— 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> »
|
40
|
-
<span class='title'><span class='object_link'><a href="../Mocha.html" title="Mocha (module)">Mocha</a></span></span>
|
41
|
-
»
|
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> ⇒ 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> ⇒ <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
|
-
—
|
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>
|
data/docs/Mocha/Hooks.html
DELETED
@@ -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
|
-
— 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> »
|
40
|
-
<span class='title'><span class='object_link'><a href="../Mocha.html" title="Mocha (module)">Mocha</a></span></span>
|
41
|
-
»
|
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> ⇒ 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> ⇒ 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) ⇒ 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> ⇒ <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> ⇒ <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) ⇒ <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>
|