matchi 1.0.5 → 1.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bcf4ea2585e0f28100e46fc43359e72a2144914c34b7054b8eefbbbf50554aeb
4
- data.tar.gz: d4bd35c7e7d76bea0351970a5d298832f78df357b5609cbc14226691858e3933
3
+ metadata.gz: 0cd50716f5824ade60354692ac37487dbd8e27472fb7fde7d4aab4d1ce95b9ca
4
+ data.tar.gz: bd1c131caf2e3812e34e1265a75b5cf2d274168646739b65116b3ba90516ee7a
5
5
  SHA512:
6
- metadata.gz: 98a4faa1e51f9c7e19628251f64eac732b793a0a85a7ee40f46294d92ed80c1b8b0590ad11282698a48a26edd048a53ef31305843bf1caac0921ccb2af47852e
7
- data.tar.gz: 7d0cc22350a289c524c77ee67e972b05872c5d97d0e6e573278e3ba858d5b0583e7916d1a8f2e62e8358f192d8f7f5792846914fc5f3ca9788d8c6686c5ce005
6
+ metadata.gz: ba8f7453990d61caa22ece7510a78a9183d5a92da5fcc7661f6b61f8369c69b3a8cd597ec91bc367159808b6099d6c5644adba4c0ab510b31d213457b308bc60
7
+ data.tar.gz: a0175c66fa876e7819034586a0d9491300733015aeb405587a875f7829407d75d8d6bc0cab1cb00e7f9c1c9a66bc4d818897f75c439d573b5ce0c50fa7ef8076
@@ -1 +1 @@
1
- 1.0.5
1
+ 1.0.6
@@ -0,0 +1 @@
1
+ 9fd2c70563171bd7625207d805f4398035588fc4023f3b06da390c980fd4b7602ba7855760be679e6242338db1b7f7754c20b73c8b3392bb65e969576e4bbef5
@@ -4,4 +4,4 @@
4
4
  module Matchi
5
5
  end
6
6
 
7
- require_relative ::File.join('matchi', 'matchers')
7
+ require_relative File.join('matchi', 'matchers')
@@ -6,6 +6,6 @@ module Matchi
6
6
  end
7
7
  end
8
8
 
9
- ::Dir[::File.join ::File.dirname(__FILE__), 'matchers', '*.rb'].each do |fname|
9
+ Dir[File.join File.dirname(__FILE__), 'matchers', '*.rb'].each do |fname|
10
10
  require_relative fname
11
11
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative ::File.join('..', 'matchers_base') unless
3
+ require_relative File.join('..', 'matchers_base') unless
4
4
  defined?(::Matchi::MatchersBase)
5
5
 
6
6
  module Matchi
@@ -17,11 +17,11 @@ module Matchi
17
17
  # be_false = Matchi::Matchers::BeFalse::Matcher.new
18
18
  # be_false.matches? { false } # => true
19
19
  #
20
- # @yieldreturn [#object_id] the actual value to compare to the expected
20
+ # @yieldreturn [#object_id] The actual value to compare to the expected
21
21
  # one.
22
22
  #
23
23
  # @return [Boolean] Comparison between actual and expected values.
24
- def matches?
24
+ def matches?(**)
25
25
  false.equal?(yield)
26
26
  end
27
27
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative ::File.join('..', 'matchers_base') unless
3
+ require_relative File.join('..', 'matchers_base') unless
4
4
  defined?(::Matchi::MatchersBase)
5
5
 
6
6
  module Matchi
@@ -17,11 +17,11 @@ module Matchi
17
17
  # be_nil = Matchi::Matchers::BeNil::Matcher.new
18
18
  # be_nil.matches? { nil } # => true
19
19
  #
20
- # @yieldreturn [#object_id] the actual value to compare to the expected
20
+ # @yieldreturn [#object_id] The actual value to compare to the expected
21
21
  # one.
22
22
  #
23
23
  # @return [Boolean] Comparison between actual and expected values.
24
- def matches?
24
+ def matches?(**)
25
25
  nil.equal?(yield)
26
26
  end
27
27
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative ::File.join('..', 'matchers_base') unless
3
+ require_relative File.join('..', 'matchers_base') unless
4
4
  defined?(::Matchi::MatchersBase)
5
5
 
6
6
  module Matchi
@@ -17,11 +17,11 @@ module Matchi
17
17
  # be_true = Matchi::Matchers::BeTrue::Matcher.new
18
18
  # be_true.matches? { true } # => true
19
19
  #
20
- # @yieldreturn [#object_id] the actual value to compare to the expected
20
+ # @yieldreturn [#object_id] The actual value to compare to the expected
21
21
  # one.
22
22
  #
23
23
  # @return [Boolean] Comparison between actual and expected values.
24
- def matches?
24
+ def matches?(**)
25
25
  true.equal?(yield)
26
26
  end
27
27
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative ::File.join('..', 'matchers_base') unless
3
+ require_relative File.join('..', 'matchers_base') unless
4
4
  defined?(::Matchi::MatchersBase)
5
5
 
6
6
  module Matchi
@@ -27,11 +27,11 @@ module Matchi
27
27
  # eql = Matchi::Matchers::Eql::Matcher.new('foo')
28
28
  # eql.matches? { 'foo' } # => true
29
29
  #
30
- # @yieldreturn [#object_id] the actual value to compare to the expected
30
+ # @yieldreturn [#object_id] The actual value to compare to the expected
31
31
  # one.
32
32
  #
33
33
  # @return [Boolean] Comparison between actual and expected values.
34
- def matches?
34
+ def matches?(**)
35
35
  @expected.eql?(yield)
36
36
  end
37
37
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative ::File.join('..', 'matchers_base') unless
3
+ require_relative File.join('..', 'matchers_base') unless
4
4
  defined?(::Matchi::MatchersBase)
5
5
 
6
6
  module Matchi
@@ -27,11 +27,11 @@ module Matchi
27
27
  # equal = Matchi::Matchers::Equal::Matcher.new(:foo)
28
28
  # equal.matches? { :foo } # => true
29
29
  #
30
- # @yieldreturn [#object_id] the actual value to compare to the expected
30
+ # @yieldreturn [#object_id] The actual value to compare to the expected
31
31
  # one.
32
32
  #
33
33
  # @return [Boolean] Comparison between actual and expected values.
34
- def matches?
34
+ def matches?(**)
35
35
  @expected.equal?(yield)
36
36
  end
37
37
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative ::File.join('..', 'matchers_base') unless
3
+ require_relative File.join('..', 'matchers_base') unless
4
4
  defined?(::Matchi::MatchersBase)
5
5
 
6
6
  module Matchi
@@ -27,11 +27,11 @@ module Matchi
27
27
  # match = Matchi::Matchers::Match::Matcher.new(/^foo$/)
28
28
  # match.matches? { 'foo' } # => true
29
29
  #
30
- # @yieldreturn [#object_id] the actual value to compare to the expected
30
+ # @yieldreturn [#object_id] The actual value to compare to the expected
31
31
  # one.
32
32
  #
33
33
  # @return [Boolean] Comparison between actual and expected values.
34
- def matches?
34
+ def matches?(**)
35
35
  @expected.match(yield).nil?.equal?(false)
36
36
  end
37
37
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative ::File.join('..', 'matchers_base') unless
3
+ require_relative File.join('..', 'matchers_base') unless
4
4
  defined?(::Matchi::MatchersBase)
5
5
 
6
6
  module Matchi
@@ -27,13 +27,17 @@ module Matchi
27
27
  # matcher = Matchi::Matchers::RaiseException::Matcher.new(NameError)
28
28
  # matcher.matches? { Boom } # => true
29
29
  #
30
- # @yieldreturn [#object_id] the actual value to compare to the expected
30
+ # @param context [#actual] An object responding to #actual method, if
31
+ # order to keep the raised exception.
32
+ #
33
+ # @yieldreturn [#object_id] The actual value to compare to the expected
31
34
  # one.
32
35
  #
33
36
  # @return [Boolean] Comparison between actual and expected values.
34
- def matches?
37
+ def matches?(context: nil)
35
38
  yield
36
- rescue @expected
39
+ rescue @expected => e
40
+ context.actual = e if context.respond_to?(:actual=)
37
41
  true
38
42
  else
39
43
  false
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: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyril Kato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-10 00:00:00.000000000 Z
11
+ date: 2019-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -131,6 +131,7 @@ files:
131
131
  - checksum/matchi-1.0.2.gem.sha512
132
132
  - checksum/matchi-1.0.3.gem.sha512
133
133
  - checksum/matchi-1.0.4.gem.sha512
134
+ - checksum/matchi-1.0.5.gem.sha512
134
135
  - lib/matchi.rb
135
136
  - lib/matchi/matchers.rb
136
137
  - lib/matchi/matchers/be_false.rb