matchi-rspec 1.0.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 004ae961c972f24ee6e2f918873b7f79a3c2bf95ec95e8f001f3c3698a8dee21
4
- data.tar.gz: 3eef55e7be6d1eede6508fdb5de8af88bdbd479b670517b8858d217906adaf49
3
+ metadata.gz: 0a658fa412a593b6c1e2dbd68a98c401321b7659f6df879ba1792a461b419a57
4
+ data.tar.gz: d3813724683ee24594a2505807a59a18451ecee68a2d0025e61ed00c6d4fe85f
5
5
  SHA512:
6
- metadata.gz: 4a848e2e1d874a9dfa5727bc7eb56de41892f89482f0e7d245fc93935fc570b3fdbfca5b9a6e7375d9207db240ec656d3fbf710b2a70d158d51b389f8f3f774c
7
- data.tar.gz: 2a17ea2f45ced473830f76d0d87694e89418aec280a69275e6785852ccd79086b7f3d36ca30b390bccd97ebe79e720381ebb92b752af8bb0ca84e5d14e3cdfce
6
+ metadata.gz: beb024ad43b0f2cd8a7ffb82dc80190a7aea4109ee98b68e23ebfb2e15d3003a3a09b4dc7c1b71a02e4aa35eb12a3b973501d8b1d1cefef80346e2a24c2e243b
7
+ data.tar.gz: f0c2d5a6166063e1ccc1485e1cf87dde9b194a537b5ada646036596f3619483e1f734c8b2493895f2e78643d477021cc6c377c2823024a6b39b0c5cabf0e8ecf
data/README.md CHANGED
@@ -1,31 +1,45 @@
1
1
  # Matchi::Rspec
2
2
 
3
- [![RuboCop Status](https://github.com/fixrb/matchi-rspec/workflows/RuboCop/badge.svg)][workflow_rubocop]
4
- [![Build Status](https://api.travis-ci.org/fixrb/matchi-rspec.svg?branch=master)][travis]
5
- [![Gem Version](https://badge.fury.io/rb/matchi-rspec.svg)][gem]
6
- [![Inline docs](https://inch-ci.org/github/fixrb/matchi-rspec.svg?branch=master)][inchpages]
7
- [![Documentation](http://img.shields.io/:yard-docs-38c800.svg)][rubydoc]
3
+ [![Version](https://img.shields.io/github/v/tag/fixrb/matchi-rspec?label=Version&logo=github)](https://github.com/fixrb/matchi-rspec/releases)
4
+ [![Yard documentation](https://img.shields.io/badge/Yard-documentation-blue.svg?logo=github)](https://rubydoc.info/github/fixrb/matchi-rspec/main)
5
+ [![CI](https://github.com/fixrb/matchi-rspec/workflows/CI/badge.svg?branch=main)](https://github.com/fixrb/matchi-rspec/actions?query=workflow%3Aci+branch%3Amain)
6
+ [![RuboCop](https://github.com/fixrb/matchi-rspec/workflows/RuboCop/badge.svg?branch=main)](https://github.com/fixrb/matchi-rspec/actions?query=workflow%3Arubocop+branch%3Amain)
7
+ [![License](https://img.shields.io/github/license/fixrb/matchi-rspec?label=License&logo=github)](https://github.com/fixrb/matchi-rspec/raw/main/LICENSE.md)
8
8
 
9
- > Extend [Matchi](https://github.com/fixrb/matchi) matchers with some [RSpec](https://rspec.info/)'s ones.
9
+ > Extend [Matchi](https://github.com/fixrb/matchi) matchers with some RSpec's ones.
10
10
 
11
11
  ## Installation
12
12
 
13
13
  Add this line to your application's Gemfile:
14
14
 
15
15
  ```ruby
16
- gem 'matchi-rspec'
16
+ gem "matchi-rspec"
17
17
  ```
18
18
 
19
19
  And then execute:
20
20
 
21
- $ bundle
21
+ ```sh
22
+ bundle
23
+ ```
22
24
 
23
25
  Or install it yourself as:
24
26
 
25
- $ gem install matchi-rspec
27
+ ```sh
28
+ gem install matchi-rspec
29
+ ```
26
30
 
27
31
  ## Usage
28
32
 
33
+ To make __Matchi::Rspec__ available:
34
+
35
+ ```ruby
36
+ require "matchi/rspec"
37
+ ```
38
+
39
+ All examples here assume that this has been done.
40
+
41
+ ### Built-in matchers
42
+
29
43
  **Identity** matcher:
30
44
 
31
45
  ```ruby
@@ -37,14 +51,14 @@ be.matches? { 42 } # => true
37
51
 
38
52
  ```ruby
39
53
  be_instance_of = Matchi::Matcher::BeInstanceOf.new(String)
40
- be_instance_of.matches? { 'foo' } # => true
54
+ be_instance_of.matches? { "foo" } # => true
41
55
  ```
42
56
 
43
57
  **Equivalence** matcher:
44
58
 
45
59
  ```ruby
46
- eq = Matchi::Matcher::Eq.new('foo')
47
- eq.matches? { 'foo' } # => true
60
+ eq = Matchi::Matcher::Eq.new("foo")
61
+ eq.matches? { "foo" } # => true
48
62
  ```
49
63
 
50
64
  ## Contact
@@ -64,12 +78,6 @@ The [gem](https://rubygems.org/gems/matchi-rspec) is available as open source un
64
78
  <p>
65
79
  This project is sponsored by:<br />
66
80
  <a href="https://sashite.com/"><img
67
- src="https://github.com/fixrb/matchi-rspec/raw/master/img/sashite.png"
81
+ src="https://github.com/fixrb/matchi-rspec/raw/main/img/sashite.png"
68
82
  alt="Sashite" /></a>
69
83
  </p>
70
-
71
- [workflow_rubocop]: https://github.com/fixrb/matchi-rspec/actions?query=workflow%3ARuboCop
72
- [gem]: https://rubygems.org/gems/matchi-rspec
73
- [travis]: https://travis-ci.org/fixrb/matchi-rspec
74
- [inchpages]: https://inch-ci.org/github/fixrb/matchi-rspec
75
- [rubydoc]: https://rubydoc.info/gems/matchi-rspec/frames
@@ -1,12 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'matchi/matcher/equal'
3
+ require "matchi/matcher/equal"
4
4
 
5
5
  # Namespace for the Matchi library.
6
6
  module Matchi
7
7
  # Collection of matcher classes.
8
8
  module Matcher
9
- # **Identity** matcher.
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,38 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'matchi/matcher/base'
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
- # **Type/class** matcher.
10
- class BeInstanceOf < ::Matchi::Matcher::Base
11
- # Initialize the matcher with an object.
12
- #
13
- # @example A string matcher
14
- # Matchi::Matcher::BeInstanceOf.new(String)
15
- #
16
- # @param expected [#object_id] An expected class.
17
- def initialize(expected)
18
- @expected = expected
19
- end
20
-
21
- # @todo For security reasons, instead of comparing actual with expected,
22
- # we should compare expected with actual. Using something such as:
23
- # `expected.class_of?(actual)`.
24
- #
25
- # @example Is it an instance of string?
26
- # be_instance_of = Matchi::Matcher::BeInstanceOf.new(String)
27
- # be_instance_of.matches? { 'foo' } # => true
28
- #
29
- # @yieldreturn [#instance_of?] the actual value to compare to the
30
- # expected one.
31
- #
32
- # @return [Boolean] Comparison between actual and expected values.
33
- def matches?
34
- yield.instance_of?(expected)
35
- 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
36
15
  end
37
16
  end
38
17
  end
@@ -1,12 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'matchi/matcher/eql'
3
+ require "matchi/matcher/eql"
4
4
 
5
5
  # Namespace for the Matchi library.
6
6
  module Matchi
7
7
  # Collection of matcher classes.
8
8
  module Matcher
9
- # **Equivalence** matcher.
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
data/lib/matchi/rspec.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Dir[File.join File.dirname(__FILE__), 'matcher', '*.rb'].each do |fname|
3
+ Dir[File.join File.dirname(__FILE__), "matcher", "*.rb"].each do |fname|
4
4
  require_relative fname
5
5
  end
6
-
7
- require 'matchi/helper'
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.0.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyril Kato
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-03 00:00:00.000000000 Z
11
+ date: 2021-07-14 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.0
19
+ version: 2.1.1
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.0
26
+ version: 2.1.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop-md
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'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rubocop-performance
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +80,20 @@ dependencies:
66
80
  - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-rake
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: rubocop-thread_safety
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -117,7 +145,6 @@ files:
117
145
  - LICENSE.md
118
146
  - README.md
119
147
  - lib/matchi/matcher/be.rb
120
- - lib/matchi/matcher/be_an_instance_of.rb
121
148
  - lib/matchi/matcher/be_instance_of.rb
122
149
  - lib/matchi/matcher/eq.rb
123
150
  - lib/matchi/rspec.rb
@@ -125,7 +152,7 @@ homepage: https://github.com/fixrb/matchi-rspec
125
152
  licenses:
126
153
  - MIT
127
154
  metadata: {}
128
- post_install_message:
155
+ post_install_message:
129
156
  rdoc_options: []
130
157
  require_paths:
131
158
  - lib
@@ -140,8 +167,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
167
  - !ruby/object:Gem::Version
141
168
  version: '0'
142
169
  requirements: []
143
- rubygems_version: 3.2.3
144
- signing_key:
170
+ rubygems_version: 3.1.4
171
+ signing_key:
145
172
  specification_version: 4
146
173
  summary: Matchi extension gem to provide some RSpec matchers.
147
174
  test_files: []
@@ -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