matchi 3.1.0 → 3.1.1

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: 8da45849405d96c572ada45280a0acb673276092d25bc56c6a423892f1e1c1b8
4
- data.tar.gz: 61f642b16e141704436eb2295fd0c5bc3bda93bb3991c992d40b71f491a328f4
3
+ metadata.gz: 294443e7f304a5c154aa48af9c20145bba9ff2caaf090bb7336c9bb7538be19d
4
+ data.tar.gz: c89f84d45eaf0923a7a023bd11b9cf54830054a178ce93e1074aea63cb7a9658
5
5
  SHA512:
6
- metadata.gz: 8ddb08586b88d7bc3a1447b1ba503aa3170e587ba7a82134d660706be1e5a46ecf5f6180e16feb4736ebd2558e7bfc13f8474bdcca8f0a676945daa04d4ce04f
7
- data.tar.gz: f0433134ba8bc1d93e4d4dbc6c8223c3033eda63525defb8a385c4cefc4bc43618b89cb97a47668060b744cfdac57b39e19dbdfebc7867a43ff18f7065d373c1
6
+ metadata.gz: 9fe569142636d1acbba97f47dc7efbe38da3c02e9b19e77ab7ad723b6c03a52c03c3d8cd730a9948b4c45b21cdb6e807c29c181fd5d27f77aeee11c92c9738f4
7
+ data.tar.gz: 2bd24bb8f545496e7bbb115f9bd1577f60d03e67198a0452cd2393f977f063ac0e168f699930c6819a0c478a9c208627db75f7c49a63e5f5905256ba0ef3c8ca
data/README.md CHANGED
@@ -95,7 +95,7 @@ matcher.matches? { "foo" } # => true
95
95
  ```ruby
96
96
  matcher = Matchi::RaiseException.new(:NameError)
97
97
 
98
- matcher.expected # => :NameError
98
+ matcher.expected # => "NameError"
99
99
  matcher.matches? { Boom } # => true
100
100
  ```
101
101
 
@@ -104,7 +104,7 @@ matcher.matches? { Boom } # => true
104
104
  ```ruby
105
105
  matcher = Matchi::BeAnInstanceOf.new(:String)
106
106
 
107
- matcher.expected # => :String
107
+ matcher.expected # => "String"
108
108
  matcher.matches? { "foo" } # => true
109
109
  ```
110
110
 
@@ -3,7 +3,7 @@
3
3
  module Matchi
4
4
  # *Type/class* matcher.
5
5
  class BeAnInstanceOf
6
- # @return [Symbol] The expected class name.
6
+ # @return [String] The expected class name.
7
7
  attr_reader :expected
8
8
 
9
9
  # Initialize the matcher with (the name of) a class or module.
@@ -15,7 +15,7 @@ module Matchi
15
15
  #
16
16
  # @param expected [Class, #to_s] The expected class name.
17
17
  def initialize(expected)
18
- @expected = String(expected).to_sym
18
+ @expected = String(expected)
19
19
  end
20
20
 
21
21
  # Boolean comparison between the class of the actual value and the
@@ -26,7 +26,7 @@ module Matchi
26
26
  #
27
27
  # matcher = Matchi::BeAnInstanceOf.new(String)
28
28
  #
29
- # matcher.expected # => :String
29
+ # matcher.expected # => "String"
30
30
  # matcher.matches? { "foo" } # => true
31
31
  #
32
32
  # @yieldreturn [#class] the actual value to compare to the expected one.
data/lib/matchi/change.rb CHANGED
@@ -35,11 +35,11 @@ module Matchi
35
35
  # change_wrapper = Matchi::Change.new(object, :length)
36
36
  # change_wrapper.by_at_least(1)
37
37
  #
38
- # @param expected [#object_id] The minimum delta of the expected change.
38
+ # @param minimum_delta [#object_id] The minimum delta of the expected change.
39
39
  #
40
40
  # @return [#matches?] A *change by at least* matcher.
41
- def by_at_least(expected)
42
- ByAtLeast.new(expected, &@state)
41
+ def by_at_least(minimum_delta)
42
+ ByAtLeast.new(minimum_delta, &@state)
43
43
  end
44
44
 
45
45
  # Specifies a maximum delta of the expected change.
@@ -52,11 +52,11 @@ module Matchi
52
52
  # change_wrapper = Matchi::Change.new(object, :length)
53
53
  # change_wrapper.by_at_most(1)
54
54
  #
55
- # @param expected [#object_id] The maximum delta of the expected change.
55
+ # @param maximum_delta [#object_id] The maximum delta of the expected change.
56
56
  #
57
57
  # @return [#matches?] A *change by at most* matcher.
58
- def by_at_most(expected)
59
- ByAtMost.new(expected, &@state)
58
+ def by_at_most(maximum_delta)
59
+ ByAtMost.new(maximum_delta, &@state)
60
60
  end
61
61
 
62
62
  # Specifies the delta of the expected change.
@@ -69,11 +69,11 @@ module Matchi
69
69
  # change_wrapper = Matchi::Change.new(object, :length)
70
70
  # change_wrapper.by(1)
71
71
  #
72
- # @param expected [#object_id] The delta of the expected change.
72
+ # @param delta [#object_id] The delta of the expected change.
73
73
  #
74
74
  # @return [#matches?] A *change by* matcher.
75
- def by(expected)
76
- By.new(expected, &@state)
75
+ def by(delta)
76
+ By.new(delta, &@state)
77
77
  end
78
78
 
79
79
  # Specifies the original value.
@@ -84,11 +84,11 @@ module Matchi
84
84
  # change_wrapper = Matchi::Change.new("foo", :to_s)
85
85
  # change_wrapper.from("foo")
86
86
  #
87
- # @param expected [#object_id] The original value.
87
+ # @param old_value [#object_id] The original value.
88
88
  #
89
89
  # @return [#matches?] A *change from* wrapper.
90
- def from(expected)
91
- From.new(expected, &@state)
90
+ def from(old_value)
91
+ From.new(old_value, &@state)
92
92
  end
93
93
 
94
94
  # Specifies the new value to expect.
@@ -99,11 +99,11 @@ module Matchi
99
99
  # change_wrapper = Matchi::Change.new("foo", :to_s)
100
100
  # change_wrapper.to("FOO")
101
101
  #
102
- # @param expected [#object_id] The new value to expect.
102
+ # @param new_value [#object_id] The new value to expect.
103
103
  #
104
104
  # @return [#matches?] A *change to* matcher.
105
- def to(expected)
106
- To.new(expected, &@state)
105
+ def to(new_value)
106
+ To.new(new_value, &@state)
107
107
  end
108
108
  end
109
109
  end
@@ -3,7 +3,7 @@
3
3
  module Matchi
4
4
  # *Expecting errors* matcher.
5
5
  class RaiseException
6
- # @return [Symbol] The expected exception name.
6
+ # @return [String] The expected exception name.
7
7
  attr_reader :expected
8
8
 
9
9
  # Initialize the matcher with a descendant of class Exception.
@@ -15,7 +15,7 @@ module Matchi
15
15
  #
16
16
  # @param expected [Exception, #to_s] The expected exception name.
17
17
  def initialize(expected)
18
- @expected = String(expected).to_sym
18
+ @expected = String(expected)
19
19
  end
20
20
 
21
21
  # Boolean comparison between the actual value and the expected value.
@@ -25,7 +25,7 @@ module Matchi
25
25
  #
26
26
  # matcher = Matchi::RaiseException.new(NameError)
27
27
  #
28
- # matcher.expected # => :NameError
28
+ # matcher.expected # => "NameError"
29
29
  # matcher.matches? { Boom } # => true
30
30
  #
31
31
  # @yieldreturn [#object_id] The actual value to compare to the expected
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: 3.1.0
4
+ version: 3.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: 2021-07-22 00:00:00.000000000 Z
11
+ date: 2021-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler