test_tube 2.1.0 → 2.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -11
  3. data/lib/test_tube/base.rb +1 -1
  4. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6aa09337dc5d35dd53da1f517ff92bced3b0d0c4f9c25eef1cd9287b63e14bbf
4
- data.tar.gz: 36026bb1f5f3532e70ff51ebc25a1ddcf8c6098214c438e6a6fb6ad0305b249c
3
+ metadata.gz: 1cac8bf6e09699d7c35d379b70b15cec448fce162d0664eef890405483c7a305
4
+ data.tar.gz: 34d205b4ba02fcc13fecd4478d2e47ca1409e74863abd99749de44332e8c69f3
5
5
  SHA512:
6
- metadata.gz: 668493142591c985ece8e150691d7e60d6834b5da976361ff4c4aea34204b0c645aea61352424daf6964366014df424f881fd6b27fb416c581399395b9c7f8af
7
- data.tar.gz: ea4ce58827e8643b54811082bee5861502d339daa4489ac69355fc06c172ca15f6c1129c6db2bbee171184d06211dba70cca56995302e18d176b3801e61e9f8f
6
+ metadata.gz: 29bbf3f347a546b393f5c180c94d74d41642501610abac8b4dda30ddfeca51606b7cece16a7121d3dd30331789b169039bfee52693056c09122d2fd51021821c
7
+ data.tar.gz: f13e1130f39b17577b066e7fea60e0bd4935a37eba7c27079bc5835e1dc8afbf87ef4b985f1baa4007d1b8a069ecd8e78607fef5a2a1abdbc134c633bbfaba4c
data/README.md CHANGED
@@ -39,7 +39,7 @@ require "test_tube"
39
39
  ```
40
40
 
41
41
  Assuming we'd like to experiment on the answer to the Ultimate Question of Life,
42
- the Universe, and Everything with the following _matcher_:
42
+ the Universe, and Everything with the following matcher:
43
43
 
44
44
  ```ruby
45
45
  class BeTheAnswer
@@ -49,11 +49,7 @@ class BeTheAnswer
49
49
  end
50
50
  ```
51
51
 
52
- A _matcher_ is an object that responds to the `matches?` method with a block
53
- parameter representing the _actual value_ to be compared.
54
-
55
- Back to our Ruby experiments, one possibility would be to `invoke` a whole block
56
- of code:
52
+ One possibility would be to `invoke` a whole block of code:
57
53
 
58
54
  ```ruby
59
55
  block_of_code = -> { "101010".to_i(2) }
@@ -99,7 +95,7 @@ An example of successful experience:
99
95
  ```ruby
100
96
  experiment = TestTube.invoke(
101
97
  isolate: false,
102
- matcher: Matchi::Matcher::RaiseException.new(NoMethodError),
98
+ matcher: Matchi::RaiseException.new(:NoMethodError),
103
99
  negate: false
104
100
  ) { "foo".blank? }
105
101
  # => <TestTube actual=#<NoMethodError: undefined method `blank?' for "foo":String> error=nil got=true>
@@ -114,7 +110,7 @@ Another example of an experiment that fails:
114
110
  ```ruby
115
111
  experiment = TestTube.invoke(
116
112
  isolate: false,
117
- matcher: Matchi::Matcher::Equal.new(0.3),
113
+ matcher: Matchi::Be.new(0.3),
118
114
  negate: false,
119
115
  &-> { 0.1 + 0.2 }
120
116
  ) # => <TestTube actual=0.30000000000000004 error=nil got=false>
@@ -129,7 +125,7 @@ Finally, an experiment which causes an error:
129
125
  ```ruby
130
126
  experiment = TestTube.invoke(
131
127
  isolate: false,
132
- matcher: Matchi::Matcher::Match.new(/^foo$/),
128
+ matcher: Matchi::Match.new(/^foo$/),
133
129
  negate: false
134
130
  ) { BOOM }
135
131
  # => <TestTube actual=nil error=#<NameError: uninitialized constant BOOM> got=nil>
@@ -157,7 +153,7 @@ side effects:
157
153
  ```ruby
158
154
  experiment = TestTube.invoke(
159
155
  isolate: true,
160
- matcher: Matchi::Matcher::Eql.new("Hello, Alice!"),
156
+ matcher: Matchi::Eq.new("Hello, Alice!"),
161
157
  negate: false,
162
158
  &block_of_code
163
159
  ) # => <TestTube actual="Hello, Alice!" error=nil got=true>
@@ -170,7 +166,7 @@ Otherwise, we can experiment without any code isolation:
170
166
  ```ruby
171
167
  experiment = TestTube.invoke(
172
168
  isolate: false,
173
- matcher: Matchi::Matcher::Eql.new("Hello, Alice!"),
169
+ matcher: Matchi::Eq.new("Hello, Alice!"),
174
170
  negate: false,
175
171
  &block_of_code
176
172
  ) # => <TestTube actual="Hello, Alice!" error=nil got=true>
@@ -4,7 +4,7 @@ module TestTube
4
4
  # Abstract class representing the state of an experiment.
5
5
  #
6
6
  # @api private
7
- class Base
7
+ class Base < ::BasicObject
8
8
  # Expectation's actual value.
9
9
  #
10
10
  # @return [#object_id] The actual value.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_tube
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.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-19 00:00:00.000000000 Z
11
+ date: 2021-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: defi
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.5
19
+ version: 2.0.6
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.5
26
+ version: 2.0.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: brutal
29
29
  requirement: !ruby/object:Gem::Requirement