mocha 2.4.0 → 2.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -0
- data/RELEASE.md +17 -0
- data/lib/mocha/parameter_matchers/base.rb +0 -5
- data/lib/mocha/parameter_matchers/instance_methods.rb +9 -10
- data/lib/mocha/parameters_matcher.rb +1 -1
- 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: 1ea825862f801a2e95a196ca677bb98aa6d7b9c51a8eb5a3cfcb9e8dea8baabb
|
4
|
+
data.tar.gz: b6f0b63c97d5ec4df6aabc7e8675f7d1b2ba8a99833f724fa9e2087aaa40bdeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b9b72dfc0e523bf8b7c50211e13ee63379fefa565474c755475032bf5dfb6f3d736fcbbf32884a2b9e153a2141b4fc3a291fbf7a2997e9810cb71e0817f3234
|
7
|
+
data.tar.gz: 61f87b76172af493bf4f2354f2638a939d122388490d56179e8bc1c719b95af97815fa860c2936cfc88980bd7bb547689c5ad53941c731acd42a1c10de3d855b
|
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,5 +1,22 @@
|
|
1
1
|
# Release Notes
|
2
2
|
|
3
|
+
## 2.4.2
|
4
|
+
|
5
|
+
### External changes
|
6
|
+
|
7
|
+
* Don't trust `Object#is_a?` in presence of mock objects (#656) - thanks to @casperisfine
|
8
|
+
|
9
|
+
## 2.4.1
|
10
|
+
|
11
|
+
### External changes
|
12
|
+
|
13
|
+
* Fix regression in matchers when used with keyword arguments (#654 & #655) - thanks to @ElvinEfendi for reporting
|
14
|
+
|
15
|
+
### Internal changes
|
16
|
+
|
17
|
+
* Reduce duplication & consolidate `#to_matcher` method definitions (600ee2aa, e9de64e4, #655)
|
18
|
+
* Change `#to_matcher` method to use keyword arguments (3b60b7df, #655)
|
19
|
+
|
3
20
|
## 2.4.0
|
4
21
|
|
5
22
|
### External changes
|
@@ -2,11 +2,6 @@ module Mocha
|
|
2
2
|
module ParameterMatchers
|
3
3
|
# @abstract Subclass and implement +#matches?+ and +#mocha_inspect+ to define a custom matcher. Also add a suitably named instance method to {ParameterMatchers} to build an instance of the new matcher c.f. {#equals}.
|
4
4
|
class Base
|
5
|
-
# @private
|
6
|
-
def to_matcher(_expectation = nil)
|
7
|
-
self
|
8
|
-
end
|
9
|
-
|
10
5
|
# A shorthand way of combining two matchers when both must match.
|
11
6
|
#
|
12
7
|
# Returns a new {AllOf} parameter matcher combining two matchers using a logical AND.
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'mocha/parameter_matchers/base'
|
1
2
|
require 'mocha/parameter_matchers/equals'
|
2
3
|
require 'mocha/parameter_matchers/positional_or_keyword_hash'
|
3
4
|
|
@@ -6,8 +7,14 @@ module Mocha
|
|
6
7
|
# @private
|
7
8
|
module InstanceMethods
|
8
9
|
# @private
|
9
|
-
def to_matcher(
|
10
|
-
|
10
|
+
def to_matcher(expectation: nil, top_level: false)
|
11
|
+
if Base === self
|
12
|
+
self
|
13
|
+
elsif Hash === self && top_level
|
14
|
+
Mocha::ParameterMatchers::PositionalOrKeywordHash.new(self, expectation)
|
15
|
+
else
|
16
|
+
Mocha::ParameterMatchers::Equals.new(self)
|
17
|
+
end
|
11
18
|
end
|
12
19
|
end
|
13
20
|
end
|
@@ -17,11 +24,3 @@ end
|
|
17
24
|
class Object
|
18
25
|
include Mocha::ParameterMatchers::InstanceMethods
|
19
26
|
end
|
20
|
-
|
21
|
-
# @private
|
22
|
-
class Hash
|
23
|
-
# @private
|
24
|
-
def to_matcher(expectation = nil)
|
25
|
-
Mocha::ParameterMatchers::PositionalOrKeywordHash.new(self, expectation)
|
26
|
-
end
|
27
|
-
end
|
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.2
|
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
|
+
date: 2024-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby2_keywords
|