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.
- checksums.yaml +4 -4
- data/README.md +7 -11
- data/lib/test_tube/base.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cac8bf6e09699d7c35d379b70b15cec448fce162d0664eef890405483c7a305
|
4
|
+
data.tar.gz: 34d205b4ba02fcc13fecd4478d2e47ca1409e74863abd99749de44332e8c69f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
-
|
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::
|
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::
|
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::
|
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::
|
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::
|
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>
|
data/lib/test_tube/base.rb
CHANGED
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.
|
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-
|
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.
|
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.
|
26
|
+
version: 2.0.6
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: brutal
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|