mocha 1.10.0 → 1.11.2
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 +49 -0
- data/Rakefile +1 -4
- data/docs/Mocha.html +2 -2
- data/docs/Mocha/API.html +167 -35
- data/docs/Mocha/ClassMethods.html +2 -2
- data/docs/Mocha/Configuration.html +197 -55
- 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 +14 -41
- data/docs/Mocha/ObjectMethods.html +2 -2
- data/docs/Mocha/ParameterMatchers.html +14 -26
- 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 +5 -5
- 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 +74 -2
- data/docs/frames.html +1 -1
- data/docs/index.html +2 -2
- data/docs/method_list.html +51 -27
- data/docs/top-level-namespace.html +2 -2
- data/lib/mocha/api.rb +83 -19
- data/lib/mocha/block_matcher.rb +31 -0
- data/lib/mocha/configuration.rb +57 -1
- data/lib/mocha/deprecation.rb +2 -1
- data/lib/mocha/expectation.rb +48 -7
- data/lib/mocha/invocation.rb +20 -4
- data/lib/mocha/mock.rb +42 -16
- data/lib/mocha/mockery.rb +14 -14
- 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 +2 -3
- data/lib/mocha/stubbed_method.rb +4 -6
- 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/issue_457_test.rb +31 -0
- data/test/acceptance/mocha_example_test.rb +11 -1
- data/test/acceptance/mock_built_with_first_argument_type_being_string_test.rb +98 -0
- data/test/acceptance/mock_test.rb +64 -12
- data/test/acceptance/multiple_yielding_test.rb +59 -0
- data/test/acceptance/stubba_example_test.rb +11 -1
- data/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +16 -0
- data/test/acceptance/yielding_test.rb +80 -0
- data/test/unit/expectation_test.rb +30 -3
- data/test/unit/yield_parameters_test.rb +35 -53
- metadata +8 -9
- 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/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: 398d43b17f224be63c21bcd24cbe4d1bff6b90267e1a870eb4f2a3432515da88
|
4
|
+
data.tar.gz: bd7c4a5ce95a20b5b403750982d63356e1553af54f45d538cc3e3c514f7fb079
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b8a00e3b21f5761fede57f919785ac653e714d28151325980d6ae5bd5d0a7ec5ecdcbaf96d6e36c6659347852e414b3a1c10fb57e0c72b981e70348308174f1
|
7
|
+
data.tar.gz: f85f050cbbb7bfa224420e8ad2f67f6b683576a1d8ef1d79f55acecda495febca0f6b0aae79721c0159028f752c2e19268f06c5dc8e27f40dd5449e8ea5b96ae
|
data/.github/FUNDING.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
github: floehopper
|
data/.yardopts
CHANGED
data/RELEASE.md
CHANGED
@@ -1,5 +1,54 @@
|
|
1
1
|
# Release Notes
|
2
2
|
|
3
|
+
## 1.11.2
|
4
|
+
|
5
|
+
### External changes
|
6
|
+
|
7
|
+
* Fix regression introduced in v1.10.0 that meant `Object#inspect` was called unnecessarily (368abd98)
|
8
|
+
* Warn when mock object receives invocations in another test - thanks to @nitishr (#442)
|
9
|
+
* Avoid rubocop comments appearing in YARD-generated docs (d8019eed)
|
10
|
+
|
11
|
+
### Internal changes
|
12
|
+
|
13
|
+
* Replace `StubbedMethod#original_method` & `#original_visibility` attribute reader methods with instance variables - thanks to @nitishr (d917f332)
|
14
|
+
* Set up `MochaExampleTest` & `StubbaExampleTest` as acceptance tests - thanks to @nitishr (4881cc58)
|
15
|
+
* Delete unused `PrettyParameters` class - thanks to @nitishr (314ea922)
|
16
|
+
|
17
|
+
## 1.11.1
|
18
|
+
|
19
|
+
### External changes
|
20
|
+
|
21
|
+
* The `reinstate_undocumented_behaviour_from_v1_9` configuration option is now enabled by default to give people a chance to see and fix the relevant deprecation warnings before the behaviour is removed in a future release (b91b1c9e)
|
22
|
+
|
23
|
+
## 1.11.0
|
24
|
+
|
25
|
+
### External changes
|
26
|
+
|
27
|
+
* Add `Expectation#with_block_given` & `Expectation#with_no_block_given` (#441).
|
28
|
+
* Allows non-deprecated solution for #382. Thanks to @yemartin for reporting and to @techbelly & @nitishr for feedback.
|
29
|
+
* Fix issue with non-Array arguments passed to `Expectation#multiple_yields` (#444).
|
30
|
+
* The undocumented behaviour is now properly supported and documented.
|
31
|
+
|
32
|
+
### Internal changes
|
33
|
+
|
34
|
+
* Move static YARD options from Rake task to `.yardopts` file - thanks to @nitishr (#429)
|
35
|
+
* Simplify implementation of yielding functionality - thanks to @nitishr (#439)
|
36
|
+
* Add missing require statement to `acceptance_test_helper.rb` (1070fc02)
|
37
|
+
* Add some baseline acceptance tests for yielding behaviour (c2cac911)
|
38
|
+
* Display a sponsor button on GitHub repo page (9fc5911b)
|
39
|
+
* Use new Deprecation.warning behaviour in `Invocation#call` (932d1166)
|
40
|
+
|
41
|
+
## 1.10.2
|
42
|
+
|
43
|
+
* 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):
|
44
|
+
* The behaviour of `API#mock`, `API#stub` and `API#stub_everything` when called with a symbol as the first argument.
|
45
|
+
* The behaviour of `Expectation#yields` and `Expectation#multiple_yields` when the stubbed method is called without a block.
|
46
|
+
|
47
|
+
## 1.10.1
|
48
|
+
|
49
|
+
* Ensure ObjectMethods & ClassMethods included when API extended (43778756)
|
50
|
+
* Fix regression in `any_instance` stubbing of methods on object which has an implementation of `#respond_to?` that depends on the object's internal state - thanks to @rafaelfranca for reporting & @nitishr for fixing (#432, #434, 469d4b17)
|
51
|
+
|
3
52
|
## 1.10.0
|
4
53
|
|
5
54
|
* Improve deprecation warning when requiring 'mocha/setup' (388f44d7)
|
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.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 Sat Jan 4 17:36:46 2020 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.2
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -351,7 +351,7 @@
|
|
351
351
|
<div class="note notetag">
|
352
352
|
<strong>Note:</strong>
|
353
353
|
<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
|
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 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
355
|
</div>
|
356
356
|
</div>
|
357
357
|
|
@@ -502,15 +502,59 @@
|
|
502
502
|
<pre class="lines">
|
503
503
|
|
504
504
|
|
505
|
-
|
506
|
-
|
507
|
-
|
505
|
+
69
|
506
|
+
70
|
507
|
+
71
|
508
|
+
72
|
509
|
+
73
|
510
|
+
74
|
511
|
+
75
|
512
|
+
76
|
513
|
+
77
|
514
|
+
78
|
515
|
+
79
|
516
|
+
80
|
517
|
+
81
|
518
|
+
82
|
519
|
+
83
|
520
|
+
84
|
521
|
+
85
|
522
|
+
86
|
523
|
+
87
|
524
|
+
88
|
525
|
+
89
|
526
|
+
90
|
527
|
+
91
|
528
|
+
92
|
529
|
+
93</pre>
|
508
530
|
</td>
|
509
531
|
<td>
|
510
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/api.rb', line
|
511
|
-
|
512
|
-
<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
|
-
|
532
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/api.rb', line 69</span>
|
533
|
+
|
534
|
+
<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> <span class='comment'># rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
535
|
+
</span> <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>
|
536
|
+
<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>
|
537
|
+
<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>
|
538
|
+
<span class='const'>Deprecation</span><span class='period'>.</span><span class='id identifier rubyid_warning'>warning</span><span class='lparen'>(</span>
|
539
|
+
<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>
|
540
|
+
<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>
|
541
|
+
<span class='rparen'>)</span>
|
542
|
+
<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>
|
543
|
+
<span class='const'>Deprecation</span><span class='period'>.</span><span class='id identifier rubyid_warning'>warning</span><span class='lparen'>(</span>
|
544
|
+
<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>
|
545
|
+
<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>
|
546
|
+
<span class='rparen'>)</span>
|
547
|
+
<span class='kw'>end</span>
|
548
|
+
<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>
|
549
|
+
<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>
|
550
|
+
<span class='kw'>end</span>
|
551
|
+
<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>
|
552
|
+
<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>
|
553
|
+
<span class='kw'>end</span>
|
554
|
+
<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>
|
555
|
+
<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>
|
556
|
+
<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>
|
557
|
+
<span class='id identifier rubyid_mock'>mock</span>
|
514
558
|
<span class='kw'>end</span></pre>
|
515
559
|
</td>
|
516
560
|
</tr>
|
@@ -588,12 +632,12 @@
|
|
588
632
|
<pre class="lines">
|
589
633
|
|
590
634
|
|
591
|
-
|
592
|
-
|
593
|
-
|
635
|
+
207
|
636
|
+
208
|
637
|
+
209</pre>
|
594
638
|
</td>
|
595
639
|
<td>
|
596
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/api.rb', line
|
640
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/api.rb', line 207</span>
|
597
641
|
|
598
642
|
<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
643
|
<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 +731,12 @@
|
|
687
731
|
<pre class="lines">
|
688
732
|
|
689
733
|
|
690
|
-
|
691
|
-
|
692
|
-
|
734
|
+
237
|
735
|
+
238
|
736
|
+
239</pre>
|
693
737
|
</td>
|
694
738
|
<td>
|
695
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/api.rb', line
|
739
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/api.rb', line 237</span>
|
696
740
|
|
697
741
|
<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
742
|
<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 +766,8 @@
|
|
722
766
|
|
723
767
|
<p>Builds a new mock object</p>
|
724
768
|
|
769
|
+
<p>rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity</p>
|
770
|
+
|
725
771
|
|
726
772
|
</div>
|
727
773
|
</div>
|
@@ -756,7 +802,7 @@
|
|
756
802
|
<div class="note notetag">
|
757
803
|
<strong>Note:</strong>
|
758
804
|
<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
|
805
|
+
<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
806
|
</div>
|
761
807
|
</div>
|
762
808
|
|
@@ -889,15 +935,59 @@
|
|
889
935
|
<pre class="lines">
|
890
936
|
|
891
937
|
|
892
|
-
|
893
|
-
|
894
|
-
|
938
|
+
115
|
939
|
+
116
|
940
|
+
117
|
941
|
+
118
|
942
|
+
119
|
943
|
+
120
|
944
|
+
121
|
945
|
+
122
|
946
|
+
123
|
947
|
+
124
|
948
|
+
125
|
949
|
+
126
|
950
|
+
127
|
951
|
+
128
|
952
|
+
129
|
953
|
+
130
|
954
|
+
131
|
955
|
+
132
|
956
|
+
133
|
957
|
+
134
|
958
|
+
135
|
959
|
+
136
|
960
|
+
137
|
961
|
+
138
|
962
|
+
139</pre>
|
895
963
|
</td>
|
896
964
|
<td>
|
897
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/api.rb', line
|
965
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/api.rb', line 115</span>
|
898
966
|
|
899
967
|
<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='
|
968
|
+
<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>
|
969
|
+
<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>
|
970
|
+
<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>
|
971
|
+
<span class='const'>Deprecation</span><span class='period'>.</span><span class='id identifier rubyid_warning'>warning</span><span class='lparen'>(</span>
|
972
|
+
<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>
|
973
|
+
<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>
|
974
|
+
<span class='rparen'>)</span>
|
975
|
+
<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>
|
976
|
+
<span class='const'>Deprecation</span><span class='period'>.</span><span class='id identifier rubyid_warning'>warning</span><span class='lparen'>(</span>
|
977
|
+
<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>
|
978
|
+
<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>
|
979
|
+
<span class='rparen'>)</span>
|
980
|
+
<span class='kw'>end</span>
|
981
|
+
<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>
|
982
|
+
<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>
|
983
|
+
<span class='kw'>end</span>
|
984
|
+
<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>
|
985
|
+
<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>
|
986
|
+
<span class='kw'>end</span>
|
987
|
+
<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>
|
988
|
+
<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>
|
989
|
+
<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>
|
990
|
+
<span class='id identifier rubyid_stub'>stub</span>
|
901
991
|
<span class='kw'>end</span></pre>
|
902
992
|
</td>
|
903
993
|
</tr>
|
@@ -924,6 +1014,8 @@
|
|
924
1014
|
|
925
1015
|
<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
1016
|
|
1017
|
+
<p>rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity</p>
|
1018
|
+
|
927
1019
|
|
928
1020
|
</div>
|
929
1021
|
</div>
|
@@ -958,7 +1050,7 @@
|
|
958
1050
|
<div class="note notetag">
|
959
1051
|
<strong>Note:</strong>
|
960
1052
|
<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
|
1053
|
+
<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
1054
|
</div>
|
963
1055
|
</div>
|
964
1056
|
|
@@ -1109,21 +1201,61 @@
|
|
1109
1201
|
<pre class="lines">
|
1110
1202
|
|
1111
1203
|
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1204
|
+
163
|
1205
|
+
164
|
1206
|
+
165
|
1207
|
+
166
|
1208
|
+
167
|
1209
|
+
168
|
1210
|
+
169
|
1211
|
+
170
|
1212
|
+
171
|
1213
|
+
172
|
1214
|
+
173
|
1215
|
+
174
|
1216
|
+
175
|
1217
|
+
176
|
1218
|
+
177
|
1219
|
+
178
|
1220
|
+
179
|
1221
|
+
180
|
1222
|
+
181
|
1223
|
+
182
|
1224
|
+
183
|
1225
|
+
184
|
1226
|
+
185
|
1227
|
+
186
|
1228
|
+
187
|
1229
|
+
188</pre>
|
1118
1230
|
</td>
|
1119
1231
|
<td>
|
1120
|
-
<pre class="code"><span class="info file"># File 'lib/mocha/api.rb', line
|
1232
|
+
<pre class="code"><span class="info file"># File 'lib/mocha/api.rb', line 163</span>
|
1121
1233
|
|
1122
1234
|
<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
|
-
|
1235
|
+
<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>
|
1236
|
+
<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>
|
1237
|
+
<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>
|
1238
|
+
<span class='const'>Deprecation</span><span class='period'>.</span><span class='id identifier rubyid_warning'>warning</span><span class='lparen'>(</span>
|
1239
|
+
<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>
|
1240
|
+
<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>
|
1241
|
+
<span class='rparen'>)</span>
|
1242
|
+
<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>
|
1243
|
+
<span class='const'>Deprecation</span><span class='period'>.</span><span class='id identifier rubyid_warning'>warning</span><span class='lparen'>(</span>
|
1244
|
+
<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>
|
1245
|
+
<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>
|
1246
|
+
<span class='rparen'>)</span>
|
1247
|
+
<span class='kw'>end</span>
|
1248
|
+
<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>
|
1249
|
+
<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>
|
1250
|
+
<span class='kw'>end</span>
|
1251
|
+
<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>
|
1252
|
+
<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
1253
|
<span class='kw'>end</span>
|
1254
|
+
<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>
|
1255
|
+
<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>
|
1256
|
+
<span class='id identifier rubyid_stub'>stub</span><span class='period'>.</span><span class='id identifier rubyid_stub_everything'>stub_everything</span>
|
1257
|
+
<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>
|
1258
|
+
<span class='id identifier rubyid_stub'>stub</span>
|
1127
1259
|
<span class='kw'>end</span></pre>
|
1128
1260
|
</td>
|
1129
1261
|
</tr>
|
@@ -1143,7 +1275,7 @@
|
|
1143
1275
|
</div>
|
1144
1276
|
|
1145
1277
|
<div id="footer">
|
1146
|
-
Generated on
|
1278
|
+
Generated on Sat Jan 4 17:36:47 2020 by
|
1147
1279
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1148
1280
|
0.9.20 (ruby-2.6.5).
|
1149
1281
|
</div>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Module: Mocha::ClassMethods
|
8
8
|
|
9
|
-
— Mocha 1.
|
9
|
+
— Mocha 1.11.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 Sat Jan 4 17:36:47 2020 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.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; enabled 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 Sat Jan 4 17:36:48 2020 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>
|