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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9481891447948b8269009e11ab88cb3bd6539d1e9c2802422cdd6b670facc1f6
4
- data.tar.gz: 9ac1c4feff5be0e70ac290276ab6706b78bd0e4ea4ae8a494b9f5725b809bb6a
3
+ metadata.gz: 4228249f8fc1a787a594dc604462fef627c33ea693cd8fc1567b8bbd859d7ed3
4
+ data.tar.gz: 2eec405d2f2e77cd548e62343c92ab07c530b3aaabea4ce91044a8fbcf0effed
5
5
  SHA512:
6
- metadata.gz: 709f5a0aadc0f298e658547cbc9e2ae3e2d6fba6e0f66a13532c5c9d46dd81f1b22770f967b5aeb6e219cbe844a86d13503656b1f3feb3b84097cc6b91ef349d
7
- data.tar.gz: 9ce524a16df98dffbfd1aa09331a74fb020488e8f6939e1f43c4e87292db7e2f604e14a65d8fd81faf33ba8d6d0293082b7b41b5d5db626fe21e19c2dcbbeeb8
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
 
@@ -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.name}" }
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.0'
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("invalid child opts #{child.opts.inspect}") \
745
- unless child.opts.is_a?(Hash)
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.0
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-02-04 00:00:00.000000000 Z
11
+ date: 2026-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: stringio