mocha 2.4.2 → 2.4.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a8a30148d21664268060ffa4e5f81d0f604af97f57242abb58acbd30292f111
|
4
|
+
data.tar.gz: cf698efc280a8ab7a1405934352f94902535321b102b1d4416c7e6fb01da5961
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a33373ad234b00171114c7515411411b1f304c2f570e4732fe3c667e0462cfc88ca18d013c65ad0dc1f6b5a1a87fba47a6bea6079113f44bd996cc8cfec3f50
|
7
|
+
data.tar.gz: 66cb8130eebc14db769d8752357db57ee55809b25e61646270570f245f1821edd3ea5f11e37f2cb9734a2eca354a616683f1403bbf29c11d4d5c3685d933e261
|
data/RELEASE.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Release Notes
|
2
2
|
|
3
|
+
## 2.4.4
|
4
|
+
|
5
|
+
### External changes
|
6
|
+
|
7
|
+
* Fix regression when method expecting `Hash` parameter or keyword arguments is invoked with no arguments (#662, #663) - thanks to @vlad-pisanov for reporting
|
8
|
+
|
9
|
+
## 2.4.3
|
10
|
+
|
11
|
+
### External changes
|
12
|
+
|
13
|
+
* Fix regression when matching `Hash` parameter or keyword arguments (#657, #660) - thanks to @josesei for reporting and testing
|
14
|
+
|
3
15
|
## 2.4.2
|
4
16
|
|
5
17
|
### External changes
|
@@ -30,20 +30,24 @@ 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 unless parameter
|
42
|
+
return false if @exact && @entries.length != parameter.length
|
43
|
+
|
40
44
|
has_entry_matchers = @entries.map { |key, value| HasEntry.new(key, value) }
|
41
45
|
AllOf.new(*has_entry_matchers).matches?([parameter])
|
42
46
|
end
|
43
47
|
|
44
48
|
# @private
|
45
49
|
def mocha_inspect
|
46
|
-
"has_entries(#{@entries.mocha_inspect})"
|
50
|
+
@exact ? @entries.mocha_inspect : "has_entries(#{@entries.mocha_inspect})"
|
47
51
|
end
|
48
52
|
end
|
49
53
|
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.4
|
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-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby2_keywords
|