mocha 2.6.0 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/RELEASE.md +9 -0
- data/lib/mocha/mock.rb +18 -12
- data/lib/mocha/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 427e4fdcdcceac0496dd9ad52802ae29be41ba102de0888e58f6c379c77ac24e
|
4
|
+
data.tar.gz: d2c3e87c6d5f861f1ae2124b758fd548e19f2299e1ebe69551b7483d0941516d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b82f53427cf92b742d97c551808e42f8b954148f7311f97bb52e4c1c15952515cce115e23022ce10a5d52e07238dc8ce7188d810de5f4a7e193ca59d72b2e4f
|
7
|
+
data.tar.gz: c345496f74391ca1b8b2f6a4b0d3947f30c119a89416c7f69037b064c6ca207a77607fa8bd93443152c196f4f5fef93cccc984c4a75040ee675d140237dd0f8b
|
data/RELEASE.md
CHANGED
@@ -1,11 +1,20 @@
|
|
1
1
|
# Release Notes
|
2
2
|
|
3
|
+
## 2.6.1
|
4
|
+
|
5
|
+
### External changes
|
6
|
+
|
7
|
+
* Fix logic for displaying deprecation warning for expectation with never cardinality (#686) - thanks to @davidstosik for reporting
|
8
|
+
|
3
9
|
## 2.6.0
|
4
10
|
|
5
11
|
### External changes
|
6
12
|
|
7
13
|
* Expectation with never cardinality should display deprecation warning (#681) - thanks to @ducmtran for reporting and testing
|
8
14
|
|
15
|
+
**WARNING: This release results in some incorrect deprecation warnings:**
|
16
|
+
* The logic for displaying the deprecation warnings is fixed in v2.6.1 (#686).
|
17
|
+
|
9
18
|
### Internal changes
|
10
19
|
|
11
20
|
* Simplify backtrace related assertions (#680)
|
data/lib/mocha/mock.rb
CHANGED
@@ -318,25 +318,31 @@ module Mocha
|
|
318
318
|
ruby2_keywords(:method_missing)
|
319
319
|
|
320
320
|
# @private
|
321
|
-
def handle_method_call(symbol, arguments, block)
|
321
|
+
def handle_method_call(symbol, arguments, block) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
322
322
|
check_expiry
|
323
323
|
check_responder_responds_to(symbol)
|
324
324
|
invocation = Invocation.new(self, symbol, arguments, block)
|
325
325
|
|
326
326
|
matching_expectations = all_expectations.matching_expectations(invocation)
|
327
|
-
matching_expectation_allowing_invocation = matching_expectations.detect(&:invocations_allowed?)
|
328
|
-
matching_expectation_never_allowing_invocation = matching_expectations.detect(&:invocations_never_allowed?)
|
329
327
|
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
328
|
+
index = 0
|
329
|
+
never_allowed_expectation = nil
|
330
|
+
while index < matching_expectations.length
|
331
|
+
matching_expectation = matching_expectations[index]
|
332
|
+
if matching_expectation.invocations_never_allowed?
|
333
|
+
never_allowed_expectation = matching_expectation
|
334
|
+
elsif matching_expectation.invocations_allowed?
|
335
|
+
if never_allowed_expectation
|
336
|
+
invocation_not_allowed_warning(invocation, never_allowed_expectation)
|
337
|
+
end
|
338
|
+
return matching_expectation.invoke(invocation)
|
339
339
|
end
|
340
|
+
index += 1
|
341
|
+
end
|
342
|
+
|
343
|
+
matching_expectation_ignoring_order = all_expectations.match(invocation, ignoring_order: true)
|
344
|
+
if matching_expectation_ignoring_order || (!matching_expectation_ignoring_order && !@everything_stubbed) # rubocop:disable Style/GuardClause
|
345
|
+
raise_unexpected_invocation_error(invocation, matching_expectation_ignoring_order)
|
340
346
|
end
|
341
347
|
end
|
342
348
|
|
data/lib/mocha/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mocha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Mead
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby2_keywords
|