diff --git a/docs/Mocha.html b/docs/Mocha.html index a4c81ae2..3689f0ab 100644 --- a/docs/Mocha.html +++ b/docs/Mocha.html @@ -6,7 +6,7 @@
When a method is invoked on a mock object, the mock object searches through its expectations from newest to oldest to find one that matches the invocation. After the invocation, the matching expectation might stop matching further invocations. For example, an expects(:foo).once expectation only matches once and will be ignored on future invocations while an expects(:foo).at_least_once expectation will always be matched against invocations.
+However, note that if the expectation that matches the invocation has a cardinality of “never”, then an unexpected invocation error is reported.
+This scheme allows you to:
Set up default stubs in your the setup
method of your test class and override some of those stubs in individual tests.
-315 -316 -317+318 +319 +320
# File 'lib/mocha/mock.rb', line 315 +# File 'lib/mocha/mock.rb', line 318 def method_missing(symbol, *arguments, &block) # rubocop:disable Style/MethodMissingSuper handle_method_call(symbol, arguments, block) @@ -514,9 +516,6 @@
-111 -112 -113 114 115 116 @@ -526,10 +525,13 @@
120 121 122 -123 +123 +124 +125 +126
# File 'lib/mocha/mock.rb', line 111 +# File 'lib/mocha/mock.rb', line 114 def expects(method_name_or_hash, backtrace = nil) expectation = nil @@ -685,13 +687,13 @@
-238 -239 -240 -241+241 +242 +243 +244
# File 'lib/mocha/mock.rb', line 238 +# File 'lib/mocha/mock.rb', line 241 def responds_like(responder) @responder = responder @@ -809,12 +811,12 @@
-271 -272 -273+274 +275 +276
# File 'lib/mocha/mock.rb', line 271 +# File 'lib/mocha/mock.rb', line 274 def responds_like_instance_of(responder_class) responds_like(responder_class.allocate) @@ -981,9 +983,6 @@
-150 -151 -152 153 154 155 @@ -994,10 +993,13 @@
160 161 162 -163 +163 +164 +165 +166
# File 'lib/mocha/mock.rb', line 150 +# File 'lib/mocha/mock.rb', line 153 def stubs(method_name_or_hash, backtrace = nil) expectation = nil @@ -1092,14 +1094,14 @@
-183 -184 -185 186 -187+187 +188 +189 +190
# File 'lib/mocha/mock.rb', line 183 +# File 'lib/mocha/mock.rb', line 186 def unstub(*method_names) method_names.each do |method_name| @@ -1116,7 +1118,7 @@
diff --git a/docs/Mocha/ObjectMethods.html b/docs/Mocha/ObjectMethods.html index 0595b482..7dc5851c 100644 --- a/docs/Mocha/ObjectMethods.html +++ b/docs/Mocha/ObjectMethods.html @@ -6,7 +6,7 @@Module: Mocha::ObjectMethods - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -747,7 +747,7 @@
diff --git a/docs/Mocha/ParameterMatchers.html b/docs/Mocha/ParameterMatchers.html index fc8cbac4..d6260ac5 100644 --- a/docs/Mocha/ParameterMatchers.html +++ b/docs/Mocha/ParameterMatchers.html @@ -6,7 +6,7 @@Module: Mocha::ParameterMatchers - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -3167,7 +3167,7 @@
diff --git a/docs/Mocha/ParameterMatchers/AllOf.html b/docs/Mocha/ParameterMatchers/AllOf.html index 801025a2..1530a6c5 100644 --- a/docs/Mocha/ParameterMatchers/AllOf.html +++ b/docs/Mocha/ParameterMatchers/AllOf.html @@ -6,7 +6,7 @@Class: Mocha::ParameterMatchers::AllOf - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -135,7 +135,7 @@Methods inherited from - Generated on Thu Nov 28 14:57:34 2024 by + Generated on Sat Dec 7 12:49:10 2024 by yard 0.9.37 (ruby-3.3.6). diff --git a/docs/Mocha/ParameterMatchers/AnyOf.html b/docs/Mocha/ParameterMatchers/AnyOf.html index c70a0ff2..7c3eb289 100644 --- a/docs/Mocha/ParameterMatchers/AnyOf.html +++ b/docs/Mocha/ParameterMatchers/AnyOf.html @@ -6,7 +6,7 @@
Class: Mocha::ParameterMatchers::AnyOf - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -135,7 +135,7 @@Methods inherited from - Generated on Thu Nov 28 14:57:34 2024 by + Generated on Sat Dec 7 12:49:10 2024 by yard 0.9.37 (ruby-3.3.6). diff --git a/docs/Mocha/ParameterMatchers/AnyParameters.html b/docs/Mocha/ParameterMatchers/AnyParameters.html index bf35aca2..6ab3df40 100644 --- a/docs/Mocha/ParameterMatchers/AnyParameters.html +++ b/docs/Mocha/ParameterMatchers/AnyParameters.html @@ -6,7 +6,7 @@
Class: Mocha::ParameterMatchers::AnyParameters - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -135,7 +135,7 @@Methods inherited from - Generated on Thu Nov 28 14:57:34 2024 by + Generated on Sat Dec 7 12:49:10 2024 by yard 0.9.37 (ruby-3.3.6). diff --git a/docs/Mocha/ParameterMatchers/Anything.html b/docs/Mocha/ParameterMatchers/Anything.html index 63b2e4be..17ca5bc2 100644 --- a/docs/Mocha/ParameterMatchers/Anything.html +++ b/docs/Mocha/ParameterMatchers/Anything.html @@ -6,7 +6,7 @@
Class: Mocha::ParameterMatchers::Anything - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -135,7 +135,7 @@Methods inherited from - Generated on Thu Nov 28 14:57:34 2024 by + Generated on Sat Dec 7 12:49:10 2024 by yard 0.9.37 (ruby-3.3.6). diff --git a/docs/Mocha/ParameterMatchers/Base.html b/docs/Mocha/ParameterMatchers/Base.html index 5e1647fe..14deba14 100644 --- a/docs/Mocha/ParameterMatchers/Base.html +++ b/docs/Mocha/ParameterMatchers/Base.html @@ -6,7 +6,7 @@
Class: Mocha::ParameterMatchers::Base - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -423,7 +423,7 @@
diff --git a/docs/Mocha/ParameterMatchers/Equals.html b/docs/Mocha/ParameterMatchers/Equals.html index 7ab94bf4..e2c00fca 100644 --- a/docs/Mocha/ParameterMatchers/Equals.html +++ b/docs/Mocha/ParameterMatchers/Equals.html @@ -6,7 +6,7 @@Class: Mocha::ParameterMatchers::Equals - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -135,7 +135,7 @@Methods inherited from - Generated on Thu Nov 28 14:57:34 2024 by + Generated on Sat Dec 7 12:49:10 2024 by yard 0.9.37 (ruby-3.3.6). diff --git a/docs/Mocha/ParameterMatchers/EquivalentUri.html b/docs/Mocha/ParameterMatchers/EquivalentUri.html index 24014f1c..2fc1864e 100644 --- a/docs/Mocha/ParameterMatchers/EquivalentUri.html +++ b/docs/Mocha/ParameterMatchers/EquivalentUri.html @@ -6,7 +6,7 @@
Class: Mocha::ParameterMatchers::EquivalentUri - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -135,7 +135,7 @@Methods inherited from - Generated on Thu Nov 28 14:57:34 2024 by + Generated on Sat Dec 7 12:49:10 2024 by yard 0.9.37 (ruby-3.3.6). diff --git a/docs/Mocha/ParameterMatchers/HasEntries.html b/docs/Mocha/ParameterMatchers/HasEntries.html index 77bd63b6..a5cf2954 100644 --- a/docs/Mocha/ParameterMatchers/HasEntries.html +++ b/docs/Mocha/ParameterMatchers/HasEntries.html @@ -6,7 +6,7 @@
Class: Mocha::ParameterMatchers::HasEntries - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -135,7 +135,7 @@Methods inherited from - Generated on Thu Nov 28 14:57:34 2024 by + Generated on Sat Dec 7 12:49:10 2024 by yard 0.9.37 (ruby-3.3.6). diff --git a/docs/Mocha/ParameterMatchers/HasEntry.html b/docs/Mocha/ParameterMatchers/HasEntry.html index d1a81cdf..fde68400 100644 --- a/docs/Mocha/ParameterMatchers/HasEntry.html +++ b/docs/Mocha/ParameterMatchers/HasEntry.html @@ -6,7 +6,7 @@
Class: Mocha::ParameterMatchers::HasEntry - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -135,7 +135,7 @@Methods inherited from - Generated on Thu Nov 28 14:57:34 2024 by + Generated on Sat Dec 7 12:49:10 2024 by yard 0.9.37 (ruby-3.3.6). diff --git a/docs/Mocha/ParameterMatchers/HasKey.html b/docs/Mocha/ParameterMatchers/HasKey.html index 4748b4dc..c75841c6 100644 --- a/docs/Mocha/ParameterMatchers/HasKey.html +++ b/docs/Mocha/ParameterMatchers/HasKey.html @@ -6,7 +6,7 @@
Class: Mocha::ParameterMatchers::HasKey - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -135,7 +135,7 @@Methods inherited from - Generated on Thu Nov 28 14:57:34 2024 by + Generated on Sat Dec 7 12:49:10 2024 by yard 0.9.37 (ruby-3.3.6). diff --git a/docs/Mocha/ParameterMatchers/HasKeys.html b/docs/Mocha/ParameterMatchers/HasKeys.html index 178d7a86..d0c7c58a 100644 --- a/docs/Mocha/ParameterMatchers/HasKeys.html +++ b/docs/Mocha/ParameterMatchers/HasKeys.html @@ -6,7 +6,7 @@
Class: Mocha::ParameterMatchers::HasKeys - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -135,7 +135,7 @@Methods inherited from - Generated on Thu Nov 28 14:57:34 2024 by + Generated on Sat Dec 7 12:49:10 2024 by yard 0.9.37 (ruby-3.3.6). diff --git a/docs/Mocha/ParameterMatchers/HasValue.html b/docs/Mocha/ParameterMatchers/HasValue.html index 4312da7b..33c67fcc 100644 --- a/docs/Mocha/ParameterMatchers/HasValue.html +++ b/docs/Mocha/ParameterMatchers/HasValue.html @@ -6,7 +6,7 @@
Class: Mocha::ParameterMatchers::HasValue - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -135,7 +135,7 @@Methods inherited from - Generated on Thu Nov 28 14:57:34 2024 by + Generated on Sat Dec 7 12:49:10 2024 by yard 0.9.37 (ruby-3.3.6). diff --git a/docs/Mocha/ParameterMatchers/Includes.html b/docs/Mocha/ParameterMatchers/Includes.html index 059a87e2..7250291b 100644 --- a/docs/Mocha/ParameterMatchers/Includes.html +++ b/docs/Mocha/ParameterMatchers/Includes.html @@ -6,7 +6,7 @@
Class: Mocha::ParameterMatchers::Includes - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -135,7 +135,7 @@Methods inherited from - Generated on Thu Nov 28 14:57:34 2024 by + Generated on Sat Dec 7 12:49:10 2024 by yard 0.9.37 (ruby-3.3.6). diff --git a/docs/Mocha/ParameterMatchers/InstanceOf.html b/docs/Mocha/ParameterMatchers/InstanceOf.html index de5d0f1c..19d8def5 100644 --- a/docs/Mocha/ParameterMatchers/InstanceOf.html +++ b/docs/Mocha/ParameterMatchers/InstanceOf.html @@ -6,7 +6,7 @@
Class: Mocha::ParameterMatchers::InstanceOf - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -135,7 +135,7 @@Methods inherited from - Generated on Thu Nov 28 14:57:34 2024 by + Generated on Sat Dec 7 12:49:10 2024 by yard 0.9.37 (ruby-3.3.6). diff --git a/docs/Mocha/ParameterMatchers/IsA.html b/docs/Mocha/ParameterMatchers/IsA.html index bf09c73c..d16af2b6 100644 --- a/docs/Mocha/ParameterMatchers/IsA.html +++ b/docs/Mocha/ParameterMatchers/IsA.html @@ -6,7 +6,7 @@
Class: Mocha::ParameterMatchers::IsA - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -135,7 +135,7 @@Methods inherited from - Generated on Thu Nov 28 14:57:34 2024 by + Generated on Sat Dec 7 12:49:10 2024 by yard 0.9.37 (ruby-3.3.6). diff --git a/docs/Mocha/ParameterMatchers/KindOf.html b/docs/Mocha/ParameterMatchers/KindOf.html index 36dfc364..c67c8a87 100644 --- a/docs/Mocha/ParameterMatchers/KindOf.html +++ b/docs/Mocha/ParameterMatchers/KindOf.html @@ -6,7 +6,7 @@
Class: Mocha::ParameterMatchers::KindOf - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -135,7 +135,7 @@Methods inherited from - Generated on Thu Nov 28 14:57:34 2024 by + Generated on Sat Dec 7 12:49:10 2024 by yard 0.9.37 (ruby-3.3.6). diff --git a/docs/Mocha/ParameterMatchers/Not.html b/docs/Mocha/ParameterMatchers/Not.html index 3deefedd..26d210e9 100644 --- a/docs/Mocha/ParameterMatchers/Not.html +++ b/docs/Mocha/ParameterMatchers/Not.html @@ -6,7 +6,7 @@
Class: Mocha::ParameterMatchers::Not - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -135,7 +135,7 @@Methods inherited from - Generated on Thu Nov 28 14:57:34 2024 by + Generated on Sat Dec 7 12:49:10 2024 by yard 0.9.37 (ruby-3.3.6). diff --git a/docs/Mocha/ParameterMatchers/Optionally.html b/docs/Mocha/ParameterMatchers/Optionally.html index bd924412..f96d7e51 100644 --- a/docs/Mocha/ParameterMatchers/Optionally.html +++ b/docs/Mocha/ParameterMatchers/Optionally.html @@ -6,7 +6,7 @@
Class: Mocha::ParameterMatchers::Optionally - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -135,7 +135,7 @@Methods inherited from - Generated on Thu Nov 28 14:57:34 2024 by + Generated on Sat Dec 7 12:49:10 2024 by yard 0.9.37 (ruby-3.3.6). diff --git a/docs/Mocha/ParameterMatchers/RegexpMatches.html b/docs/Mocha/ParameterMatchers/RegexpMatches.html index 015b3c1b..174c8949 100644 --- a/docs/Mocha/ParameterMatchers/RegexpMatches.html +++ b/docs/Mocha/ParameterMatchers/RegexpMatches.html @@ -6,7 +6,7 @@
Class: Mocha::ParameterMatchers::RegexpMatches - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -135,7 +135,7 @@Methods inherited from - Generated on Thu Nov 28 14:57:34 2024 by + Generated on Sat Dec 7 12:49:10 2024 by yard 0.9.37 (ruby-3.3.6). diff --git a/docs/Mocha/ParameterMatchers/RespondsWith.html b/docs/Mocha/ParameterMatchers/RespondsWith.html index 479a3ea0..bcb1b441 100644 --- a/docs/Mocha/ParameterMatchers/RespondsWith.html +++ b/docs/Mocha/ParameterMatchers/RespondsWith.html @@ -6,7 +6,7 @@
Class: Mocha::ParameterMatchers::RespondsWith - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -135,7 +135,7 @@Methods inherited from - Generated on Thu Nov 28 14:57:34 2024 by + Generated on Sat Dec 7 12:49:10 2024 by yard 0.9.37 (ruby-3.3.6). diff --git a/docs/Mocha/ParameterMatchers/YamlEquivalent.html b/docs/Mocha/ParameterMatchers/YamlEquivalent.html index 66a4f297..a149ff86 100644 --- a/docs/Mocha/ParameterMatchers/YamlEquivalent.html +++ b/docs/Mocha/ParameterMatchers/YamlEquivalent.html @@ -6,7 +6,7 @@
Class: Mocha::ParameterMatchers::YamlEquivalent - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -135,7 +135,7 @@Methods inherited from - Generated on Thu Nov 28 14:57:34 2024 by + Generated on Sat Dec 7 12:49:10 2024 by yard 0.9.37 (ruby-3.3.6). diff --git a/docs/Mocha/Sequence.html b/docs/Mocha/Sequence.html index bf3f066c..f3ac4709 100644 --- a/docs/Mocha/Sequence.html +++ b/docs/Mocha/Sequence.html @@ -6,7 +6,7 @@
Class: Mocha::Sequence - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -131,7 +131,7 @@Overview
diff --git a/docs/Mocha/StateMachine.html b/docs/Mocha/StateMachine.html index 05f5a578..f4fcacbc 100644 --- a/docs/Mocha/StateMachine.html +++ b/docs/Mocha/StateMachine.html @@ -6,7 +6,7 @@Class: Mocha::StateMachine - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -664,7 +664,7 @@diff --git a/docs/Mocha/StateMachine/State.html b/docs/Mocha/StateMachine/State.html index 6281bbd2..1024330a 100644 --- a/docs/Mocha/StateMachine/State.html +++ b/docs/Mocha/StateMachine/State.html @@ -6,7 +6,7 @@
Class: Mocha::StateMachine::State - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -130,7 +130,7 @@Overview
diff --git a/docs/Mocha/StateMachine/StatePredicate.html b/docs/Mocha/StateMachine/StatePredicate.html index 3d23d35e..e8ba4a00 100644 --- a/docs/Mocha/StateMachine/StatePredicate.html +++ b/docs/Mocha/StateMachine/StatePredicate.html @@ -6,7 +6,7 @@Class: Mocha::StateMachine::StatePredicate - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -126,7 +126,7 @@Direct Known Subclasses
diff --git a/docs/Mocha/StubbingError.html b/docs/Mocha/StubbingError.html index db3875cb..984c3f0e 100644 --- a/docs/Mocha/StubbingError.html +++ b/docs/Mocha/StubbingError.html @@ -6,7 +6,7 @@Class: Mocha::StubbingError - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -132,7 +132,7 @@Overview
diff --git a/docs/_index.html b/docs/_index.html index 77c64f67..1c01e3ad 100644 --- a/docs/_index.html +++ b/docs/_index.html @@ -4,7 +4,7 @@- Mocha 2.6.1 + Mocha 2.7.0 @@ -52,7 +52,7 @@ -diff --git a/docs/file.MIT-LICENSE.html b/docs/file.MIT-LICENSE.html index b450fafd..e46af3ee 100644 --- a/docs/file.MIT-LICENSE.html +++ b/docs/file.MIT-LICENSE.html @@ -6,7 +6,7 @@Mocha 2.6.1
+Mocha 2.7.0
diff --git a/docs/file.COPYING.html b/docs/file.COPYING.html index f0d3e9b0..f7b714dc 100644 --- a/docs/file.COPYING.html +++ b/docs/file.COPYING.html @@ -6,7 +6,7 @@Alphabetic Index
@@ -508,7 +508,7 @@Namespace Listing A-Z
File: COPYING - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -63,7 +63,7 @@File: MIT-LICENSE - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -67,7 +67,7 @@ diff --git a/docs/file.README.html b/docs/file.README.html index 82b4c793..2f06e089 100644 --- a/docs/file.README.html +++ b/docs/file.README.html @@ -6,7 +6,7 @@File: README - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -331,7 +331,7 @@Expectation matching / invocation
Stubs and expectations are basically the same thing. A stub is just an expectation of zero or more invocations. The
-Expectation#stubs
method is syntactic sugar to make the intent of the test more explicit.When a method is invoked on a mock object, the mock object searches through its expectations from newest to oldest to find one that matches the invocation. After the invocation, the matching expectation might stop matching further invocations.
+When a method is invoked on a mock object, the mock object searches through its expectations from newest to oldest to find one that matches the invocation. After the invocation, the matching expectation might stop matching further invocations. If the expectation that matches the invocation has a cardinality of "never", then an unexpected invocation error is reported.
See the documentation for
@@ -430,7 +430,7 @@Mocha::Mock
for further details.License
diff --git a/docs/file.RELEASE.html b/docs/file.RELEASE.html index 4bde4658..e20201fe 100644 --- a/docs/file.RELEASE.html +++ b/docs/file.RELEASE.html @@ -6,7 +6,7 @@File: RELEASE - — Mocha 2.6.1 + — Mocha 2.7.0 @@ -59,6 +59,34 @@diff --git a/docs/frames.html b/docs/frames.html index c507381a..2851f79f 100644 --- a/docs/frames.html +++ b/docs/frames.html @@ -2,7 +2,7 @@ -Release Notes
+2.7.0
+ +External changes
+ ++
+ +- Fail fast if invocation matches never expectation (#679, #678, #490, #131 & #44) - thanks to @ducmtran & @davidstosik for reporting
+Internal changes
+ ++
+ +- Workaround for JRuby jar-dependencies issue (#690)
+- Ruby v3.4 stacktrace uses single-quote vs backtick (#688 & #689) - thanks to Vít Ondruch
+WARNING: This release fixes a very old bug
+ ++
+- The bug relates to the use of
+Expectation#never
in combination with other expectations on the same method.- Please ensure you fix the relevant deprecation warnings when running against v2.6.1 before upgrading to v2.7.0.
+- +
Previously, the following test would have passed, but now it will fail with an unexpected invocation error on the
+ +foo.bar
line.foo = mock('foo') +foo.stubs(:bar) +foo.expects(:bar).never +foo.bar
2.6.1
External changes
@@ -1501,7 +1529,7 @@0.1.1
Mocha 2.6.1 +Mocha 2.7.0