mocha 2.4.1 → 2.4.3
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20b26576ac50c2162b416a544a08067d42398349077ac592e8e1f950497f8fbd
|
4
|
+
data.tar.gz: d587d5707e1a636734571b94935a450848303248f232e1d1cab9f4c0ba971460
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eaa8c9e311cdced9c27bda88ce59e14929e8533c9dbb87913c32ccf4432b499ce28c340c31d4d725bc703419c5c5a3fcf8ef241ab47539ccb4adc224cea3738c
|
7
|
+
data.tar.gz: e7088d55909895d76db07023f58342913b558cfc8d628779d51b1b46b6132a52f6f6f60ea50b147cc120d7b5a5b1c046567beeb91f272b5701665cd22bc65f83
|
data/.rubocop.yml
CHANGED
@@ -36,6 +36,11 @@ Style/WhileUntilModifier:
|
|
36
36
|
Style/AccessModifierDeclarations:
|
37
37
|
Enabled: false
|
38
38
|
|
39
|
+
# `Module#===` is useful in presence of objects such as mocks
|
40
|
+
# that may have a `is_a?` implementation that lies.
|
41
|
+
Style/CaseEquality:
|
42
|
+
Enabled: false
|
43
|
+
|
39
44
|
# This is useful when using `ExecutionPoint.current` to make tests more robust
|
40
45
|
Style/Semicolon:
|
41
46
|
Enabled: false
|
data/RELEASE.md
CHANGED
@@ -1,10 +1,22 @@
|
|
1
1
|
# Release Notes
|
2
2
|
|
3
|
+
## 2.4.3
|
4
|
+
|
5
|
+
### External changes
|
6
|
+
|
7
|
+
* Fix regression when matching Hash parameter or keyword arguments (#657, #660) - thanks to @josesei for reporting and testing
|
8
|
+
|
9
|
+
## 2.4.2
|
10
|
+
|
11
|
+
### External changes
|
12
|
+
|
13
|
+
* Don't trust `Object#is_a?` in presence of mock objects (#656) - thanks to @casperisfine
|
14
|
+
|
3
15
|
## 2.4.1
|
4
16
|
|
5
17
|
### External changes
|
6
18
|
|
7
|
-
* Fix regression in matchers when used with keyword arguments (#
|
19
|
+
* Fix regression in matchers when used with keyword arguments (#654 & #655) - thanks to @ElvinEfendi for reporting
|
8
20
|
|
9
21
|
### Internal changes
|
10
22
|
|
@@ -30,20 +30,23 @@ module Mocha
|
|
30
30
|
# Parameter matcher which matches when actual parameter contains all expected +Hash+ entries.
|
31
31
|
class HasEntries < Base
|
32
32
|
# @private
|
33
|
-
def initialize(entries)
|
33
|
+
def initialize(entries, exact: false)
|
34
34
|
@entries = entries
|
35
|
+
@exact = exact
|
35
36
|
end
|
36
37
|
|
37
38
|
# @private
|
38
39
|
def matches?(available_parameters)
|
39
40
|
parameter = available_parameters.shift
|
41
|
+
return false if @exact && @entries.length != parameter.length
|
42
|
+
|
40
43
|
has_entry_matchers = @entries.map { |key, value| HasEntry.new(key, value) }
|
41
44
|
AllOf.new(*has_entry_matchers).matches?([parameter])
|
42
45
|
end
|
43
46
|
|
44
47
|
# @private
|
45
48
|
def mocha_inspect
|
46
|
-
"has_entries(#{@entries.mocha_inspect})"
|
49
|
+
@exact ? @entries.mocha_inspect : "has_entries(#{@entries.mocha_inspect})"
|
47
50
|
end
|
48
51
|
end
|
49
52
|
end
|
@@ -8,9 +8,9 @@ module Mocha
|
|
8
8
|
module InstanceMethods
|
9
9
|
# @private
|
10
10
|
def to_matcher(expectation: nil, top_level: false)
|
11
|
-
if
|
11
|
+
if Base === self
|
12
12
|
self
|
13
|
-
elsif
|
13
|
+
elsif Hash === self && top_level
|
14
14
|
Mocha::ParameterMatchers::PositionalOrKeywordHash.new(self, expectation)
|
15
15
|
else
|
16
16
|
Mocha::ParameterMatchers::Equals.new(self)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'mocha/configuration'
|
2
2
|
require 'mocha/deprecation'
|
3
3
|
require 'mocha/parameter_matchers/base'
|
4
|
+
require 'mocha/parameter_matchers/has_entries'
|
4
5
|
|
5
6
|
module Mocha
|
6
7
|
module ParameterMatchers
|
@@ -14,7 +15,7 @@ module Mocha
|
|
14
15
|
def matches?(available_parameters)
|
15
16
|
parameter, is_last_parameter = extract_parameter(available_parameters)
|
16
17
|
|
17
|
-
return false unless HasEntries.new(@value).matches?([parameter])
|
18
|
+
return false unless HasEntries.new(@value, exact: true).matches?([parameter])
|
18
19
|
|
19
20
|
if is_last_parameter && !same_type_of_hash?(parameter, @value)
|
20
21
|
return false if Mocha.configuration.strict_keyword_argument_matching?
|
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.4.
|
4
|
+
version: 2.4.3
|
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-07-
|
11
|
+
date: 2024-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby2_keywords
|