mocha 1.10.2 → 1.11.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/RELEASE.md +18 -0
- data/Rakefile +1 -4
- data/docs/Mocha.html +2 -2
- data/docs/Mocha/API.html +2 -2
- data/docs/Mocha/ClassMethods.html +2 -2
- data/docs/Mocha/Configuration.html +2 -2
- data/docs/Mocha/Expectation.html +284 -76
- data/docs/Mocha/ExpectationError.html +2 -2
- data/docs/Mocha/ExpectationErrorFactory.html +2 -2
- data/docs/Mocha/Hooks.html +2 -2
- data/docs/Mocha/Integration.html +2 -2
- data/docs/Mocha/Integration/MiniTest.html +2 -2
- data/docs/Mocha/Integration/MiniTest/Adapter.html +2 -2
- data/docs/Mocha/Integration/TestUnit.html +2 -2
- data/docs/Mocha/Integration/TestUnit/Adapter.html +2 -2
- data/docs/Mocha/Mock.html +2 -2
- data/docs/Mocha/ObjectMethods.html +2 -2
- data/docs/Mocha/ParameterMatchers.html +2 -2
- data/docs/Mocha/ParameterMatchers/AllOf.html +2 -2
- data/docs/Mocha/ParameterMatchers/AnyOf.html +2 -2
- data/docs/Mocha/ParameterMatchers/AnyParameters.html +2 -2
- data/docs/Mocha/ParameterMatchers/Anything.html +2 -2
- data/docs/Mocha/ParameterMatchers/Base.html +2 -2
- data/docs/Mocha/ParameterMatchers/Equals.html +2 -2
- data/docs/Mocha/ParameterMatchers/EquivalentUri.html +2 -2
- data/docs/Mocha/ParameterMatchers/HasEntries.html +2 -2
- data/docs/Mocha/ParameterMatchers/HasEntry.html +2 -2
- data/docs/Mocha/ParameterMatchers/HasKey.html +2 -2
- data/docs/Mocha/ParameterMatchers/HasValue.html +2 -2
- data/docs/Mocha/ParameterMatchers/Includes.html +2 -2
- data/docs/Mocha/ParameterMatchers/InstanceOf.html +2 -2
- data/docs/Mocha/ParameterMatchers/IsA.html +2 -2
- data/docs/Mocha/ParameterMatchers/KindOf.html +2 -2
- data/docs/Mocha/ParameterMatchers/Not.html +2 -2
- data/docs/Mocha/ParameterMatchers/Optionally.html +2 -2
- data/docs/Mocha/ParameterMatchers/RegexpMatches.html +2 -2
- data/docs/Mocha/ParameterMatchers/RespondsWith.html +2 -2
- data/docs/Mocha/ParameterMatchers/YamlEquivalent.html +2 -2
- data/docs/Mocha/Sequence.html +2 -2
- data/docs/Mocha/StateMachine.html +2 -2
- data/docs/Mocha/StateMachine/State.html +2 -2
- data/docs/Mocha/StateMachine/StatePredicate.html +2 -2
- data/docs/Mocha/StubbingError.html +2 -2
- data/docs/_index.html +3 -3
- data/docs/file.COPYING.html +2 -2
- data/docs/file.MIT-LICENSE.html +2 -2
- data/docs/file.README.html +2 -2
- data/docs/file.RELEASE.html +30 -2
- data/docs/frames.html +1 -1
- data/docs/index.html +2 -2
- data/docs/method_list.html +20 -4
- data/docs/top-level-namespace.html +2 -2
- data/lib/mocha/block_matcher.rb +31 -0
- data/lib/mocha/expectation.rb +47 -6
- data/lib/mocha/invocation.rb +9 -5
- data/lib/mocha/version.rb +1 -1
- data/lib/mocha/yield_parameters.rb +5 -11
- data/test/acceptance/acceptance_test_helper.rb +1 -0
- data/test/acceptance/display_matching_invocations_alongside_expectations_test.rb +5 -5
- data/test/acceptance/failure_messages_test.rb +16 -0
- data/test/acceptance/multiple_yielding_test.rb +56 -0
- data/test/acceptance/yielding_test.rb +78 -0
- data/test/unit/expectation_test.rb +15 -1
- data/test/unit/yield_parameters_test.rb +35 -53
- metadata +6 -8
- data/lib/mocha/multiple_yields.rb +0 -15
- data/lib/mocha/no_yields.rb +0 -5
- data/lib/mocha/single_yield.rb +0 -13
- data/test/unit/multiple_yields_test.rb +0 -16
- data/test/unit/no_yields_test.rb +0 -16
- data/test/unit/single_yield_test.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de1adbcbd8913b597601bdb8f9b028ee9ecc4be3bb61aadb2cd6afa959e34262
|
4
|
+
data.tar.gz: bca0a0766a125de6bb4a03b73416c6801435fc7587ce68eedd09ca883e48613b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04d916cde854d9b112ca1130d6933e8fc4f86ef0d95ca3d857ddd33b1992173f6d735463caaacaa6305d42eb22dd8e3e445cc9eabf3071434e0d6af58923710d
|
7
|
+
data.tar.gz: 18d7cc9adc53c84c2f26f3c1b32069678eb394791cadfed2986696f0ecdca29223c787f22e6f22f54c6a534969f117af3ddfe075598647ad4afc0f57aac1d473
|
data/.github/FUNDING.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
github: floehopper
|
data/.yardopts
CHANGED
data/RELEASE.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# Release Notes
|
2
2
|
|
3
|
+
## 1.11.0
|
4
|
+
|
5
|
+
### External changes
|
6
|
+
|
7
|
+
* Add `Expectation#with_block_given` & `Expectation#with_no_block_given` (#441).
|
8
|
+
* Allows non-deprecated solution for #382. Thanks to @yemartin for reporting and to @techbelly & @nitishr for feedback.
|
9
|
+
* Fix issue with non-Array arguments passed to `Expectation#multiple_yields` (#444).
|
10
|
+
* The undocumented behaviour is now properly supported and documented.
|
11
|
+
|
12
|
+
### Internal changes
|
13
|
+
|
14
|
+
* Move static YARD options from Rake task to `.yardopts` file - thanks to @nitishr (#429)
|
15
|
+
* Simplify implementation of yielding functionality - thanks to @nitishr (#439)
|
16
|
+
* Add missing require statement to `acceptance_test_helper.rb` (1070fc02)
|
17
|
+
* Add some baseline acceptance tests for yielding behaviour (c2cac911)
|
18
|
+
* Display a sponsor button on GitHub repo page (9fc5911b)
|
19
|
+
* Use new Deprecation.warning behaviour in `Invocation#call` (932d1166)
|
20
|
+
|
3
21
|
## 1.10.2
|
4
22
|
|
5
23
|
* Optionally reinstate undocumented behaviour from v1.9. This introduces a new configuration option (`reinstate_undocumented_behaviour_from_v1_9`) to reinstate a couple of bits of undocumented behaviour from v1.9 which were changed in v1.10 without any prior deprecation warning (#438):
|
data/Rakefile
CHANGED
@@ -138,10 +138,7 @@ if ENV['MOCHA_GENERATE_DOCS']
|
|
138
138
|
|
139
139
|
desc 'Generate documentation'
|
140
140
|
YARD::Rake::YardocTask.new('yardoc' => 'docs_environment') do |task|
|
141
|
-
task.options = [
|
142
|
-
'--title', "Mocha #{Mocha::VERSION}",
|
143
|
-
'--output-dir', 'docs'
|
144
|
-
]
|
141
|
+
task.options = ['--title', "Mocha #{Mocha::VERSION}"]
|
145
142
|
end
|
146
143
|
|
147
144
|
task 'checkout_docs_cname' do
|
data/docs/Mocha.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Module: Mocha
|
8
8
|
|
9
|
-
— Mocha 1.
|
9
|
+
— Mocha 1.11.0
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -244,7 +244,7 @@
|
|
244
244
|
</div>
|
245
245
|
|
246
246
|
<div id="footer">
|
247
|
-
Generated on
|
247
|
+
Generated on Mon Dec 16 18:49:50 2019 by
|
248
248
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
249
249
|
0.9.20 (ruby-2.6.5).
|
250
250
|
</div>
|
data/docs/Mocha/API.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Module: Mocha::API
|
8
8
|
|
9
|
-
— Mocha 1.
|
9
|
+
— Mocha 1.11.0
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -1277,7 +1277,7 @@
|
|
1277
1277
|
</div>
|
1278
1278
|
|
1279
1279
|
<div id="footer">
|
1280
|
-
Generated on
|
1280
|
+
Generated on Mon Dec 16 18:49:51 2019 by
|
1281
1281
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1282
1282
|
0.9.20 (ruby-2.6.5).
|
1283
1283
|
</div>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Module: Mocha::ClassMethods
|
8
8
|
|
9
|
-
— Mocha 1.
|
9
|
+
— Mocha 1.11.0
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -254,7 +254,7 @@
|
|
254
254
|
</div>
|
255
255
|
|
256
256
|
<div id="footer">
|
257
|
-
Generated on
|
257
|
+
Generated on Mon Dec 16 18:49:51 2019 by
|
258
258
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
259
259
|
0.9.20 (ruby-2.6.5).
|
260
260
|
</div>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Class: Mocha::Configuration
|
8
8
|
|
9
|
-
— Mocha 1.
|
9
|
+
— Mocha 1.11.0
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -1515,7 +1515,7 @@ unsatisfied expectations:
|
|
1515
1515
|
</div>
|
1516
1516
|
|
1517
1517
|
<div id="footer">
|
1518
|
-
Generated on
|
1518
|
+
Generated on Mon Dec 16 18:49:52 2019 by
|
1519
1519
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1520
1520
|
0.9.20 (ruby-2.6.5).
|
1521
1521
|
</div>
|
data/docs/Mocha/Expectation.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Class: Mocha::Expectation
|
8
8
|
|
9
|
-
— Mocha 1.
|
9
|
+
— Mocha 1.11.0
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -506,6 +506,54 @@
|
|
506
506
|
<p>Modifies expectation so that the expected method must be called with <code>expected_parameters</code>.</p>
|
507
507
|
</div></span>
|
508
508
|
|
509
|
+
</li>
|
510
|
+
|
511
|
+
|
512
|
+
<li class="public ">
|
513
|
+
<span class="summary_signature">
|
514
|
+
|
515
|
+
<a href="#with_block_given-instance_method" title="#with_block_given (instance method)">#<strong>with_block_given</strong> ⇒ Expectation </a>
|
516
|
+
|
517
|
+
|
518
|
+
|
519
|
+
</span>
|
520
|
+
|
521
|
+
|
522
|
+
|
523
|
+
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
<span class="summary_desc"><div class='inline'>
|
530
|
+
<p>Modifies expectation so that the expected method must be called with a block.</p>
|
531
|
+
</div></span>
|
532
|
+
|
533
|
+
</li>
|
534
|
+
|
535
|
+
|
536
|
+
<li class="public ">
|
537
|
+
<span class="summary_signature">
|
538
|
+
|
539
|
+
<a href="#with_no_block_given-instance_method" title="#with_no_block_given (instance method)">#<strong>with_no_block_given</strong> ⇒ Expectation </a>
|
540
|
+
|
541
|
+
|
542
|
+
|
543
|
+
</span>
|
544
|
+
|
545
|
+
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
|
550
|
+
|
551
|
+
|
552
|
+
|
553
|
+
<span class="summary_desc"><div class='inline'>
|
554
|
+
<p>Modifies expectation so that the expected method must be called without a block.</p>
|
555
|
+
</div></span>
|
556
|
+
|
509
557
|
</li>
|
510
558
|
|
511
559
|
|
@@ -626,13 +674,13 @@
|
|
626
674
|
<pre class="lines">
|
627
675
|
|
628
676
|
|
629
|
-
131
|
630
677
|
132
|
631
678
|
133
|
632
|
-
134
|
679
|
+
134
|
680
|
+
135</pre>
|
633
681
|
</td>
|
634
682
|
<td>
|
635
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line
|
683
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 132</span>
|
636
684
|
|
637
685
|
<span class='kw'>def</span> <span class='id identifier rubyid_at_least'>at_least</span><span class='lparen'>(</span><span class='id identifier rubyid_minimum_number_of_times'>minimum_number_of_times</span><span class='rparen'>)</span>
|
638
686
|
<span class='ivar'>@cardinality</span> <span class='op'>=</span> <span class='const'>Cardinality</span><span class='period'>.</span><span class='id identifier rubyid_at_least'>at_least</span><span class='lparen'>(</span><span class='id identifier rubyid_minimum_number_of_times'>minimum_number_of_times</span><span class='rparen'>)</span>
|
@@ -706,13 +754,13 @@
|
|
706
754
|
<pre class="lines">
|
707
755
|
|
708
756
|
|
709
|
-
149
|
710
757
|
150
|
711
758
|
151
|
712
|
-
152
|
759
|
+
152
|
760
|
+
153</pre>
|
713
761
|
</td>
|
714
762
|
<td>
|
715
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line
|
763
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 150</span>
|
716
764
|
|
717
765
|
<span class='kw'>def</span> <span class='id identifier rubyid_at_least_once'>at_least_once</span>
|
718
766
|
<span class='id identifier rubyid_at_least'>at_least</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
|
@@ -806,13 +854,13 @@
|
|
806
854
|
<pre class="lines">
|
807
855
|
|
808
856
|
|
809
|
-
168
|
810
857
|
169
|
811
858
|
170
|
812
|
-
171
|
859
|
+
171
|
860
|
+
172</pre>
|
813
861
|
</td>
|
814
862
|
<td>
|
815
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line
|
863
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 169</span>
|
816
864
|
|
817
865
|
<span class='kw'>def</span> <span class='id identifier rubyid_at_most'>at_most</span><span class='lparen'>(</span><span class='id identifier rubyid_maximum_number_of_times'>maximum_number_of_times</span><span class='rparen'>)</span>
|
818
866
|
<span class='ivar'>@cardinality</span> <span class='op'>=</span> <span class='const'>Cardinality</span><span class='period'>.</span><span class='id identifier rubyid_at_most'>at_most</span><span class='lparen'>(</span><span class='id identifier rubyid_maximum_number_of_times'>maximum_number_of_times</span><span class='rparen'>)</span>
|
@@ -886,13 +934,13 @@
|
|
886
934
|
<pre class="lines">
|
887
935
|
|
888
936
|
|
889
|
-
186
|
890
937
|
187
|
891
938
|
188
|
892
|
-
189
|
939
|
+
189
|
940
|
+
190</pre>
|
893
941
|
</td>
|
894
942
|
<td>
|
895
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line
|
943
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 187</span>
|
896
944
|
|
897
945
|
<span class='kw'>def</span> <span class='id identifier rubyid_at_most_once'>at_most_once</span>
|
898
946
|
<span class='id identifier rubyid_at_most'>at_most</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
|
@@ -1015,13 +1063,13 @@
|
|
1015
1063
|
<pre class="lines">
|
1016
1064
|
|
1017
1065
|
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1066
|
+
539
|
1067
|
+
540
|
1068
|
+
541
|
1069
|
+
542</pre>
|
1022
1070
|
</td>
|
1023
1071
|
<td>
|
1024
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line
|
1072
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 539</span>
|
1025
1073
|
|
1026
1074
|
<span class='kw'>def</span> <span class='id identifier rubyid_in_sequence'>in_sequence</span><span class='lparen'>(</span><span class='id identifier rubyid_sequence'>sequence</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_sequences'>sequences</span><span class='rparen'>)</span>
|
1027
1075
|
<span class='id identifier rubyid_sequences'>sequences</span><span class='period'>.</span><span class='id identifier rubyid_unshift'>unshift</span><span class='lparen'>(</span><span class='id identifier rubyid_sequence'>sequence</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_seq'>seq</span><span class='op'>|</span> <span class='id identifier rubyid_add_in_sequence_ordering_constraint'>add_in_sequence_ordering_constraint</span><span class='lparen'>(</span><span class='id identifier rubyid_seq'>seq</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
@@ -1094,7 +1142,7 @@
|
|
1094
1142
|
|
1095
1143
|
—
|
1096
1144
|
<div class='inline'>
|
1097
|
-
<p>each element of <code>parameter_groups</code> should iself be an <code>Array</code> representing the parameters to be passed to the block for a single yield
|
1145
|
+
<p>each element of <code>parameter_groups</code> should iself be an <code>Array</code> representing the parameters to be passed to the block for a single yield. Any element of <code>parameter_groups</code> that is not an <code>Array</code> is wrapped in an <code>Array</code>.</p>
|
1098
1146
|
</div>
|
1099
1147
|
|
1100
1148
|
</li>
|
@@ -1133,16 +1181,16 @@
|
|
1133
1181
|
<pre class="lines">
|
1134
1182
|
|
1135
1183
|
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1184
|
+
323
|
1185
|
+
324
|
1186
|
+
325
|
1187
|
+
326</pre>
|
1140
1188
|
</td>
|
1141
1189
|
<td>
|
1142
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line
|
1190
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 323</span>
|
1143
1191
|
|
1144
1192
|
<span class='kw'>def</span> <span class='id identifier rubyid_multiple_yields'>multiple_yields</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_parameter_groups'>parameter_groups</span><span class='rparen'>)</span>
|
1145
|
-
<span class='ivar'>@yield_parameters</span><span class='period'>.</span><span class='id identifier
|
1193
|
+
<span class='ivar'>@yield_parameters</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_parameter_groups'>parameter_groups</span><span class='rparen'>)</span>
|
1146
1194
|
<span class='kw'>self</span>
|
1147
1195
|
<span class='kw'>end</span></pre>
|
1148
1196
|
</td>
|
@@ -1212,13 +1260,13 @@
|
|
1212
1260
|
<pre class="lines">
|
1213
1261
|
|
1214
1262
|
|
1215
|
-
111
|
1216
1263
|
112
|
1217
1264
|
113
|
1218
|
-
114
|
1265
|
+
114
|
1266
|
+
115</pre>
|
1219
1267
|
</td>
|
1220
1268
|
<td>
|
1221
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line
|
1269
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 112</span>
|
1222
1270
|
|
1223
1271
|
<span class='kw'>def</span> <span class='id identifier rubyid_never'>never</span>
|
1224
1272
|
<span class='ivar'>@cardinality</span> <span class='op'>=</span> <span class='const'>Cardinality</span><span class='period'>.</span><span class='id identifier rubyid_exactly'>exactly</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span>
|
@@ -1299,13 +1347,13 @@
|
|
1299
1347
|
<pre class="lines">
|
1300
1348
|
|
1301
1349
|
|
1302
|
-
94
|
1303
1350
|
95
|
1304
1351
|
96
|
1305
|
-
97
|
1352
|
+
97
|
1353
|
+
98</pre>
|
1306
1354
|
</td>
|
1307
1355
|
<td>
|
1308
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line
|
1356
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 95</span>
|
1309
1357
|
|
1310
1358
|
<span class='kw'>def</span> <span class='id identifier rubyid_once'>once</span>
|
1311
1359
|
<span class='ivar'>@cardinality</span> <span class='op'>=</span> <span class='const'>Cardinality</span><span class='period'>.</span><span class='id identifier rubyid_exactly'>exactly</span><span class='lparen'>(</span><span class='int'>1</span><span class='rparen'>)</span>
|
@@ -1459,13 +1507,13 @@
|
|
1459
1507
|
<pre class="lines">
|
1460
1508
|
|
1461
1509
|
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1510
|
+
410
|
1511
|
+
411
|
1512
|
+
412
|
1513
|
+
413</pre>
|
1466
1514
|
</td>
|
1467
1515
|
<td>
|
1468
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line
|
1516
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 410</span>
|
1469
1517
|
|
1470
1518
|
<span class='kw'>def</span> <span class='id identifier rubyid_raises'>raises</span><span class='lparen'>(</span><span class='id identifier rubyid_exception'>exception</span> <span class='op'>=</span> <span class='const'>RuntimeError</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1471
1519
|
<span class='ivar'>@return_values</span> <span class='op'>+=</span> <span class='const'>ReturnValues</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>ExceptionRaiser</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_exception'>exception</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
@@ -1664,13 +1712,13 @@
|
|
1664
1712
|
<pre class="lines">
|
1665
1713
|
|
1666
1714
|
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
1670
|
-
|
1715
|
+
370
|
1716
|
+
371
|
1717
|
+
372
|
1718
|
+
373</pre>
|
1671
1719
|
</td>
|
1672
1720
|
<td>
|
1673
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line
|
1721
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 370</span>
|
1674
1722
|
|
1675
1723
|
<span class='kw'>def</span> <span class='id identifier rubyid_returns'>returns</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_values'>values</span><span class='rparen'>)</span>
|
1676
1724
|
<span class='ivar'>@return_values</span> <span class='op'>+=</span> <span class='const'>ReturnValues</span><span class='period'>.</span><span class='id identifier rubyid_build'>build</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_values'>values</span><span class='rparen'>)</span>
|
@@ -1831,16 +1879,16 @@
|
|
1831
1879
|
<pre class="lines">
|
1832
1880
|
|
1833
1881
|
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
1882
|
+
484
|
1883
|
+
485
|
1884
|
+
486
|
1885
|
+
487
|
1886
|
+
488
|
1887
|
+
489
|
1888
|
+
490</pre>
|
1841
1889
|
</td>
|
1842
1890
|
<td>
|
1843
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line
|
1891
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 484</span>
|
1844
1892
|
|
1845
1893
|
<span class='kw'>def</span> <span class='kw'>then</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_parameters'>parameters</span><span class='rparen'>)</span>
|
1846
1894
|
<span class='kw'>if</span> <span class='id identifier rubyid_parameters'>parameters</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>==</span> <span class='int'>1</span>
|
@@ -1993,13 +2041,13 @@
|
|
1993
2041
|
<pre class="lines">
|
1994
2042
|
|
1995
2043
|
|
1996
|
-
|
1997
|
-
|
1998
|
-
|
1999
|
-
|
2044
|
+
449
|
2045
|
+
450
|
2046
|
+
451
|
2047
|
+
452</pre>
|
2000
2048
|
</td>
|
2001
2049
|
<td>
|
2002
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line
|
2050
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 449</span>
|
2003
2051
|
|
2004
2052
|
<span class='kw'>def</span> <span class='id identifier rubyid_throws'>throws</span><span class='lparen'>(</span><span class='id identifier rubyid_tag'>tag</span><span class='comma'>,</span> <span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
2005
2053
|
<span class='ivar'>@return_values</span> <span class='op'>+=</span> <span class='const'>ReturnValues</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'>Thrower</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_tag'>tag</span><span class='comma'>,</span> <span class='id identifier rubyid_object'>object</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
@@ -2109,13 +2157,13 @@
|
|
2109
2157
|
<pre class="lines">
|
2110
2158
|
|
2111
2159
|
|
2112
|
-
43
|
2113
2160
|
44
|
2114
2161
|
45
|
2115
|
-
46
|
2162
|
+
46
|
2163
|
+
47</pre>
|
2116
2164
|
</td>
|
2117
2165
|
<td>
|
2118
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line
|
2166
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 44</span>
|
2119
2167
|
|
2120
2168
|
<span class='kw'>def</span> <span class='id identifier rubyid_times'>times</span><span class='lparen'>(</span><span class='id identifier rubyid_range'>range</span><span class='rparen'>)</span>
|
2121
2169
|
<span class='ivar'>@cardinality</span> <span class='op'>=</span> <span class='const'>Cardinality</span><span class='period'>.</span><span class='id identifier rubyid_times'>times</span><span class='lparen'>(</span><span class='id identifier rubyid_range'>range</span><span class='rparen'>)</span>
|
@@ -2197,13 +2245,13 @@
|
|
2197
2245
|
<pre class="lines">
|
2198
2246
|
|
2199
2247
|
|
2200
|
-
69
|
2201
2248
|
70
|
2202
2249
|
71
|
2203
|
-
72
|
2250
|
+
72
|
2251
|
+
73</pre>
|
2204
2252
|
</td>
|
2205
2253
|
<td>
|
2206
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line
|
2254
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 70</span>
|
2207
2255
|
|
2208
2256
|
<span class='kw'>def</span> <span class='id identifier rubyid_twice'>twice</span>
|
2209
2257
|
<span class='ivar'>@cardinality</span> <span class='op'>=</span> <span class='const'>Cardinality</span><span class='period'>.</span><span class='id identifier rubyid_exactly'>exactly</span><span class='lparen'>(</span><span class='int'>2</span><span class='rparen'>)</span>
|
@@ -2309,13 +2357,13 @@
|
|
2309
2357
|
<pre class="lines">
|
2310
2358
|
|
2311
2359
|
|
2312
|
-
|
2313
|
-
|
2314
|
-
|
2315
|
-
|
2360
|
+
511
|
2361
|
+
512
|
2362
|
+
513
|
2363
|
+
514</pre>
|
2316
2364
|
</td>
|
2317
2365
|
<td>
|
2318
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line
|
2366
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 511</span>
|
2319
2367
|
|
2320
2368
|
<span class='kw'>def</span> <span class='kw'>when</span><span class='lparen'>(</span><span class='id identifier rubyid_state_predicate'>state_predicate</span><span class='rparen'>)</span>
|
2321
2369
|
<span class='id identifier rubyid_add_ordering_constraint'>add_ordering_constraint</span><span class='lparen'>(</span><span class='const'>InStateOrderingConstraint</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_state_predicate'>state_predicate</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
@@ -2483,13 +2531,13 @@
|
|
2483
2531
|
<pre class="lines">
|
2484
2532
|
|
2485
2533
|
|
2486
|
-
222
|
2487
2534
|
223
|
2488
2535
|
224
|
2489
|
-
225
|
2536
|
+
225
|
2537
|
+
226</pre>
|
2490
2538
|
</td>
|
2491
2539
|
<td>
|
2492
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line
|
2540
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 223</span>
|
2493
2541
|
|
2494
2542
|
<span class='kw'>def</span> <span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_expected_parameters'>expected_parameters</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_matching_block'>matching_block</span><span class='rparen'>)</span>
|
2495
2543
|
<span class='ivar'>@parameters_matcher</span> <span class='op'>=</span> <span class='const'>ParametersMatcher</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_expected_parameters'>expected_parameters</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_matching_block'>matching_block</span><span class='rparen'>)</span>
|
@@ -2498,6 +2546,168 @@
|
|
2498
2546
|
</td>
|
2499
2547
|
</tr>
|
2500
2548
|
</table>
|
2549
|
+
</div>
|
2550
|
+
|
2551
|
+
<div class="method_details ">
|
2552
|
+
<h3 class="signature " id="with_block_given-instance_method">
|
2553
|
+
|
2554
|
+
#<strong>with_block_given</strong> ⇒ <tt><span class='object_link'><a href="" title="Mocha::Expectation (class)">Expectation</a></span></tt>
|
2555
|
+
|
2556
|
+
|
2557
|
+
|
2558
|
+
|
2559
|
+
|
2560
|
+
</h3><div class="docstring">
|
2561
|
+
<div class="discussion">
|
2562
|
+
|
2563
|
+
<p>Modifies expectation so that the expected method must be called with a block.</p>
|
2564
|
+
|
2565
|
+
|
2566
|
+
</div>
|
2567
|
+
</div>
|
2568
|
+
<div class="tags">
|
2569
|
+
|
2570
|
+
<div class="examples">
|
2571
|
+
<p class="tag_title">Examples:</p>
|
2572
|
+
|
2573
|
+
|
2574
|
+
<p class="example_title"><div class='inline'>
|
2575
|
+
<p>Expected method must be called with a block.</p>
|
2576
|
+
</div></p>
|
2577
|
+
|
2578
|
+
<pre class="example code"><code><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
|
2579
|
+
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:expected_method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with_block_given'>with_block_given</span>
|
2580
|
+
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expected_method'>expected_method</span> <span class='lbrace'>{</span> <span class='int'>1</span> <span class='op'>+</span> <span class='int'>1</span> <span class='rbrace'>}</span>
|
2581
|
+
<span class='comment'># => verify succeeds
|
2582
|
+
</span>
|
2583
|
+
<span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
|
2584
|
+
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:expected_method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with_block_given'>with_block_given</span>
|
2585
|
+
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expected_method'>expected_method</span>
|
2586
|
+
<span class='comment'># => verify fails</span></code></pre>
|
2587
|
+
|
2588
|
+
</div>
|
2589
|
+
|
2590
|
+
<p class="tag_title">Returns:</p>
|
2591
|
+
<ul class="return">
|
2592
|
+
|
2593
|
+
<li>
|
2594
|
+
|
2595
|
+
|
2596
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="Mocha::Expectation (class)">Expectation</a></span></tt>)</span>
|
2597
|
+
|
2598
|
+
|
2599
|
+
|
2600
|
+
—
|
2601
|
+
<div class='inline'>
|
2602
|
+
<p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span> methods to be chained.</p>
|
2603
|
+
</div>
|
2604
|
+
|
2605
|
+
</li>
|
2606
|
+
|
2607
|
+
</ul>
|
2608
|
+
|
2609
|
+
</div><table class="source_code">
|
2610
|
+
<tr>
|
2611
|
+
<td>
|
2612
|
+
<pre class="lines">
|
2613
|
+
|
2614
|
+
|
2615
|
+
242
|
2616
|
+
243
|
2617
|
+
244
|
2618
|
+
245</pre>
|
2619
|
+
</td>
|
2620
|
+
<td>
|
2621
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 242</span>
|
2622
|
+
|
2623
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_with_block_given'>with_block_given</span>
|
2624
|
+
<span class='ivar'>@block_matcher</span> <span class='op'>=</span> <span class='const'>BlockMatchers</span><span class='op'>::</span><span class='const'>BlockGiven</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
2625
|
+
<span class='kw'>self</span>
|
2626
|
+
<span class='kw'>end</span></pre>
|
2627
|
+
</td>
|
2628
|
+
</tr>
|
2629
|
+
</table>
|
2630
|
+
</div>
|
2631
|
+
|
2632
|
+
<div class="method_details ">
|
2633
|
+
<h3 class="signature " id="with_no_block_given-instance_method">
|
2634
|
+
|
2635
|
+
#<strong>with_no_block_given</strong> ⇒ <tt><span class='object_link'><a href="" title="Mocha::Expectation (class)">Expectation</a></span></tt>
|
2636
|
+
|
2637
|
+
|
2638
|
+
|
2639
|
+
|
2640
|
+
|
2641
|
+
</h3><div class="docstring">
|
2642
|
+
<div class="discussion">
|
2643
|
+
|
2644
|
+
<p>Modifies expectation so that the expected method must be called without a block.</p>
|
2645
|
+
|
2646
|
+
|
2647
|
+
</div>
|
2648
|
+
</div>
|
2649
|
+
<div class="tags">
|
2650
|
+
|
2651
|
+
<div class="examples">
|
2652
|
+
<p class="tag_title">Examples:</p>
|
2653
|
+
|
2654
|
+
|
2655
|
+
<p class="example_title"><div class='inline'>
|
2656
|
+
<p>Expected method must be called without a block.</p>
|
2657
|
+
</div></p>
|
2658
|
+
|
2659
|
+
<pre class="example code"><code><span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
|
2660
|
+
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:expected_method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with_no_block_given'>with_no_block_given</span>
|
2661
|
+
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expected_method'>expected_method</span>
|
2662
|
+
<span class='comment'># => verify succeeds
|
2663
|
+
</span>
|
2664
|
+
<span class='id identifier rubyid_object'>object</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='rparen'>)</span>
|
2665
|
+
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='symbol'>:expected_method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_with_block_given'>with_block_given</span>
|
2666
|
+
<span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_expected_method'>expected_method</span> <span class='lbrace'>{</span> <span class='int'>1</span> <span class='op'>+</span> <span class='int'>1</span> <span class='rbrace'>}</span>
|
2667
|
+
<span class='comment'># => verify fails</span></code></pre>
|
2668
|
+
|
2669
|
+
</div>
|
2670
|
+
|
2671
|
+
<p class="tag_title">Returns:</p>
|
2672
|
+
<ul class="return">
|
2673
|
+
|
2674
|
+
<li>
|
2675
|
+
|
2676
|
+
|
2677
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="Mocha::Expectation (class)">Expectation</a></span></tt>)</span>
|
2678
|
+
|
2679
|
+
|
2680
|
+
|
2681
|
+
—
|
2682
|
+
<div class='inline'>
|
2683
|
+
<p>the same expectation, thereby allowing invocations of other <span class='object_link'><a href="" title="Mocha::Expectation (class)">Mocha::Expectation</a></span> methods to be chained.</p>
|
2684
|
+
</div>
|
2685
|
+
|
2686
|
+
</li>
|
2687
|
+
|
2688
|
+
</ul>
|
2689
|
+
|
2690
|
+
</div><table class="source_code">
|
2691
|
+
<tr>
|
2692
|
+
<td>
|
2693
|
+
<pre class="lines">
|
2694
|
+
|
2695
|
+
|
2696
|
+
261
|
2697
|
+
262
|
2698
|
+
263
|
2699
|
+
264</pre>
|
2700
|
+
</td>
|
2701
|
+
<td>
|
2702
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 261</span>
|
2703
|
+
|
2704
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_with_no_block_given'>with_no_block_given</span>
|
2705
|
+
<span class='ivar'>@block_matcher</span> <span class='op'>=</span> <span class='const'>BlockMatchers</span><span class='op'>::</span><span class='const'>NoBlockGiven</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
2706
|
+
<span class='kw'>self</span>
|
2707
|
+
<span class='kw'>end</span></pre>
|
2708
|
+
</td>
|
2709
|
+
</tr>
|
2710
|
+
</table>
|
2501
2711
|
</div>
|
2502
2712
|
|
2503
2713
|
<div class="method_details ">
|
@@ -2614,17 +2824,15 @@
|
|
2614
2824
|
<pre class="lines">
|
2615
2825
|
|
2616
2826
|
|
2617
|
-
|
2618
|
-
|
2619
|
-
|
2620
|
-
261</pre>
|
2827
|
+
297
|
2828
|
+
298
|
2829
|
+
299</pre>
|
2621
2830
|
</td>
|
2622
2831
|
<td>
|
2623
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line
|
2832
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/expectation.rb', line 297</span>
|
2624
2833
|
|
2625
2834
|
<span class='kw'>def</span> <span class='id identifier rubyid_yields'>yields</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_parameters'>parameters</span><span class='rparen'>)</span>
|
2626
|
-
<span class='
|
2627
|
-
<span class='kw'>self</span>
|
2835
|
+
<span class='id identifier rubyid_multiple_yields'>multiple_yields</span><span class='lparen'>(</span><span class='id identifier rubyid_parameters'>parameters</span><span class='rparen'>)</span>
|
2628
2836
|
<span class='kw'>end</span></pre>
|
2629
2837
|
</td>
|
2630
2838
|
</tr>
|
@@ -2644,7 +2852,7 @@
|
|
2644
2852
|
</div>
|
2645
2853
|
|
2646
2854
|
<div id="footer">
|
2647
|
-
Generated on
|
2855
|
+
Generated on Mon Dec 16 18:49:51 2019 by
|
2648
2856
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
2649
2857
|
0.9.20 (ruby-2.6.5).
|
2650
2858
|
</div>
|