matchi 2.0.0 → 2.1.1
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 +69 -54
- data/lib/matchi.rb +1 -1
- data/lib/matchi/helper.rb +24 -12
- data/lib/matchi/matcher.rb +1 -1
- data/lib/matchi/matcher/base.rb +25 -14
- data/lib/matchi/matcher/be_an_instance_of.rb +35 -0
- data/lib/matchi/matcher/be_false.rb +2 -2
- data/lib/matchi/matcher/be_nil.rb +2 -2
- data/lib/matchi/matcher/be_true.rb +2 -2
- data/lib/matchi/matcher/eql.rb +8 -7
- data/lib/matchi/matcher/equal.rb +3 -2
- data/lib/matchi/matcher/match.rb +5 -4
- data/lib/matchi/matcher/raise_exception.rb +3 -2
- metadata +52 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 168258c942f6e9390a6bc6ad65112de3acbcd835438a750dd1dc4692e256db6d
|
4
|
+
data.tar.gz: 8b64c5cbdf54f665f1982cb9e8d44a16685904b626680e22cab80969304108be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40d8993bb7bae28eff3ef0d86d4d8e9dc51f36195466fa3f3016c4f1c52dfccac27e0eb02c18c1f34a4c4f2df16a8ba566c89633e2da7d595ad433ac4e03563f
|
7
|
+
data.tar.gz: d2e8b2cbb554f76cf9a0e25dbbf41e591d962ed3e1af7c64d5de84d823e86fc317e3d76e174d4f559f526022aa6afcf1e1411200b4789821d7ffc8917b7e4e3d
|
data/LICENSE.md
CHANGED
data/README.md
CHANGED
@@ -1,49 +1,56 @@
|
|
1
1
|
# Matchi
|
2
2
|
|
3
|
-
[![
|
4
|
-
[![
|
5
|
-
[![
|
6
|
-
[![
|
7
|
-
[![
|
3
|
+
[![Version](https://img.shields.io/github/v/tag/fixrb/matchi?label=Version&logo=github)](https://github.com/fixrb/matchi/releases)
|
4
|
+
[![Yard documentation](https://img.shields.io/badge/Yard-documentation-blue.svg?logo=github)](https://rubydoc.info/github/fixrb/matchi/main)
|
5
|
+
[![CI](https://github.com/fixrb/matchi/workflows/CI/badge.svg?branch=main)](https://github.com/fixrb/matchi/actions?query=workflow%3Aci+branch%3Amain)
|
6
|
+
[![RuboCop](https://github.com/fixrb/matchi/workflows/RuboCop/badge.svg?branch=main)](https://github.com/fixrb/matchi/actions?query=workflow%3Arubocop+branch%3Amain)
|
7
|
+
[![License](https://img.shields.io/github/license/fixrb/matchi?label=License&logo=github)](https://github.com/fixrb/matchi/raw/main/LICENSE.md)
|
8
8
|
|
9
|
-
> Collection of expectation matchers for Ruby
|
9
|
+
> Collection of expectation matchers for Ruby 🤹
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
* Home page: https://github.com/fixrb/matchi
|
14
|
-
* Bugs/issues: https://github.com/fixrb/matchi/issues
|
15
|
-
|
16
|
-
## Rubies
|
17
|
-
|
18
|
-
* [MRI](https://www.ruby-lang.org/)
|
19
|
-
* [Rubinius](https://rubinius.com/)
|
20
|
-
* [JRuby](https://www.jruby.org/)
|
11
|
+
![A rubyist juggling between colored balls representing expectation matchers](https://github.com/fixrb/matchi/raw/main/img/matchi.jpg)
|
21
12
|
|
22
13
|
## Installation
|
23
14
|
|
24
15
|
Add this line to your application's Gemfile:
|
25
16
|
|
26
17
|
```ruby
|
27
|
-
gem
|
18
|
+
gem "matchi"
|
28
19
|
```
|
29
20
|
|
30
21
|
And then execute:
|
31
22
|
|
32
|
-
|
23
|
+
```sh
|
24
|
+
bundle
|
25
|
+
```
|
33
26
|
|
34
27
|
Or install it yourself as:
|
35
28
|
|
36
|
-
|
29
|
+
```sh
|
30
|
+
gem install matchi
|
31
|
+
```
|
32
|
+
|
33
|
+
## Overview
|
34
|
+
|
35
|
+
__Matchi__ provides a collection of damn simple expectation matchers.
|
37
36
|
|
38
37
|
## Usage
|
39
38
|
|
39
|
+
To make __Matchi__ available:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
require "matchi"
|
43
|
+
```
|
44
|
+
|
45
|
+
All examples here assume that this has been done.
|
46
|
+
|
40
47
|
### Built-in matchers
|
41
48
|
|
42
49
|
**Equivalence** matcher:
|
43
50
|
|
44
51
|
```ruby
|
45
|
-
eql = Matchi::Matcher::Eql.new(
|
46
|
-
eql.matches? {
|
52
|
+
eql = Matchi::Matcher::Eql.new("foo")
|
53
|
+
eql.matches? { "foo" } # => true
|
47
54
|
```
|
48
55
|
|
49
56
|
**Identity** matcher:
|
@@ -57,7 +64,7 @@ equal.matches? { :foo } # => true
|
|
57
64
|
|
58
65
|
```ruby
|
59
66
|
match = Matchi::Matcher::Match.new(/^foo$/)
|
60
|
-
match.matches? {
|
67
|
+
match.matches? { "foo" } # => true
|
61
68
|
```
|
62
69
|
|
63
70
|
**Expecting errors** matcher:
|
@@ -88,9 +95,17 @@ be_nil = Matchi::Matcher::BeNil.new
|
|
88
95
|
be_nil.matches? { nil } # => true
|
89
96
|
```
|
90
97
|
|
98
|
+
**Type/class** matcher:
|
99
|
+
|
100
|
+
```ruby
|
101
|
+
be_an_instance_of = Matchi::Matcher::BeAnInstanceOf.new(String)
|
102
|
+
be_an_instance_of.matches? { "foo" } # => true
|
103
|
+
```
|
104
|
+
|
91
105
|
### Custom matchers
|
92
106
|
|
93
|
-
Custom matchers can easily be defined for expressing expectations.
|
107
|
+
Custom matchers can easily be defined for expressing expectations.
|
108
|
+
They can be any Ruby class that responds to `matches?` instance method with a block.
|
94
109
|
|
95
110
|
A **Be the answer** matcher:
|
96
111
|
|
@@ -99,7 +114,7 @@ module Matchi
|
|
99
114
|
module Matcher
|
100
115
|
class BeTheAnswer < ::Matchi::Matcher::Base
|
101
116
|
def matches?
|
102
|
-
42.equal?
|
117
|
+
42.equal?(yield)
|
103
118
|
end
|
104
119
|
end
|
105
120
|
end
|
@@ -112,13 +127,13 @@ be_the_answer.matches? { 42 } # => true
|
|
112
127
|
A **Be prime** matcher:
|
113
128
|
|
114
129
|
```ruby
|
115
|
-
require
|
130
|
+
require "prime"
|
116
131
|
|
117
132
|
module Matchi
|
118
133
|
module Matcher
|
119
134
|
class BePrime < ::Matchi::Matcher::Base
|
120
135
|
def matches?
|
121
|
-
Prime.prime?
|
136
|
+
Prime.prime?(yield)
|
122
137
|
end
|
123
138
|
end
|
124
139
|
end
|
@@ -135,60 +150,60 @@ module Matchi
|
|
135
150
|
module Matcher
|
136
151
|
class StartWith < ::Matchi::Matcher::Base
|
137
152
|
def initialize(expected)
|
153
|
+
super()
|
138
154
|
@expected = expected
|
139
155
|
end
|
140
156
|
|
141
157
|
def matches?
|
142
|
-
|
158
|
+
Regexp.new(/\A#{expected}/).match?(yield)
|
143
159
|
end
|
144
160
|
end
|
145
161
|
end
|
146
162
|
end
|
147
163
|
|
148
|
-
start_with = Matchi::Matcher::StartWith.new(
|
149
|
-
start_with.matches? {
|
164
|
+
start_with = Matchi::Matcher::StartWith.new("foo")
|
165
|
+
start_with.matches? { "foobar" } # => true
|
150
166
|
```
|
151
167
|
|
152
|
-
|
168
|
+
### Helper methods
|
153
169
|
|
154
|
-
|
155
|
-
|
156
|
-
Although these checksums do not prevent malicious users from tampering with a
|
157
|
-
built Gem they can be used for basic integrity verification purposes.
|
170
|
+
For convenience, it is possible to instantiate a matcher with a method rather than with its class.
|
171
|
+
To do so, the `Helper` module can be included like this:
|
158
172
|
|
159
|
-
|
160
|
-
|
173
|
+
```ruby
|
174
|
+
require "matchi/helper"
|
161
175
|
|
162
|
-
|
163
|
-
|
176
|
+
class MatcherCollection
|
177
|
+
include ::Matchi::Helper
|
178
|
+
end
|
179
|
+
```
|
164
180
|
|
165
|
-
|
181
|
+
The set of loaded matcher then becomes accessible via a dynamically generated instance method, like these:
|
166
182
|
|
167
|
-
|
183
|
+
```ruby
|
184
|
+
matcher = MatcherCollection.new
|
185
|
+
matcher.equal(42).matches? { 44 } # => false
|
186
|
+
matcher.be_an_instance_of(String).matches? { "안녕하세요" } # => true
|
187
|
+
```
|
168
188
|
|
169
|
-
##
|
189
|
+
## Contact
|
170
190
|
|
171
|
-
|
172
|
-
|
173
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
174
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
175
|
-
5. Create a new Pull Request
|
191
|
+
* Home page: https://github.com/fixrb/matchi
|
192
|
+
* Bugs/issues: https://github.com/fixrb/matchi/issues
|
176
193
|
|
177
|
-
##
|
194
|
+
## Versioning
|
195
|
+
|
196
|
+
__Matchi__ follows [Semantic Versioning 2.0](https://semver.org/).
|
178
197
|
|
179
|
-
|
198
|
+
## License
|
180
199
|
|
181
|
-
[gem]
|
182
|
-
[travis]: https://travis-ci.org/fixrb/matchi
|
183
|
-
[codeclimate]: https://codeclimate.com/github/fixrb/matchi
|
184
|
-
[inchpages]: https://inch-ci.org/github/fixrb/matchi
|
185
|
-
[rubydoc]: https://rubydoc.info/gems/matchi/frames
|
200
|
+
The [gem](https://rubygems.org/gems/matchi) is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
186
201
|
|
187
202
|
***
|
188
203
|
|
189
204
|
<p>
|
190
205
|
This project is sponsored by:<br />
|
191
206
|
<a href="https://sashite.com/"><img
|
192
|
-
src="https://github.com/fixrb/matchi/raw/
|
207
|
+
src="https://github.com/fixrb/matchi/raw/main/img/sashite.png"
|
193
208
|
alt="Sashite" /></a>
|
194
209
|
</p>
|
data/lib/matchi.rb
CHANGED
data/lib/matchi/helper.rb
CHANGED
@@ -1,25 +1,37 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative "matcher"
|
4
4
|
|
5
5
|
module Matchi
|
6
|
-
#
|
6
|
+
# When included, this module defines a helper instance method per matcher.
|
7
|
+
#
|
8
|
+
# @example Define and use the dynamic helper instance method of a custom matcher
|
9
|
+
# require "matchi/matcher/base"
|
10
|
+
#
|
11
|
+
# module Matchi
|
12
|
+
# module Matcher
|
13
|
+
# class BeTheAnswer < ::Matchi::Matcher::Base
|
14
|
+
# def matches?
|
15
|
+
# 42.equal?(yield)
|
16
|
+
# end
|
17
|
+
# end
|
18
|
+
# end
|
19
|
+
# end
|
20
|
+
#
|
21
|
+
# require "matchi/helper"
|
22
|
+
#
|
23
|
+
# class MatcherBase
|
24
|
+
# include ::Matchi::Helper
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# matcher_base = MatcherBase.new
|
28
|
+
# matcher_base.be_the_answer.matches? { 42 } # => true
|
7
29
|
module Helper
|
8
30
|
::Matchi::Matcher.constants.each do |matcher_const|
|
9
31
|
next if matcher_const.equal?(:Base)
|
10
32
|
|
11
33
|
matcher_klass = ::Matchi::Matcher.const_get(matcher_const)
|
12
34
|
|
13
|
-
# Define a method for the given matcher.
|
14
|
-
#
|
15
|
-
# @example Given the `Matchi::Matchers::Equal::Matcher` matcher, its
|
16
|
-
# method would be:
|
17
|
-
#
|
18
|
-
# def equal(expected)
|
19
|
-
# Matchi::Matchers::Equal::Matcher.new(expected)
|
20
|
-
# end
|
21
|
-
#
|
22
|
-
# @return [#matches?] The matcher.
|
23
35
|
define_method(matcher_klass.to_sym) do |*args|
|
24
36
|
matcher_klass.new(*args)
|
25
37
|
end
|
data/lib/matchi/matcher.rb
CHANGED
data/lib/matchi/matcher/base.rb
CHANGED
@@ -4,9 +4,16 @@ module Matchi
|
|
4
4
|
module Matcher
|
5
5
|
# Abstract matcher class.
|
6
6
|
class Base
|
7
|
+
# Returns a symbol identifying the matcher.
|
8
|
+
#
|
9
|
+
# @example The readable definition of a FooBar matcher class.
|
10
|
+
# matcher_class = Matchi::Matcher::FooBar
|
11
|
+
# matcher_class.to_sym # => "foo_bar"
|
12
|
+
#
|
7
13
|
# @return [Symbol] A symbol identifying the matcher.
|
8
14
|
def self.to_sym
|
9
|
-
name.
|
15
|
+
name.split("::")
|
16
|
+
.fetch(-1)
|
10
17
|
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
11
18
|
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
12
19
|
.downcase
|
@@ -16,15 +23,12 @@ module Matchi
|
|
16
23
|
# @return [#object_id] Any value to give to the matcher.
|
17
24
|
attr_reader :expected
|
18
25
|
|
19
|
-
# Initialize the matcher with the nil expected value by default.
|
20
|
-
#
|
21
|
-
# @param expected [#object_id] Any object. It is `nil` unless present.
|
22
|
-
def initialize(expected = nil)
|
23
|
-
@expected = expected
|
24
|
-
end
|
25
|
-
|
26
26
|
# A string containing a human-readable representation of the matcher.
|
27
27
|
#
|
28
|
+
# @example The human-readable representation of a FooBar matcher instance.
|
29
|
+
# matcher = Matchi::Matcher::FooBar.new(42)
|
30
|
+
# matcher.inspect # => "Matchi::Matcher::FooBar(42)"
|
31
|
+
#
|
28
32
|
# @return [String] The human-readable representation of the matcher.
|
29
33
|
def inspect
|
30
34
|
"#{self.class}(#{expected&.inspect})"
|
@@ -32,20 +36,27 @@ module Matchi
|
|
32
36
|
|
33
37
|
# Abstract matcher class.
|
34
38
|
#
|
35
|
-
# @
|
39
|
+
# @example Test the equivalence between two "foo" strings.
|
40
|
+
# eql = Matchi::Matcher::Eql.new("foo")
|
41
|
+
# eql.matches? { "foo" } # => true
|
42
|
+
#
|
43
|
+
# @yieldreturn [#object_id] The actual value to compare to the expected
|
44
|
+
# one.
|
45
|
+
#
|
46
|
+
# @raise [NotImplementedError] Override this method inside a matcher.
|
36
47
|
def matches?
|
37
|
-
raise ::NotImplementedError,
|
48
|
+
raise ::NotImplementedError, "matcher MUST respond to this method."
|
38
49
|
end
|
39
50
|
|
40
|
-
# Returns a string representing the matcher.
|
51
|
+
# Returns a string representing the matcher instance.
|
41
52
|
#
|
42
|
-
# @example The readable definition of a FooBar matcher.
|
53
|
+
# @example The readable definition of a FooBar matcher instance.
|
43
54
|
# matcher = Matchi::Matcher::FooBar.new(42)
|
44
55
|
# matcher.to_s # => "foo_bar 42"
|
45
56
|
#
|
46
|
-
# @return [String] A string representing the matcher.
|
57
|
+
# @return [String] A string representing the matcher instance.
|
47
58
|
def to_s
|
48
|
-
[self.class.to_sym, expected&.inspect].compact.join(
|
59
|
+
[self.class.to_sym, expected&.inspect].compact.join(" ")
|
49
60
|
end
|
50
61
|
end
|
51
62
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "base"
|
4
|
+
|
5
|
+
module Matchi
|
6
|
+
module Matcher
|
7
|
+
# *Type/class* matcher.
|
8
|
+
class BeAnInstanceOf < ::Matchi::Matcher::Base
|
9
|
+
# Initialize the matcher with an object.
|
10
|
+
#
|
11
|
+
# @example A string matcher
|
12
|
+
# Matchi::Matcher::BeAnInstanceOf.new(String)
|
13
|
+
#
|
14
|
+
# @param expected [Class] An expected class.
|
15
|
+
def initialize(expected)
|
16
|
+
super()
|
17
|
+
@expected = expected
|
18
|
+
end
|
19
|
+
|
20
|
+
# Boolean comparison between the class of the actual value and the
|
21
|
+
# expected class.
|
22
|
+
#
|
23
|
+
# @example Is it an instance of string?
|
24
|
+
# be_an_instance_of = Matchi::Matcher::BeInstanceOf.new(String)
|
25
|
+
# be_an_instance_of.matches? { "foo" } # => true
|
26
|
+
#
|
27
|
+
# @yieldreturn [#class] the actual value to compare to the expected one.
|
28
|
+
#
|
29
|
+
# @return [Boolean] Comparison between actual and expected values.
|
30
|
+
def matches?(*, **)
|
31
|
+
expected.equal?(yield.class)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative "base"
|
4
4
|
|
5
5
|
module Matchi
|
6
6
|
module Matcher
|
7
|
-
#
|
7
|
+
# *Untruth* matcher.
|
8
8
|
class BeFalse < ::Matchi::Matcher::Base
|
9
9
|
# Boolean comparison between the actual value and the expected value.
|
10
10
|
#
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative "base"
|
4
4
|
|
5
5
|
module Matchi
|
6
6
|
module Matcher
|
7
|
-
#
|
7
|
+
# *Nil* matcher.
|
8
8
|
class BeNil < ::Matchi::Matcher::Base
|
9
9
|
# Boolean comparison between the actual value and the expected value.
|
10
10
|
#
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative "base"
|
4
4
|
|
5
5
|
module Matchi
|
6
6
|
module Matcher
|
7
|
-
#
|
7
|
+
# *Truth* matcher.
|
8
8
|
class BeTrue < ::Matchi::Matcher::Base
|
9
9
|
# Boolean comparison between the actual value and the expected value.
|
10
10
|
#
|
data/lib/matchi/matcher/eql.rb
CHANGED
@@ -1,26 +1,27 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative "base"
|
4
4
|
|
5
5
|
module Matchi
|
6
6
|
module Matcher
|
7
|
-
#
|
7
|
+
# *Equivalence* matcher.
|
8
8
|
class Eql < ::Matchi::Matcher::Base
|
9
9
|
# Initialize the matcher with an object.
|
10
10
|
#
|
11
|
-
# @example The string
|
12
|
-
# Matchi::Matcher::Eql.new(
|
11
|
+
# @example The string "foo" matcher.
|
12
|
+
# Matchi::Matcher::Eql.new("foo")
|
13
13
|
#
|
14
14
|
# @param expected [#eql?] An expected equivalent object.
|
15
15
|
def initialize(expected)
|
16
|
+
super()
|
16
17
|
@expected = expected
|
17
18
|
end
|
18
19
|
|
19
20
|
# Boolean comparison between the actual value and the expected value.
|
20
21
|
#
|
21
|
-
# @example Is it equivalent to
|
22
|
-
# eql = Matchi::Matcher::Eql.new(
|
23
|
-
# eql.matches? {
|
22
|
+
# @example Is it equivalent to "foo"?
|
23
|
+
# eql = Matchi::Matcher::Eql.new("foo")
|
24
|
+
# eql.matches? { "foo" } # => true
|
24
25
|
#
|
25
26
|
# @yieldreturn [#object_id] The actual value to compare to the expected
|
26
27
|
# one.
|
data/lib/matchi/matcher/equal.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative "base"
|
4
4
|
|
5
5
|
module Matchi
|
6
6
|
module Matcher
|
7
|
-
#
|
7
|
+
# *Identity* matcher.
|
8
8
|
class Equal < ::Matchi::Matcher::Base
|
9
9
|
# Initialize the matcher with an object.
|
10
10
|
#
|
@@ -13,6 +13,7 @@ module Matchi
|
|
13
13
|
#
|
14
14
|
# @param expected [#equal?] An expected object.
|
15
15
|
def initialize(expected)
|
16
|
+
super()
|
16
17
|
@expected = expected
|
17
18
|
end
|
18
19
|
|
data/lib/matchi/matcher/match.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative "base"
|
4
4
|
|
5
5
|
module Matchi
|
6
6
|
module Matcher
|
7
|
-
#
|
7
|
+
# *Regular expressions* matcher.
|
8
8
|
class Match < ::Matchi::Matcher::Base
|
9
9
|
# Initialize the matcher with an instance of Regexp.
|
10
10
|
#
|
@@ -13,6 +13,7 @@ module Matchi
|
|
13
13
|
#
|
14
14
|
# @param expected [#match] A regular expression.
|
15
15
|
def initialize(expected)
|
16
|
+
super()
|
16
17
|
@expected = expected
|
17
18
|
end
|
18
19
|
|
@@ -20,14 +21,14 @@ module Matchi
|
|
20
21
|
#
|
21
22
|
# @example Is it matching /^foo$/ regex?
|
22
23
|
# match = Matchi::Matcher::Match.new(/^foo$/)
|
23
|
-
# match.matches? {
|
24
|
+
# match.matches? { "foo" } # => true
|
24
25
|
#
|
25
26
|
# @yieldreturn [#object_id] The actual value to compare to the expected
|
26
27
|
# one.
|
27
28
|
#
|
28
29
|
# @return [Boolean] Comparison between actual and expected values.
|
29
30
|
def matches?(*, **)
|
30
|
-
expected.match(yield)
|
31
|
+
expected.match?(yield)
|
31
32
|
end
|
32
33
|
end
|
33
34
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative "base"
|
4
4
|
|
5
5
|
module Matchi
|
6
6
|
module Matcher
|
7
|
-
#
|
7
|
+
# *Expecting errors* matcher.
|
8
8
|
class RaiseException < ::Matchi::Matcher::Base
|
9
9
|
# Initialize the matcher with a descendant of class Exception.
|
10
10
|
#
|
@@ -13,6 +13,7 @@ module Matchi
|
|
13
13
|
#
|
14
14
|
# @param expected [Exception] The class of the expected exception.
|
15
15
|
def initialize(expected)
|
16
|
+
super()
|
16
17
|
@expected = expected
|
17
18
|
end
|
18
19
|
|
metadata
CHANGED
@@ -1,45 +1,45 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: matchi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.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:
|
11
|
+
date: 2021-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: rubocop
|
42
|
+
name: rubocop-md
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -66,35 +66,63 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
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'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: simplecov
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
72
100
|
requirements:
|
73
|
-
- - "
|
101
|
+
- - ">="
|
74
102
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0
|
103
|
+
version: '0'
|
76
104
|
type: :development
|
77
105
|
prerelease: false
|
78
106
|
version_requirements: !ruby/object:Gem::Requirement
|
79
107
|
requirements:
|
80
|
-
- - "
|
108
|
+
- - ">="
|
81
109
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0
|
110
|
+
version: '0'
|
83
111
|
- !ruby/object:Gem::Dependency
|
84
112
|
name: yard
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
86
114
|
requirements:
|
87
|
-
- - "
|
115
|
+
- - ">="
|
88
116
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0
|
117
|
+
version: '0'
|
90
118
|
type: :development
|
91
119
|
prerelease: false
|
92
120
|
version_requirements: !ruby/object:Gem::Requirement
|
93
121
|
requirements:
|
94
|
-
- - "
|
122
|
+
- - ">="
|
95
123
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0
|
97
|
-
description: Collection of expectation matchers for Ruby
|
124
|
+
version: '0'
|
125
|
+
description: "Collection of expectation matchers for Ruby \U0001F939"
|
98
126
|
email: contact@cyril.email
|
99
127
|
executables: []
|
100
128
|
extensions: []
|
@@ -106,6 +134,7 @@ files:
|
|
106
134
|
- lib/matchi/helper.rb
|
107
135
|
- lib/matchi/matcher.rb
|
108
136
|
- lib/matchi/matcher/base.rb
|
137
|
+
- lib/matchi/matcher/be_an_instance_of.rb
|
109
138
|
- lib/matchi/matcher/be_false.rb
|
110
139
|
- lib/matchi/matcher/be_nil.rb
|
111
140
|
- lib/matchi/matcher/be_true.rb
|
@@ -125,15 +154,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
154
|
requirements:
|
126
155
|
- - ">="
|
127
156
|
- !ruby/object:Gem::Version
|
128
|
-
version:
|
157
|
+
version: 2.7.0
|
129
158
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
159
|
requirements:
|
131
160
|
- - ">="
|
132
161
|
- !ruby/object:Gem::Version
|
133
162
|
version: '0'
|
134
163
|
requirements: []
|
135
|
-
rubygems_version: 3.1.
|
164
|
+
rubygems_version: 3.1.6
|
136
165
|
signing_key:
|
137
166
|
specification_version: 4
|
138
|
-
summary: Collection of matchers
|
167
|
+
summary: "Collection of expectation matchers for Ruby \U0001F939"
|
139
168
|
test_files: []
|