matchi 3.3.2 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 matches?
36
- expected.call(yield)
37
- end
32
+ def match?
33
+ raise ::ArgumentError, "a block must be provided" unless block_given?
38
34
 
39
- # A string containing a human-readable representation of the matcher.
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
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: matchi
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.2
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: 2024-01-25 00:00:00.000000000 Z
10
+ date: 2024-12-29 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: "Collection of expectation matchers for Rubyists \U0001F939"
14
13
  email: contact@cyril.email
@@ -20,6 +19,7 @@ files:
20
19
  - README.md
21
20
  - lib/matchi.rb
22
21
  - lib/matchi/be.rb
22
+ - lib/matchi/be_a_kind_of.rb
23
23
  - lib/matchi/be_an_instance_of.rb
24
24
  - lib/matchi/be_within.rb
25
25
  - lib/matchi/be_within/of.rb
@@ -40,7 +40,6 @@ licenses:
40
40
  - MIT
41
41
  metadata:
42
42
  rubygems_mfa_required: 'true'
43
- post_install_message:
44
43
  rdoc_options: []
45
44
  require_paths:
46
45
  - lib
@@ -55,8 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
54
  - !ruby/object:Gem::Version
56
55
  version: '0'
57
56
  requirements: []
58
- rubygems_version: 3.4.19
59
- signing_key:
57
+ rubygems_version: 3.6.2
60
58
  specification_version: 4
61
59
  summary: "Collection of expectation matchers for Rubyists \U0001F939"
62
60
  test_files: []