matchi-rspec 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +0 -5
- data/lib/matchi/matcher/be.rb +5 -1
- data/lib/matchi/matcher/be_instance_of.rb +7 -24
- data/lib/matchi/matcher/eq.rb +5 -1
- metadata +4 -5
- data/lib/matchi/matcher/be_an_instance_of.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e974145f7fba29e54f383eb05e84d708db43025722e24e4f9e2ca3dc22df7af
|
4
|
+
data.tar.gz: 69b8be13be8a6478e7b7aff17d924930244692eed7db3ed5ae0481e226e3c61c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e664fcd227173af7c4c56ca87e4d40c7f11a09b8863d250e5aa6fad26ccf9d7216e099af556e3ec0bb91ad28d871b3e0e2c198ad86853fa693e69f270f9a23f9
|
7
|
+
data.tar.gz: 04ff50220cda7316d20586eada3d6f24bc867c12579890f44ec31bb4410bfebeb88a196e0ba1479cc8845d35213a2359ffe59843d8fdabf51bff8981628b0185
|
data/README.md
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
[][workflow_rubocop]
|
4
4
|
[][travis]
|
5
5
|
[][gem]
|
6
|
-
[][inchpages]
|
7
6
|
[][rubydoc]
|
8
7
|
|
9
8
|
> Extend [Matchi](https://github.com/fixrb/matchi) matchers with some RSpec's ones.
|
@@ -38,9 +37,6 @@ be.matches? { 42 } # => true
|
|
38
37
|
```ruby
|
39
38
|
be_instance_of = Matchi::Matcher::BeInstanceOf.new(String)
|
40
39
|
be_instance_of.matches? { "foo" } # => true
|
41
|
-
|
42
|
-
be_an_instance_of = Matchi::Matcher::BeAnInstanceOf.new(String)
|
43
|
-
be_an_instance_of.matches? { "foo" } # => true
|
44
40
|
```
|
45
41
|
|
46
42
|
**Equivalence** matcher:
|
@@ -74,5 +70,4 @@ The [gem](https://rubygems.org/gems/matchi-rspec) is available as open source un
|
|
74
70
|
[workflow_rubocop]: https://github.com/fixrb/matchi-rspec/actions?query=workflow%3ARuboCop
|
75
71
|
[gem]: https://rubygems.org/gems/matchi-rspec
|
76
72
|
[travis]: https://travis-ci.org/fixrb/matchi-rspec
|
77
|
-
[inchpages]: https://inch-ci.org/github/fixrb/matchi-rspec
|
78
73
|
[rubydoc]: https://rubydoc.info/gems/matchi-rspec/frames
|
data/lib/matchi/matcher/be.rb
CHANGED
@@ -6,7 +6,11 @@ require "matchi/matcher/equal"
|
|
6
6
|
module Matchi
|
7
7
|
# Collection of matcher classes.
|
8
8
|
module Matcher
|
9
|
-
#
|
9
|
+
# *Identity* matcher.
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# equal = Matchi::Matcher::Equal.new(:foo)
|
13
|
+
# equal.matches? { :foo } # => true
|
10
14
|
class Be < ::Matchi::Matcher::Equal
|
11
15
|
end
|
12
16
|
end
|
@@ -1,34 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "matchi/matcher/
|
3
|
+
require "matchi/matcher/be_an_instance_of"
|
4
4
|
|
5
5
|
# Namespace for the Matchi library.
|
6
6
|
module Matchi
|
7
7
|
# Collection of matcher classes.
|
8
8
|
module Matcher
|
9
|
-
#
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
#
|
16
|
-
# @param expected [#object_id] An expected class.
|
17
|
-
def initialize(expected)
|
18
|
-
super()
|
19
|
-
@expected = expected
|
20
|
-
end
|
21
|
-
|
22
|
-
# @example Is it an instance of string?
|
23
|
-
# be_instance_of = Matchi::Matcher::BeInstanceOf.new(String)
|
24
|
-
# be_instance_of.matches? { 'foo' } # => true
|
25
|
-
#
|
26
|
-
# @yieldreturn [#class] the actual value to compare to the expected one.
|
27
|
-
#
|
28
|
-
# @return [Boolean] Comparison between actual and expected values.
|
29
|
-
def matches?
|
30
|
-
expected.equal?(yield.class)
|
31
|
-
end
|
9
|
+
# *Type/class* matcher.
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# be_instance_of = Matchi::Matcher::BeInstanceOf.new(String)
|
13
|
+
# be_instance_of.matches? { "foo" } # => true
|
14
|
+
class BeInstanceOf < ::Matchi::Matcher::BeAnInstanceOf
|
32
15
|
end
|
33
16
|
end
|
34
17
|
end
|
data/lib/matchi/matcher/eq.rb
CHANGED
@@ -6,7 +6,11 @@ require "matchi/matcher/eql"
|
|
6
6
|
module Matchi
|
7
7
|
# Collection of matcher classes.
|
8
8
|
module Matcher
|
9
|
-
#
|
9
|
+
# *Equivalence* matcher.
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# eql = Matchi::Matcher::Eql.new("foo")
|
13
|
+
# eql.matches? { "foo" } # => true
|
10
14
|
class Eq < ::Matchi::Matcher::Eql
|
11
15
|
end
|
12
16
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: matchi-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
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-06-
|
11
|
+
date: 2021-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: matchi
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.0
|
19
|
+
version: 2.1.0
|
20
20
|
type: :runtime
|
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: 2.0
|
26
|
+
version: 2.1.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -145,7 +145,6 @@ files:
|
|
145
145
|
- LICENSE.md
|
146
146
|
- README.md
|
147
147
|
- lib/matchi/matcher/be.rb
|
148
|
-
- lib/matchi/matcher/be_an_instance_of.rb
|
149
148
|
- lib/matchi/matcher/be_instance_of.rb
|
150
149
|
- lib/matchi/matcher/eq.rb
|
151
150
|
- lib/matchi/rspec.rb
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "be_instance_of"
|
4
|
-
|
5
|
-
# Namespace for the Matchi library.
|
6
|
-
module Matchi
|
7
|
-
# Collection of matcher classes.
|
8
|
-
module Matcher
|
9
|
-
# **Type/class** matcher.
|
10
|
-
class BeAnInstanceOf < BeInstanceOf
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|