matchi 3.1.0 → 3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/matchi/be_an_instance_of.rb +3 -3
- data/lib/matchi/change.rb +15 -15
- data/lib/matchi/raise_exception.rb +3 -3
- 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: 294443e7f304a5c154aa48af9c20145bba9ff2caaf090bb7336c9bb7538be19d
|
4
|
+
data.tar.gz: c89f84d45eaf0923a7a023bd11b9cf54830054a178ce93e1074aea63cb7a9658
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fe569142636d1acbba97f47dc7efbe38da3c02e9b19e77ab7ad723b6c03a52c03c3d8cd730a9948b4c45b21cdb6e807c29c181fd5d27f77aeee11c92c9738f4
|
7
|
+
data.tar.gz: 2bd24bb8f545496e7bbb115f9bd1577f60d03e67198a0452cd2393f977f063ac0e168f699930c6819a0c478a9c208627db75f7c49a63e5f5905256ba0ef3c8ca
|
data/README.md
CHANGED
@@ -95,7 +95,7 @@ matcher.matches? { "foo" } # => true
|
|
95
95
|
```ruby
|
96
96
|
matcher = Matchi::RaiseException.new(:NameError)
|
97
97
|
|
98
|
-
matcher.expected # =>
|
98
|
+
matcher.expected # => "NameError"
|
99
99
|
matcher.matches? { Boom } # => true
|
100
100
|
```
|
101
101
|
|
@@ -104,7 +104,7 @@ matcher.matches? { Boom } # => true
|
|
104
104
|
```ruby
|
105
105
|
matcher = Matchi::BeAnInstanceOf.new(:String)
|
106
106
|
|
107
|
-
matcher.expected # =>
|
107
|
+
matcher.expected # => "String"
|
108
108
|
matcher.matches? { "foo" } # => true
|
109
109
|
```
|
110
110
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Matchi
|
4
4
|
# *Type/class* matcher.
|
5
5
|
class BeAnInstanceOf
|
6
|
-
# @return [
|
6
|
+
# @return [String] The expected class name.
|
7
7
|
attr_reader :expected
|
8
8
|
|
9
9
|
# Initialize the matcher with (the name of) a class or module.
|
@@ -15,7 +15,7 @@ module Matchi
|
|
15
15
|
#
|
16
16
|
# @param expected [Class, #to_s] The expected class name.
|
17
17
|
def initialize(expected)
|
18
|
-
@expected = String(expected)
|
18
|
+
@expected = String(expected)
|
19
19
|
end
|
20
20
|
|
21
21
|
# Boolean comparison between the class of the actual value and the
|
@@ -26,7 +26,7 @@ module Matchi
|
|
26
26
|
#
|
27
27
|
# matcher = Matchi::BeAnInstanceOf.new(String)
|
28
28
|
#
|
29
|
-
# matcher.expected # =>
|
29
|
+
# matcher.expected # => "String"
|
30
30
|
# matcher.matches? { "foo" } # => true
|
31
31
|
#
|
32
32
|
# @yieldreturn [#class] the actual value to compare to the expected one.
|
data/lib/matchi/change.rb
CHANGED
@@ -35,11 +35,11 @@ module Matchi
|
|
35
35
|
# change_wrapper = Matchi::Change.new(object, :length)
|
36
36
|
# change_wrapper.by_at_least(1)
|
37
37
|
#
|
38
|
-
# @param
|
38
|
+
# @param minimum_delta [#object_id] The minimum delta of the expected change.
|
39
39
|
#
|
40
40
|
# @return [#matches?] A *change by at least* matcher.
|
41
|
-
def by_at_least(
|
42
|
-
ByAtLeast.new(
|
41
|
+
def by_at_least(minimum_delta)
|
42
|
+
ByAtLeast.new(minimum_delta, &@state)
|
43
43
|
end
|
44
44
|
|
45
45
|
# Specifies a maximum delta of the expected change.
|
@@ -52,11 +52,11 @@ module Matchi
|
|
52
52
|
# change_wrapper = Matchi::Change.new(object, :length)
|
53
53
|
# change_wrapper.by_at_most(1)
|
54
54
|
#
|
55
|
-
# @param
|
55
|
+
# @param maximum_delta [#object_id] The maximum delta of the expected change.
|
56
56
|
#
|
57
57
|
# @return [#matches?] A *change by at most* matcher.
|
58
|
-
def by_at_most(
|
59
|
-
ByAtMost.new(
|
58
|
+
def by_at_most(maximum_delta)
|
59
|
+
ByAtMost.new(maximum_delta, &@state)
|
60
60
|
end
|
61
61
|
|
62
62
|
# Specifies the delta of the expected change.
|
@@ -69,11 +69,11 @@ module Matchi
|
|
69
69
|
# change_wrapper = Matchi::Change.new(object, :length)
|
70
70
|
# change_wrapper.by(1)
|
71
71
|
#
|
72
|
-
# @param
|
72
|
+
# @param delta [#object_id] The delta of the expected change.
|
73
73
|
#
|
74
74
|
# @return [#matches?] A *change by* matcher.
|
75
|
-
def by(
|
76
|
-
By.new(
|
75
|
+
def by(delta)
|
76
|
+
By.new(delta, &@state)
|
77
77
|
end
|
78
78
|
|
79
79
|
# Specifies the original value.
|
@@ -84,11 +84,11 @@ module Matchi
|
|
84
84
|
# change_wrapper = Matchi::Change.new("foo", :to_s)
|
85
85
|
# change_wrapper.from("foo")
|
86
86
|
#
|
87
|
-
# @param
|
87
|
+
# @param old_value [#object_id] The original value.
|
88
88
|
#
|
89
89
|
# @return [#matches?] A *change from* wrapper.
|
90
|
-
def from(
|
91
|
-
From.new(
|
90
|
+
def from(old_value)
|
91
|
+
From.new(old_value, &@state)
|
92
92
|
end
|
93
93
|
|
94
94
|
# Specifies the new value to expect.
|
@@ -99,11 +99,11 @@ module Matchi
|
|
99
99
|
# change_wrapper = Matchi::Change.new("foo", :to_s)
|
100
100
|
# change_wrapper.to("FOO")
|
101
101
|
#
|
102
|
-
# @param
|
102
|
+
# @param new_value [#object_id] The new value to expect.
|
103
103
|
#
|
104
104
|
# @return [#matches?] A *change to* matcher.
|
105
|
-
def to(
|
106
|
-
To.new(
|
105
|
+
def to(new_value)
|
106
|
+
To.new(new_value, &@state)
|
107
107
|
end
|
108
108
|
end
|
109
109
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Matchi
|
4
4
|
# *Expecting errors* matcher.
|
5
5
|
class RaiseException
|
6
|
-
# @return [
|
6
|
+
# @return [String] The expected exception name.
|
7
7
|
attr_reader :expected
|
8
8
|
|
9
9
|
# Initialize the matcher with a descendant of class Exception.
|
@@ -15,7 +15,7 @@ module Matchi
|
|
15
15
|
#
|
16
16
|
# @param expected [Exception, #to_s] The expected exception name.
|
17
17
|
def initialize(expected)
|
18
|
-
@expected = String(expected)
|
18
|
+
@expected = String(expected)
|
19
19
|
end
|
20
20
|
|
21
21
|
# Boolean comparison between the actual value and the expected value.
|
@@ -25,7 +25,7 @@ module Matchi
|
|
25
25
|
#
|
26
26
|
# matcher = Matchi::RaiseException.new(NameError)
|
27
27
|
#
|
28
|
-
# matcher.expected # =>
|
28
|
+
# matcher.expected # => "NameError"
|
29
29
|
# matcher.matches? { Boom } # => true
|
30
30
|
#
|
31
31
|
# @yieldreturn [#object_id] The actual value to compare to the expected
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: matchi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril Kato
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|