mocha 2.4.2 → 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/RELEASE.md
CHANGED
|
@@ -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
|
|
@@ -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
|