matchi 3.3.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.md +1 -1
- data/README.md +151 -101
- data/lib/matchi/be.rb +7 -13
- data/lib/matchi/be_a_kind_of.rb +81 -0
- data/lib/matchi/be_an_instance_of.rb +91 -21
- data/lib/matchi/be_within/of.rb +11 -13
- data/lib/matchi/be_within.rb +4 -1
- data/lib/matchi/change/by.rb +11 -14
- data/lib/matchi/change/by_at_least.rb +12 -14
- data/lib/matchi/change/by_at_most.rb +12 -14
- data/lib/matchi/change/from/to.rb +10 -14
- data/lib/matchi/change/from.rb +3 -1
- data/lib/matchi/change/to.rb +10 -14
- data/lib/matchi/change.rb +10 -9
- data/lib/matchi/eq.rb +7 -13
- data/lib/matchi/match.rb +9 -13
- data/lib/matchi/predicate.rb +8 -19
- data/lib/matchi/raise_exception.rb +30 -17
- data/lib/matchi/satisfy.rb +8 -12
- data/lib/matchi.rb +1 -1
- metadata +6 -120
data/lib/matchi/satisfy.rb
CHANGED
@@ -3,9 +3,6 @@
|
|
3
3
|
module Matchi
|
4
4
|
# *Satisfy* matcher.
|
5
5
|
class Satisfy
|
6
|
-
# @return [Proc] A block of code.
|
7
|
-
attr_reader :expected
|
8
|
-
|
9
6
|
# Initialize the matcher with a block.
|
10
7
|
#
|
11
8
|
# @example
|
@@ -15,6 +12,8 @@ module Matchi
|
|
15
12
|
#
|
16
13
|
# @param block [Proc] A block of code.
|
17
14
|
def initialize(&block)
|
15
|
+
raise ::ArgumentError, "a block must be provided" unless block_given?
|
16
|
+
|
18
17
|
@expected = block
|
19
18
|
end
|
20
19
|
|
@@ -24,24 +23,21 @@ module Matchi
|
|
24
23
|
# require "matchi/satisfy"
|
25
24
|
#
|
26
25
|
# matcher = Matchi::Satisfy.new { |value| value == 42 }
|
27
|
-
#
|
28
|
-
# matcher.expected # => #<Proc:0x00007fbaafc65540>
|
29
|
-
# matcher.matches? { 42 } # => true
|
26
|
+
# matcher.match? { 42 } # => true
|
30
27
|
#
|
31
28
|
# @yieldreturn [#object_id] The actual value to compare to the expected
|
32
29
|
# one.
|
33
30
|
#
|
34
31
|
# @return [Boolean] Comparison between actual and expected values.
|
35
|
-
def
|
36
|
-
|
37
|
-
end
|
32
|
+
def match?
|
33
|
+
raise ::ArgumentError, "a block must be provided" unless block_given?
|
38
34
|
|
39
|
-
|
40
|
-
def inspect
|
41
|
-
"#{self.class}(&block)"
|
35
|
+
@expected.call(yield)
|
42
36
|
end
|
43
37
|
|
44
38
|
# Returns a string representing the matcher.
|
39
|
+
#
|
40
|
+
# @return [String] a human-readable description of the matcher
|
45
41
|
def to_s
|
46
42
|
"satisfy &block"
|
47
43
|
end
|
data/lib/matchi.rb
CHANGED
metadata
CHANGED
@@ -1,127 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: matchi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril Kato
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rubocop-md
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rubocop-performance
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rubocop-rake
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rubocop-thread_safety
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: simplecov
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: yard
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
10
|
+
date: 2024-12-29 00:00:00.000000000 Z
|
11
|
+
dependencies: []
|
125
12
|
description: "Collection of expectation matchers for Rubyists \U0001F939"
|
126
13
|
email: contact@cyril.email
|
127
14
|
executables: []
|
@@ -132,6 +19,7 @@ files:
|
|
132
19
|
- README.md
|
133
20
|
- lib/matchi.rb
|
134
21
|
- lib/matchi/be.rb
|
22
|
+
- lib/matchi/be_a_kind_of.rb
|
135
23
|
- lib/matchi/be_an_instance_of.rb
|
136
24
|
- lib/matchi/be_within.rb
|
137
25
|
- lib/matchi/be_within/of.rb
|
@@ -152,7 +40,6 @@ licenses:
|
|
152
40
|
- MIT
|
153
41
|
metadata:
|
154
42
|
rubygems_mfa_required: 'true'
|
155
|
-
post_install_message:
|
156
43
|
rdoc_options: []
|
157
44
|
require_paths:
|
158
45
|
- lib
|
@@ -160,15 +47,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
160
47
|
requirements:
|
161
48
|
- - ">="
|
162
49
|
- !ruby/object:Gem::Version
|
163
|
-
version: 2.
|
50
|
+
version: 3.2.0
|
164
51
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
52
|
requirements:
|
166
53
|
- - ">="
|
167
54
|
- !ruby/object:Gem::Version
|
168
55
|
version: '0'
|
169
56
|
requirements: []
|
170
|
-
rubygems_version: 3.
|
171
|
-
signing_key:
|
57
|
+
rubygems_version: 3.6.2
|
172
58
|
specification_version: 4
|
173
59
|
summary: "Collection of expectation matchers for Rubyists \U0001F939"
|
174
60
|
test_files: []
|