probatio 1.6.0 → 1.6.2
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/CHANGELOG.md +13 -0
- data/README.md +5 -0
- data/lib/probatio/assertions.rb +33 -9
- data/lib/probatio.rb +6 -3
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4228249f8fc1a787a594dc604462fef627c33ea693cd8fc1567b8bbd859d7ed3
|
|
4
|
+
data.tar.gz: 2eec405d2f2e77cd548e62343c92ab07c530b3aaabea4ce91044a8fbcf0effed
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a3034d250e0189025c003f95b1f213c34ffc6ea5bdfc6da080c298029e8b419c56ce195566a3943f36a5c4db27e74bc7268473dade3e48ea4658e4ed79a1fd32
|
|
7
|
+
data.tar.gz: 9d5f1a38728c5a18162ec83782e818c9c9275368f4bdae18bbe4ad17bbb6a39bd4fed50556ddc03b5cb7819a689b8495b72a2c279728ef9d0fc995d04f6ca58e
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
# CHANGELOG.md
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
## probatio 1.6.2 released 2026-07-29
|
|
6
|
+
|
|
7
|
+
* Introduce `refute` as counterpart to `assert` jack of some trades
|
|
8
|
+
* Introduce `assert_not`
|
|
9
|
+
* Indicate choke point on `before :each do`
|
|
10
|
+
* Introduce bxp.fish, fish bxp completion
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## probatio 1.6.1 released 2026-03-15
|
|
14
|
+
|
|
15
|
+
* Fix issue with `assert_no_error`
|
|
16
|
+
|
|
17
|
+
|
|
5
18
|
## probatio 1.6.0 released 2026-02-04
|
|
6
19
|
|
|
7
20
|
* Let `proba` accept leaf globs directly
|
data/README.md
CHANGED
|
@@ -126,6 +126,8 @@ group 'core' do
|
|
|
126
126
|
assert_nil nil
|
|
127
127
|
assert_not_nil [], 1
|
|
128
128
|
|
|
129
|
+
assert_not answers.include?('no')
|
|
130
|
+
|
|
129
131
|
assert_true true
|
|
130
132
|
assert_false 1 > 2
|
|
131
133
|
|
|
@@ -199,6 +201,9 @@ group 'core' do
|
|
|
199
201
|
# assert equality between key and value
|
|
200
202
|
assert 'one' => 'on' + 'e', 'two' => :two.to_s
|
|
201
203
|
# assert equality between keys and values
|
|
204
|
+
|
|
205
|
+
refute 'one', /two/
|
|
206
|
+
# refute is the counter-part to assert...
|
|
202
207
|
end
|
|
203
208
|
end
|
|
204
209
|
|
data/lib/probatio/assertions.rb
CHANGED
|
@@ -39,6 +39,11 @@ class Probatio::Context
|
|
|
39
39
|
do_assert(as, 'false') { |a| a == false }
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
+
def assert_not(*as)
|
|
43
|
+
|
|
44
|
+
do_assert(as, 'not') { |a| ! a }
|
|
45
|
+
end
|
|
46
|
+
|
|
42
47
|
def assert_any(*as)
|
|
43
48
|
|
|
44
49
|
do_assert(as, 'any') { |a| a.respond_to?(:size) && a.size > 0 }
|
|
@@ -62,6 +67,14 @@ class Probatio::Context
|
|
|
62
67
|
do_assert(strings, 'matched') { |s| s.match?(rex) }
|
|
63
68
|
end
|
|
64
69
|
|
|
70
|
+
def refute_match(*as)
|
|
71
|
+
|
|
72
|
+
strings, others = as.partition { |a| a.is_a?(String) }
|
|
73
|
+
rex = others.find { |o| o.is_a?(Regexp) } || strings.pop
|
|
74
|
+
|
|
75
|
+
do_assert(strings, 'not matched') { |s| ! s.match?(rex) }
|
|
76
|
+
end
|
|
77
|
+
|
|
65
78
|
def assert_start_with(*as)
|
|
66
79
|
|
|
67
80
|
fail ArgumentError.new(
|
|
@@ -124,6 +137,11 @@ class Probatio::Context
|
|
|
124
137
|
do_assert(as[0].to_a, 'hashy equal') { |k, v| k == v }
|
|
125
138
|
end
|
|
126
139
|
|
|
140
|
+
def refute_hashy(*as)
|
|
141
|
+
|
|
142
|
+
do_assert(as[0].to_a, 'hashy not equal') { |k, v| k != v }
|
|
143
|
+
end
|
|
144
|
+
|
|
127
145
|
def assert_instance_of(*as)
|
|
128
146
|
|
|
129
147
|
moc = as.find { |a| a.is_a?(Module) }
|
|
@@ -180,7 +198,7 @@ class Probatio::Context
|
|
|
180
198
|
begin; block.call; rescue => err; end
|
|
181
199
|
|
|
182
200
|
do_assert_([]) {
|
|
183
|
-
err && "no error expected but returned #{err.class} #{err.
|
|
201
|
+
err && "no error expected but returned #{err.class} #{err.message}" }
|
|
184
202
|
end
|
|
185
203
|
alias assert_no_error assert_not_error
|
|
186
204
|
alias assert_nothing_raised assert_not_error
|
|
@@ -206,7 +224,15 @@ class Probatio::Context
|
|
|
206
224
|
|
|
207
225
|
# Jack of all trade assert
|
|
208
226
|
#
|
|
209
|
-
def assert(*as)
|
|
227
|
+
def assert(*as); jack(:assert, as); end
|
|
228
|
+
|
|
229
|
+
# Jack of all trade refute
|
|
230
|
+
#
|
|
231
|
+
def refute(*as); jack(:refute, as); end
|
|
232
|
+
|
|
233
|
+
protected
|
|
234
|
+
|
|
235
|
+
def jack(dir, as)
|
|
210
236
|
|
|
211
237
|
count = {
|
|
212
238
|
rexes: 0, hashes: 0, arrays: 0, strings: 0, scalars: 0, others: 0 }
|
|
@@ -224,27 +250,25 @@ class Probatio::Context
|
|
|
224
250
|
|
|
225
251
|
if as.length == 1 && count[:hashes] == 1
|
|
226
252
|
|
|
227
|
-
assert_hashy(*as)
|
|
253
|
+
dir == :assert ? assert_hashy(*as) : refute_hashy(*as)
|
|
228
254
|
|
|
229
255
|
elsif as.length == 1
|
|
230
256
|
|
|
231
|
-
assert_truthy(*as)
|
|
257
|
+
dir == :assert ? assert_truthy(*as) : assert_falsey(*as)
|
|
232
258
|
|
|
233
259
|
elsif count[:rexes] == 1 && count[:strings] == as.length - 1
|
|
234
260
|
|
|
235
|
-
assert_match(*as)
|
|
261
|
+
dir == :assert ? assert_match(*as) : refute_match(*as)
|
|
236
262
|
|
|
237
263
|
#elsif count[:arrays] > 0
|
|
238
|
-
# assert_include(*as)
|
|
264
|
+
# dir == :assert ? assert_include(*as) : refute_include(*as)
|
|
239
265
|
|
|
240
266
|
else
|
|
241
267
|
|
|
242
|
-
assert_equal(*as)
|
|
268
|
+
dir == :assert ? assert_equal(*as) : assert_not(*as)
|
|
243
269
|
end
|
|
244
270
|
end
|
|
245
271
|
|
|
246
|
-
protected
|
|
247
|
-
|
|
248
272
|
def do_assert(as, msg, &block)
|
|
249
273
|
|
|
250
274
|
do_assert_(as) do
|
data/lib/probatio.rb
CHANGED
|
@@ -18,7 +18,7 @@ require 'probatio/more'
|
|
|
18
18
|
|
|
19
19
|
module Probatio
|
|
20
20
|
|
|
21
|
-
VERSION = '1.6.
|
|
21
|
+
VERSION = '1.6.2'
|
|
22
22
|
|
|
23
23
|
class << self
|
|
24
24
|
|
|
@@ -741,8 +741,11 @@ module Probatio
|
|
|
741
741
|
|
|
742
742
|
def do_run(child, run_opts, &block)
|
|
743
743
|
|
|
744
|
-
fail ArgumentError.new(
|
|
745
|
-
|
|
744
|
+
fail ArgumentError.new(
|
|
745
|
+
"invalid opts #{child.opts.inspect} " +
|
|
746
|
+
"for child #{child.class} " +
|
|
747
|
+
"at #{child.path_and_line}"
|
|
748
|
+
) unless child.opts.is_a?(Hash)
|
|
746
749
|
|
|
747
750
|
return Probatio.despatch("#{child.type}_pending", self, child, run_opts) \
|
|
748
751
|
if child.opts[:pending] || child.block.nil?
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: probatio
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.6.
|
|
4
|
+
version: 1.6.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- John Mettraux
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-07-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: stringio
|