mocha 1.10.1 → 1.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/RELEASE.md +6 -0
- data/docs/Mocha.html +2 -2
- data/docs/Mocha/API.html +166 -32
- data/docs/Mocha/ClassMethods.html +2 -2
- data/docs/Mocha/Configuration.html +197 -55
- data/docs/Mocha/Expectation.html +2 -2
- 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 +5 -5
- 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 +13 -2
- data/docs/frames.html +1 -1
- data/docs/index.html +2 -2
- data/docs/method_list.html +40 -32
- data/docs/top-level-namespace.html +2 -2
- data/lib/mocha/api.rb +78 -18
- data/lib/mocha/configuration.rb +57 -1
- data/lib/mocha/deprecation.rb +2 -1
- data/lib/mocha/expectation.rb +1 -1
- data/lib/mocha/invocation.rb +14 -2
- data/lib/mocha/mock.rb +3 -3
- data/lib/mocha/version.rb +1 -1
- data/test/acceptance/mock_built_with_first_argument_type_being_string_test.rb +99 -0
- data/test/unit/expectation_test.rb +16 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0071e59a90a0d4f365ff5e19e4a0b5f74483d10c41fd77362d3414071fe4829b
|
4
|
+
data.tar.gz: 0a22b3a9cd04dce410fe6ef613e6c2a81fb905bbf60ac01228f8aa19852d6d8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91678a1e05d7516e2079604c19a97c0b67d6127e4efb1e152ae81735c12561b80c32f28d7318270247b9fa0cc659f976067c1baf074293c060f05db2090b4203
|
7
|
+
data.tar.gz: 298befb4573b09e6c597c03af24f083a5de24be1ccebc172f8efa4ac5debf6d5bfbc6da062edd2f2925b0864b020faf55644ba88ffaa55161c806613d6a0b6dd
|
data/RELEASE.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Release Notes
|
2
2
|
|
3
|
+
## 1.10.2
|
4
|
+
|
5
|
+
* 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):
|
6
|
+
* The behaviour of `API#mock`, `API#stub` and `API#stub_everything` when called with a symbol as the first argument.
|
7
|
+
* The behaviour of `Expectation#yields` and `Expectation#multiple_yields` when the stubbed method is called without a block.
|
8
|
+
|
3
9
|
## 1.10.1
|
4
10
|
|
5
11
|
* Ensure ObjectMethods & ClassMethods included when API extended (43778756)
|
data/docs/Mocha.html
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Module: Mocha
|
8
8
|
|
9
|
-
— Mocha 1.10.
|
9
|
+
— Mocha 1.10.2
|
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 Thu Dec 12 10:57:46 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.10.
|
9
|
+
— Mocha 1.10.2
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -317,6 +317,8 @@
|
|
317
317
|
|
318
318
|
<p>Builds a new mock object</p>
|
319
319
|
|
320
|
+
<p>rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity</p>
|
321
|
+
|
320
322
|
|
321
323
|
</div>
|
322
324
|
</div>
|
@@ -351,7 +353,7 @@
|
|
351
353
|
<div class="note notetag">
|
352
354
|
<strong>Note:</strong>
|
353
355
|
<div class='inline'>
|
354
|
-
<p>Prior to v1.10.0 when <code>name</code> was a <code>Symbol</code>, this method returned an unnamed <code>Mock</code> that
|
356
|
+
<p>Prior to v1.10.0 when <code>name</code> was a <code>Symbol</code>, this method returned an unnamed <code>Mock</code> that expected the method identified by <code>name</code>. This was undocumented behaviour and it will be removed in the future, but for the moment it can be reinstated using <span class='object_link'><a href="Configuration.html#reinstate_undocumented_behaviour_from_v1_9=-instance_method" title="Mocha::Configuration#reinstate_undocumented_behaviour_from_v1_9= (method)">Configuration#reinstate_undocumented_behaviour_from_v1_9=</a></span>.</p>
|
355
357
|
</div>
|
356
358
|
</div>
|
357
359
|
|
@@ -502,15 +504,59 @@
|
|
502
504
|
<pre class="lines">
|
503
505
|
|
504
506
|
|
505
|
-
68
|
506
507
|
69
|
507
|
-
70
|
508
|
+
70
|
509
|
+
71
|
510
|
+
72
|
511
|
+
73
|
512
|
+
74
|
513
|
+
75
|
514
|
+
76
|
515
|
+
77
|
516
|
+
78
|
517
|
+
79
|
518
|
+
80
|
519
|
+
81
|
520
|
+
82
|
521
|
+
83
|
522
|
+
84
|
523
|
+
85
|
524
|
+
86
|
525
|
+
87
|
526
|
+
88
|
527
|
+
89
|
528
|
+
90
|
529
|
+
91
|
530
|
+
92
|
531
|
+
93</pre>
|
508
532
|
</td>
|
509
533
|
<td>
|
510
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/api.rb', line
|
534
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/api.rb', line 69</span>
|
511
535
|
|
512
536
|
<span class='kw'>def</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_arguments'>arguments</span><span class='rparen'>)</span>
|
513
|
-
<span class='
|
537
|
+
<span class='kw'>if</span> <span class='const'><span class='object_link'><a href="../Mocha.html" title="Mocha (module)">Mocha</a></span></span><span class='period'>.</span><span class='id identifier rubyid_configuration'>configuration</span><span class='period'>.</span><span class='id identifier rubyid_reinstate_undocumented_behaviour_from_v1_9?'>reinstate_undocumented_behaviour_from_v1_9?</span>
|
538
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Symbol</span><span class='rparen'>)</span>
|
539
|
+
<span class='id identifier rubyid_method_name'>method_name</span> <span class='op'>=</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
|
540
|
+
<span class='const'>Deprecation</span><span class='period'>.</span><span class='id identifier rubyid_warning'>warning</span><span class='lparen'>(</span>
|
541
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Explicitly include `</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_method_name'>method_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>` in Hash of expected methods vs return values,</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
542
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> e.g. `mock(:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_method_name'>method_name</span><span class='embexpr_end'>}</span><span class='tstring_content'> => nil)`.</span><span class='tstring_end'>"</span></span>
|
543
|
+
<span class='rparen'>)</span>
|
544
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
|
545
|
+
<span class='const'>Deprecation</span><span class='period'>.</span><span class='id identifier rubyid_warning'>warning</span><span class='lparen'>(</span>
|
546
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>In this case the 2nd argument for `mock(:#</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_method_name'>method_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>, ...)` is ignored,</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
547
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> but in the future a Hash of expected methods vs return values will be respected.</span><span class='tstring_end'>'</span></span>
|
548
|
+
<span class='rparen'>)</span>
|
549
|
+
<span class='kw'>end</span>
|
550
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
|
551
|
+
<span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_shift'>shift</span>
|
552
|
+
<span class='kw'>end</span>
|
553
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Symbol</span><span class='rparen'>)</span>
|
554
|
+
<span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_shift'>shift</span>
|
555
|
+
<span class='kw'>end</span>
|
556
|
+
<span class='id identifier rubyid_expectations'>expectations</span> <span class='op'>=</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_shift'>shift</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
557
|
+
<span class='id identifier rubyid_mock'>mock</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>?</span> <span class='const'>Mockery</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_named_mock'>named_mock</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='const'>Mockery</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_unnamed_mock'>unnamed_mock</span>
|
558
|
+
<span class='id identifier rubyid_mock'>mock</span><span class='period'>.</span><span class='id identifier rubyid_expects'>expects</span><span class='lparen'>(</span><span class='id identifier rubyid_expectations'>expectations</span><span class='rparen'>)</span>
|
559
|
+
<span class='id identifier rubyid_mock'>mock</span>
|
514
560
|
<span class='kw'>end</span></pre>
|
515
561
|
</td>
|
516
562
|
</tr>
|
@@ -588,12 +634,12 @@
|
|
588
634
|
<pre class="lines">
|
589
635
|
|
590
636
|
|
591
|
-
|
592
|
-
|
593
|
-
|
637
|
+
208
|
638
|
+
209
|
639
|
+
210</pre>
|
594
640
|
</td>
|
595
641
|
<td>
|
596
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/api.rb', line
|
642
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/api.rb', line 208</span>
|
597
643
|
|
598
644
|
<span class='kw'>def</span> <span class='id identifier rubyid_sequence'>sequence</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
599
645
|
<span class='const'><span class='object_link'><a href="Sequence.html" title="Mocha::Sequence (class)">Sequence</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
@@ -687,12 +733,12 @@
|
|
687
733
|
<pre class="lines">
|
688
734
|
|
689
735
|
|
690
|
-
|
691
|
-
|
692
|
-
|
736
|
+
238
|
737
|
+
239
|
738
|
+
240</pre>
|
693
739
|
</td>
|
694
740
|
<td>
|
695
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/api.rb', line
|
741
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/api.rb', line 238</span>
|
696
742
|
|
697
743
|
<span class='kw'>def</span> <span class='id identifier rubyid_states'>states</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
698
744
|
<span class='const'>Mockery</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_new_state_machine'>new_state_machine</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
@@ -722,6 +768,8 @@
|
|
722
768
|
|
723
769
|
<p>Builds a new mock object</p>
|
724
770
|
|
771
|
+
<p>rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity</p>
|
772
|
+
|
725
773
|
|
726
774
|
</div>
|
727
775
|
</div>
|
@@ -756,7 +804,7 @@
|
|
756
804
|
<div class="note notetag">
|
757
805
|
<strong>Note:</strong>
|
758
806
|
<div class='inline'>
|
759
|
-
<p>Prior to v1.10.0 when <code>name</code> was a <code>Symbol</code>, this method returned an unnamed <code>Mock</code> that stubbed the method identified by <code>name</code>. This was undocumented behaviour and it
|
807
|
+
<p>Prior to v1.10.0 when <code>name</code> was a <code>Symbol</code>, this method returned an unnamed <code>Mock</code> that stubbed the method identified by <code>name</code>. This was undocumented behaviour and it will be removed in the future, but for the moment it can be reinstated using <span class='object_link'><a href="Configuration.html#reinstate_undocumented_behaviour_from_v1_9=-instance_method" title="Mocha::Configuration#reinstate_undocumented_behaviour_from_v1_9= (method)">Configuration#reinstate_undocumented_behaviour_from_v1_9=</a></span>.</p>
|
760
808
|
</div>
|
761
809
|
</div>
|
762
810
|
|
@@ -889,15 +937,59 @@
|
|
889
937
|
<pre class="lines">
|
890
938
|
|
891
939
|
|
892
|
-
|
893
|
-
|
894
|
-
|
940
|
+
116
|
941
|
+
117
|
942
|
+
118
|
943
|
+
119
|
944
|
+
120
|
945
|
+
121
|
946
|
+
122
|
947
|
+
123
|
948
|
+
124
|
949
|
+
125
|
950
|
+
126
|
951
|
+
127
|
952
|
+
128
|
953
|
+
129
|
954
|
+
130
|
955
|
+
131
|
956
|
+
132
|
957
|
+
133
|
958
|
+
134
|
959
|
+
135
|
960
|
+
136
|
961
|
+
137
|
962
|
+
138
|
963
|
+
139
|
964
|
+
140</pre>
|
895
965
|
</td>
|
896
966
|
<td>
|
897
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/api.rb', line
|
967
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/api.rb', line 116</span>
|
898
968
|
|
899
969
|
<span class='kw'>def</span> <span class='id identifier rubyid_stub'>stub</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_arguments'>arguments</span><span class='rparen'>)</span>
|
900
|
-
<span class='
|
970
|
+
<span class='kw'>if</span> <span class='const'><span class='object_link'><a href="../Mocha.html" title="Mocha (module)">Mocha</a></span></span><span class='period'>.</span><span class='id identifier rubyid_configuration'>configuration</span><span class='period'>.</span><span class='id identifier rubyid_reinstate_undocumented_behaviour_from_v1_9?'>reinstate_undocumented_behaviour_from_v1_9?</span>
|
971
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Symbol</span><span class='rparen'>)</span>
|
972
|
+
<span class='id identifier rubyid_method_name'>method_name</span> <span class='op'>=</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
|
973
|
+
<span class='const'>Deprecation</span><span class='period'>.</span><span class='id identifier rubyid_warning'>warning</span><span class='lparen'>(</span>
|
974
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Explicitly include `</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_method_name'>method_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>` in Hash of stubbed methods vs return values,</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
975
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> e.g. `stub(:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_method_name'>method_name</span><span class='embexpr_end'>}</span><span class='tstring_content'> => nil)`.</span><span class='tstring_end'>"</span></span>
|
976
|
+
<span class='rparen'>)</span>
|
977
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
|
978
|
+
<span class='const'>Deprecation</span><span class='period'>.</span><span class='id identifier rubyid_warning'>warning</span><span class='lparen'>(</span>
|
979
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>In this case the 2nd argument for `stub(:#</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_method_name'>method_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>, ...)` is ignored,</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
980
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> but in the future a Hash of stubbed methods vs return values will be respected.</span><span class='tstring_end'>'</span></span>
|
981
|
+
<span class='rparen'>)</span>
|
982
|
+
<span class='kw'>end</span>
|
983
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
|
984
|
+
<span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_shift'>shift</span>
|
985
|
+
<span class='kw'>end</span>
|
986
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Symbol</span><span class='rparen'>)</span>
|
987
|
+
<span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_shift'>shift</span>
|
988
|
+
<span class='kw'>end</span>
|
989
|
+
<span class='id identifier rubyid_expectations'>expectations</span> <span class='op'>=</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_shift'>shift</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
990
|
+
<span class='id identifier rubyid_stub'>stub</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>?</span> <span class='const'>Mockery</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_named_mock'>named_mock</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='const'>Mockery</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_unnamed_mock'>unnamed_mock</span>
|
991
|
+
<span class='id identifier rubyid_stub'>stub</span><span class='period'>.</span><span class='id identifier rubyid_stubs'>stubs</span><span class='lparen'>(</span><span class='id identifier rubyid_expectations'>expectations</span><span class='rparen'>)</span>
|
992
|
+
<span class='id identifier rubyid_stub'>stub</span>
|
901
993
|
<span class='kw'>end</span></pre>
|
902
994
|
</td>
|
903
995
|
</tr>
|
@@ -924,6 +1016,8 @@
|
|
924
1016
|
|
925
1017
|
<p>Builds a mock object that accepts calls to any method. By default it will return <code>nil</code> for any method call.</p>
|
926
1018
|
|
1019
|
+
<p>rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity</p>
|
1020
|
+
|
927
1021
|
|
928
1022
|
</div>
|
929
1023
|
</div>
|
@@ -958,7 +1052,7 @@
|
|
958
1052
|
<div class="note notetag">
|
959
1053
|
<strong>Note:</strong>
|
960
1054
|
<div class='inline'>
|
961
|
-
<p>Prior to v1.10.0 when <code>name</code> was a <code>Symbol</code>, this method returned an unnamed <code>Mock</code> that stubbed
|
1055
|
+
<p>Prior to v1.10.0 when <code>name</code> was a <code>Symbol</code>, this method returned an unnamed <code>Mock</code> that stubbed the method identified by <code>name</code>. This was undocumented behaviour and it will be removed in the future, but for the moment it can be reinstated using <span class='object_link'><a href="Configuration.html#reinstate_undocumented_behaviour_from_v1_9=-instance_method" title="Mocha::Configuration#reinstate_undocumented_behaviour_from_v1_9= (method)">Configuration#reinstate_undocumented_behaviour_from_v1_9=</a></span>.</p>
|
962
1056
|
</div>
|
963
1057
|
</div>
|
964
1058
|
|
@@ -1109,21 +1203,61 @@
|
|
1109
1203
|
<pre class="lines">
|
1110
1204
|
|
1111
1205
|
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1206
|
+
164
|
1207
|
+
165
|
1208
|
+
166
|
1209
|
+
167
|
1210
|
+
168
|
1211
|
+
169
|
1212
|
+
170
|
1213
|
+
171
|
1214
|
+
172
|
1215
|
+
173
|
1216
|
+
174
|
1217
|
+
175
|
1218
|
+
176
|
1219
|
+
177
|
1220
|
+
178
|
1221
|
+
179
|
1222
|
+
180
|
1223
|
+
181
|
1224
|
+
182
|
1225
|
+
183
|
1226
|
+
184
|
1227
|
+
185
|
1228
|
+
186
|
1229
|
+
187
|
1230
|
+
188
|
1231
|
+
189</pre>
|
1118
1232
|
</td>
|
1119
1233
|
<td>
|
1120
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/api.rb', line
|
1234
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/api.rb', line 164</span>
|
1121
1235
|
|
1122
1236
|
<span class='kw'>def</span> <span class='id identifier rubyid_stub_everything'>stub_everything</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_arguments'>arguments</span><span class='rparen'>)</span>
|
1123
|
-
<span class='
|
1124
|
-
<span class='id identifier
|
1125
|
-
|
1237
|
+
<span class='kw'>if</span> <span class='const'><span class='object_link'><a href="../Mocha.html" title="Mocha (module)">Mocha</a></span></span><span class='period'>.</span><span class='id identifier rubyid_configuration'>configuration</span><span class='period'>.</span><span class='id identifier rubyid_reinstate_undocumented_behaviour_from_v1_9?'>reinstate_undocumented_behaviour_from_v1_9?</span>
|
1238
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Symbol</span><span class='rparen'>)</span>
|
1239
|
+
<span class='id identifier rubyid_method_name'>method_name</span> <span class='op'>=</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
|
1240
|
+
<span class='const'>Deprecation</span><span class='period'>.</span><span class='id identifier rubyid_warning'>warning</span><span class='lparen'>(</span>
|
1241
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Explicitly include `</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_method_name'>method_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>` in Hash of stubbed methods vs return values,</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
1242
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> e.g. `stub_everything(:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_method_name'>method_name</span><span class='embexpr_end'>}</span><span class='tstring_content'> => nil)`.</span><span class='tstring_end'>"</span></span>
|
1243
|
+
<span class='rparen'>)</span>
|
1244
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
|
1245
|
+
<span class='const'>Deprecation</span><span class='period'>.</span><span class='id identifier rubyid_warning'>warning</span><span class='lparen'>(</span>
|
1246
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>In this case the 2nd argument for `stub_everything(:#</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_method_name'>method_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>, ...)` is ignored,</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
1247
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> but in the future a Hash of stubbed methods vs return values will be respected.</span><span class='tstring_end'>'</span></span>
|
1248
|
+
<span class='rparen'>)</span>
|
1249
|
+
<span class='kw'>end</span>
|
1250
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
|
1251
|
+
<span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_shift'>shift</span>
|
1252
|
+
<span class='kw'>end</span>
|
1253
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Symbol</span><span class='rparen'>)</span>
|
1254
|
+
<span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_shift'>shift</span>
|
1126
1255
|
<span class='kw'>end</span>
|
1256
|
+
<span class='id identifier rubyid_expectations'>expectations</span> <span class='op'>=</span> <span class='id identifier rubyid_arguments'>arguments</span><span class='period'>.</span><span class='id identifier rubyid_shift'>shift</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1257
|
+
<span class='id identifier rubyid_stub'>stub</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span> <span class='op'>?</span> <span class='const'>Mockery</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_named_mock'>named_mock</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='const'>Mockery</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='period'>.</span><span class='id identifier rubyid_unnamed_mock'>unnamed_mock</span>
|
1258
|
+
<span class='id identifier rubyid_stub'>stub</span><span class='period'>.</span><span class='id identifier rubyid_stub_everything'>stub_everything</span>
|
1259
|
+
<span class='id identifier rubyid_stub'>stub</span><span class='period'>.</span><span class='id identifier rubyid_stubs'>stubs</span><span class='lparen'>(</span><span class='id identifier rubyid_expectations'>expectations</span><span class='rparen'>)</span>
|
1260
|
+
<span class='id identifier rubyid_stub'>stub</span>
|
1127
1261
|
<span class='kw'>end</span></pre>
|
1128
1262
|
</td>
|
1129
1263
|
</tr>
|
@@ -1143,7 +1277,7 @@
|
|
1143
1277
|
</div>
|
1144
1278
|
|
1145
1279
|
<div id="footer">
|
1146
|
-
Generated on
|
1280
|
+
Generated on Thu Dec 12 10:57:47 2019 by
|
1147
1281
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1148
1282
|
0.9.20 (ruby-2.6.5).
|
1149
1283
|
</div>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Module: Mocha::ClassMethods
|
8
8
|
|
9
|
-
— Mocha 1.10.
|
9
|
+
— Mocha 1.10.2
|
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 Thu Dec 12 10:57:47 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.10.
|
9
|
+
— Mocha 1.10.2
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -302,6 +302,30 @@
|
|
302
302
|
<p>Display matching invocations alongside expectations on Mocha-related test failure.</p>
|
303
303
|
</div></span>
|
304
304
|
|
305
|
+
</li>
|
306
|
+
|
307
|
+
|
308
|
+
<li class="public ">
|
309
|
+
<span class="summary_signature">
|
310
|
+
|
311
|
+
<a href="#reinstate_undocumented_behaviour_from_v1_9=-instance_method" title="#reinstate_undocumented_behaviour_from_v1_9= (instance method)">#<strong>reinstate_undocumented_behaviour_from_v1_9=</strong>(value) ⇒ Object </a>
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
</span>
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
<span class="summary_desc"><div class='inline'>
|
326
|
+
<p>Reinstate undocumented behaviour from v1.9.</p>
|
327
|
+
</div></span>
|
328
|
+
|
305
329
|
</li>
|
306
330
|
|
307
331
|
|
@@ -512,17 +536,17 @@
|
|
512
536
|
<pre class="lines">
|
513
537
|
|
514
538
|
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
539
|
+
317
|
540
|
+
318
|
541
|
+
319
|
542
|
+
320
|
543
|
+
321
|
544
|
+
322
|
545
|
+
323
|
546
|
+
324</pre>
|
523
547
|
</td>
|
524
548
|
<td>
|
525
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line
|
549
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 317</span>
|
526
550
|
|
527
551
|
<span class='kw'>def</span> <span class='id identifier rubyid_allow'>allow</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
528
552
|
<span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
@@ -617,16 +641,16 @@
|
|
617
641
|
<pre class="lines">
|
618
642
|
|
619
643
|
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
644
|
+
396
|
645
|
+
397
|
646
|
+
398
|
647
|
+
399
|
648
|
+
400
|
649
|
+
401
|
650
|
+
402</pre>
|
627
651
|
</td>
|
628
652
|
<td>
|
629
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line
|
653
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 396</span>
|
630
654
|
|
631
655
|
<span class='kw'>def</span> <span class='id identifier rubyid_override'>override</span><span class='lparen'>(</span><span class='id identifier rubyid_temporary_options'>temporary_options</span><span class='rparen'>)</span>
|
632
656
|
<span class='id identifier rubyid_original_configuration'>original_configuration</span> <span class='op'>=</span> <span class='id identifier rubyid_configuration'>configuration</span>
|
@@ -718,17 +742,17 @@
|
|
718
742
|
<pre class="lines">
|
719
743
|
|
720
744
|
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
745
|
+
365
|
746
|
+
366
|
747
|
+
367
|
748
|
+
368
|
749
|
+
369
|
750
|
+
370
|
751
|
+
371
|
752
|
+
372</pre>
|
729
753
|
</td>
|
730
754
|
<td>
|
731
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line
|
755
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 365</span>
|
732
756
|
|
733
757
|
<span class='kw'>def</span> <span class='id identifier rubyid_prevent'>prevent</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
734
758
|
<span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
@@ -821,17 +845,17 @@
|
|
821
845
|
<pre class="lines">
|
822
846
|
|
823
847
|
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
848
|
+
341
|
849
|
+
342
|
850
|
+
343
|
851
|
+
344
|
852
|
+
345
|
853
|
+
346
|
854
|
+
347
|
855
|
+
348</pre>
|
832
856
|
</td>
|
833
857
|
<td>
|
834
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line
|
858
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 341</span>
|
835
859
|
|
836
860
|
<span class='kw'>def</span> <span class='id identifier rubyid_warn_when'>warn_when</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
837
861
|
<span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
@@ -929,12 +953,12 @@ satisfied expectations:
|
|
929
953
|
<pre class="lines">
|
930
954
|
|
931
955
|
|
932
|
-
241
|
933
956
|
242
|
934
|
-
243
|
957
|
+
243
|
958
|
+
244</pre>
|
935
959
|
</td>
|
936
960
|
<td>
|
937
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line
|
961
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 242</span>
|
938
962
|
|
939
963
|
<span class='kw'>def</span> <span class='id identifier rubyid_display_matching_invocations_on_failure='>display_matching_invocations_on_failure=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
940
964
|
<span class='ivar'>@options</span><span class='lbracket'>[</span><span class='symbol'>:display_matching_invocations_on_failure</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
@@ -942,6 +966,124 @@ satisfied expectations:
|
|
942
966
|
</td>
|
943
967
|
</tr>
|
944
968
|
</table>
|
969
|
+
</div>
|
970
|
+
|
971
|
+
<div class="method_details ">
|
972
|
+
<h3 class="signature " id="reinstate_undocumented_behaviour_from_v1_9=-instance_method">
|
973
|
+
|
974
|
+
#<strong>reinstate_undocumented_behaviour_from_v1_9=</strong>(value) ⇒ <tt><span class='object_link'>Object</span></tt>
|
975
|
+
|
976
|
+
|
977
|
+
|
978
|
+
|
979
|
+
|
980
|
+
</h3><div class="docstring">
|
981
|
+
<div class="discussion">
|
982
|
+
|
983
|
+
<p>Reinstate undocumented behaviour from v1.9</p>
|
984
|
+
|
985
|
+
<p>Previously when <span class='object_link'><a href="API.html#mock-instance_method" title="Mocha::API#mock (method)">API#mock</a></span>, <span class='object_link'><a href="API.html#stub-instance_method" title="Mocha::API#stub (method)">API#stub</a></span>, or <span class='object_link'><a href="API.html#stub_everything-instance_method" title="Mocha::API#stub_everything (method)">API#stub_everything</a></span> were called with the first argument being a symbol, they built an <strong>unnamed</strong> mock object <strong>and</strong> expected or stubbed the method identified by the symbol argument; subsequent arguments were ignored. Now these methods build a <strong>named</strong> mock with the name specified by the symbol argument; <strong>no</strong> methods are expected or stubbed and subsequent arguments <strong>are</strong> taken into account.</p>
|
986
|
+
|
987
|
+
<p>Previously if <span class='object_link'><a href="Expectation.html#yields-instance_method" title="Mocha::Expectation#yields (method)">Expectation#yields</a></span> or <span class='object_link'><a href="Expectation.html#multiple_yields-instance_method" title="Mocha::Expectation#multiple_yields (method)">Expectation#multiple_yields</a></span> was called on an expectation, but no block was given when the method was invoked, the instruction to yield was ignored. Now a <code>LocalJumpError</code> is raised.</p>
|
988
|
+
|
989
|
+
<p>Enabling this configuration option reinstates the previous behaviour, but displays a deprecation warning.</p>
|
990
|
+
|
991
|
+
|
992
|
+
</div>
|
993
|
+
</div>
|
994
|
+
<div class="tags">
|
995
|
+
|
996
|
+
<div class="examples">
|
997
|
+
<p class="tag_title">Examples:</p>
|
998
|
+
|
999
|
+
|
1000
|
+
<p class="example_title"><div class='inline'>
|
1001
|
+
<p>Reinstate undocumented behaviour for <span class='object_link'><a href="API.html#mock-instance_method" title="Mocha::API#mock (method)">API#mock</a></span></p>
|
1002
|
+
</div></p>
|
1003
|
+
|
1004
|
+
<pre class="example code"><code>Mocha.configure do |c|
|
1005
|
+
c.reinstate_undocumented_behaviour_from_v1_9 = true
|
1006
|
+
end
|
1007
|
+
|
1008
|
+
foo = mock(:bar)
|
1009
|
+
foo.inspect # => #<Mock>
|
1010
|
+
|
1011
|
+
not all expectations were satisfied
|
1012
|
+
unsatisfied expectations:
|
1013
|
+
- expected exactly once, invoked never: #<Mock>.foo</code></pre>
|
1014
|
+
|
1015
|
+
|
1016
|
+
<p class="example_title"><div class='inline'>
|
1017
|
+
<p>Reinstate undocumented behaviour for <span class='object_link'><a href="API.html#stub-instance_method" title="Mocha::API#stub (method)">API#stub</a></span></p>
|
1018
|
+
</div></p>
|
1019
|
+
|
1020
|
+
<pre class="example code"><code><span class='const'><span class='object_link'><a href="../Mocha.html" title="Mocha (module)">Mocha</a></span></span><span class='period'>.</span><span class='id identifier rubyid_configure'><span class='object_link'><a href="../Mocha.html#configure-class_method" title="Mocha.configure (method)">configure</a></span></span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span>
|
1021
|
+
<span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_reinstate_undocumented_behaviour_from_v1_9'>reinstate_undocumented_behaviour_from_v1_9</span> <span class='op'>=</span> <span class='kw'>true</span>
|
1022
|
+
<span class='kw'>end</span>
|
1023
|
+
|
1024
|
+
<span class='id identifier rubyid_foo'>foo</span> <span class='op'>=</span> <span class='id identifier rubyid_stub'>stub</span><span class='lparen'>(</span><span class='symbol'>:bar</span><span class='rparen'>)</span>
|
1025
|
+
<span class='id identifier rubyid_foo'>foo</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span> <span class='comment'># => #<Mock>
|
1026
|
+
</span><span class='id identifier rubyid_foo'>foo</span><span class='period'>.</span><span class='id identifier rubyid_bar'>bar</span> <span class='comment'># => nil</span></code></pre>
|
1027
|
+
|
1028
|
+
|
1029
|
+
<p class="example_title"><div class='inline'>
|
1030
|
+
<p>Reinstate undocumented behaviour for <span class='object_link'><a href="Expectation.html#yields-instance_method" title="Mocha::Expectation#yields (method)">Expectation#yields</a></span></p>
|
1031
|
+
</div></p>
|
1032
|
+
|
1033
|
+
<pre class="example code"><code><span class='id identifier rubyid_foo'>foo</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>foo</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
1034
|
+
<span class='id identifier rubyid_foo'>foo</span><span class='period'>.</span><span class='id identifier rubyid_stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:my_method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_yields'>yields</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>2</span><span class='rparen'>)</span>
|
1035
|
+
<span class='id identifier rubyid_foo'>foo</span><span class='period'>.</span><span class='id identifier rubyid_my_method'>my_method</span> <span class='comment'># => raises LocalJumpError when no block is supplied
|
1036
|
+
</span>
|
1037
|
+
<span class='const'><span class='object_link'><a href="../Mocha.html" title="Mocha (module)">Mocha</a></span></span><span class='period'>.</span><span class='id identifier rubyid_configure'><span class='object_link'><a href="../Mocha.html#configure-class_method" title="Mocha.configure (method)">configure</a></span></span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span>
|
1038
|
+
<span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_reinstate_undocumented_behaviour_from_v1_9'>reinstate_undocumented_behaviour_from_v1_9</span> <span class='op'>=</span> <span class='kw'>true</span>
|
1039
|
+
<span class='kw'>end</span>
|
1040
|
+
|
1041
|
+
<span class='id identifier rubyid_foo'>foo</span> <span class='op'>=</span> <span class='id identifier rubyid_mock'>mock</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>foo</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
1042
|
+
<span class='id identifier rubyid_foo'>foo</span><span class='period'>.</span><span class='id identifier rubyid_stubs'>stubs</span><span class='lparen'>(</span><span class='symbol'>:my_method</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_yields'>yields</span><span class='lparen'>(</span><span class='int'>1</span><span class='comma'>,</span> <span class='int'>2</span><span class='rparen'>)</span>
|
1043
|
+
<span class='id identifier rubyid_foo'>foo</span><span class='period'>.</span><span class='id identifier rubyid_my_method'>my_method</span> <span class='comment'># => does *not* raise LocalJumpError when no block is supplied</span></code></pre>
|
1044
|
+
|
1045
|
+
</div>
|
1046
|
+
<p class="tag_title">Parameters:</p>
|
1047
|
+
<ul class="param">
|
1048
|
+
|
1049
|
+
<li>
|
1050
|
+
|
1051
|
+
<span class='name'>value</span>
|
1052
|
+
|
1053
|
+
|
1054
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
1055
|
+
|
1056
|
+
|
1057
|
+
|
1058
|
+
—
|
1059
|
+
<div class='inline'>
|
1060
|
+
<p><code>true</code> to reinstate undocumented behaviour; disabled by default.</p>
|
1061
|
+
</div>
|
1062
|
+
|
1063
|
+
</li>
|
1064
|
+
|
1065
|
+
</ul>
|
1066
|
+
|
1067
|
+
|
1068
|
+
</div><table class="source_code">
|
1069
|
+
<tr>
|
1070
|
+
<td>
|
1071
|
+
<pre class="lines">
|
1072
|
+
|
1073
|
+
|
1074
|
+
297
|
1075
|
+
298
|
1076
|
+
299</pre>
|
1077
|
+
</td>
|
1078
|
+
<td>
|
1079
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 297</span>
|
1080
|
+
|
1081
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_reinstate_undocumented_behaviour_from_v1_9='>reinstate_undocumented_behaviour_from_v1_9=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
1082
|
+
<span class='ivar'>@options</span><span class='lbracket'>[</span><span class='symbol'>:reinstate_undocumented_behaviour_from_v1_9</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
1083
|
+
<span class='kw'>end</span></pre>
|
1084
|
+
</td>
|
1085
|
+
</tr>
|
1086
|
+
</table>
|
945
1087
|
</div>
|
946
1088
|
|
947
1089
|
<div class="method_details ">
|
@@ -996,12 +1138,12 @@ satisfied expectations:
|
|
996
1138
|
<pre class="lines">
|
997
1139
|
|
998
1140
|
|
999
|
-
207
|
1000
1141
|
208
|
1001
|
-
209
|
1142
|
+
209
|
1143
|
+
210</pre>
|
1002
1144
|
</td>
|
1003
1145
|
<td>
|
1004
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line
|
1146
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 208</span>
|
1005
1147
|
|
1006
1148
|
<span class='kw'>def</span> <span class='id identifier rubyid_stubbing_method_on_nil='>stubbing_method_on_nil=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
1007
1149
|
<span class='ivar'>@options</span><span class='lbracket'>[</span><span class='symbol'>:stubbing_method_on_nil</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
@@ -1084,12 +1226,12 @@ satisfied expectations:
|
|
1084
1226
|
<pre class="lines">
|
1085
1227
|
|
1086
1228
|
|
1087
|
-
119
|
1088
1229
|
120
|
1089
|
-
121
|
1230
|
+
121
|
1231
|
+
122</pre>
|
1090
1232
|
</td>
|
1091
1233
|
<td>
|
1092
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line
|
1234
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 120</span>
|
1093
1235
|
|
1094
1236
|
<span class='kw'>def</span> <span class='id identifier rubyid_stubbing_method_on_non_mock_object='>stubbing_method_on_non_mock_object=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
1095
1237
|
<span class='ivar'>@options</span><span class='lbracket'>[</span><span class='symbol'>:stubbing_method_on_non_mock_object</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
@@ -1168,12 +1310,12 @@ satisfied expectations:
|
|
1168
1310
|
<pre class="lines">
|
1169
1311
|
|
1170
1312
|
|
1171
|
-
86
|
1172
1313
|
87
|
1173
|
-
88
|
1314
|
+
88
|
1315
|
+
89</pre>
|
1174
1316
|
</td>
|
1175
1317
|
<td>
|
1176
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line
|
1318
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 87</span>
|
1177
1319
|
|
1178
1320
|
<span class='kw'>def</span> <span class='id identifier rubyid_stubbing_method_unnecessarily='>stubbing_method_unnecessarily=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
1179
1321
|
<span class='ivar'>@options</span><span class='lbracket'>[</span><span class='symbol'>:stubbing_method_unnecessarily</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
@@ -1256,12 +1398,12 @@ satisfied expectations:
|
|
1256
1398
|
<pre class="lines">
|
1257
1399
|
|
1258
1400
|
|
1259
|
-
152
|
1260
1401
|
153
|
1261
|
-
154
|
1402
|
+
154
|
1403
|
+
155</pre>
|
1262
1404
|
</td>
|
1263
1405
|
<td>
|
1264
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line
|
1406
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 153</span>
|
1265
1407
|
|
1266
1408
|
<span class='kw'>def</span> <span class='id identifier rubyid_stubbing_non_existent_method='>stubbing_non_existent_method=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
1267
1409
|
<span class='ivar'>@options</span><span class='lbracket'>[</span><span class='symbol'>:stubbing_non_existent_method</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
@@ -1345,12 +1487,12 @@ satisfied expectations:
|
|
1345
1487
|
<pre class="lines">
|
1346
1488
|
|
1347
1489
|
|
1348
|
-
186
|
1349
1490
|
187
|
1350
|
-
188
|
1491
|
+
188
|
1492
|
+
189</pre>
|
1351
1493
|
</td>
|
1352
1494
|
<td>
|
1353
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line
|
1495
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/configuration.rb', line 187</span>
|
1354
1496
|
|
1355
1497
|
<span class='kw'>def</span> <span class='id identifier rubyid_stubbing_non_public_method='>stubbing_non_public_method=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
1356
1498
|
<span class='ivar'>@options</span><span class='lbracket'>[</span><span class='symbol'>:stubbing_non_public_method</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
@@ -1373,7 +1515,7 @@ satisfied expectations:
|
|
1373
1515
|
</div>
|
1374
1516
|
|
1375
1517
|
<div id="footer">
|
1376
|
-
Generated on
|
1518
|
+
Generated on Thu Dec 12 10:57:48 2019 by
|
1377
1519
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1378
1520
|
0.9.20 (ruby-2.6.5).
|
1379
1521
|
</div>
|