probatio 1.2.0 → 1.3.0
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 +16 -5
- data/README.md +74 -1
- data/exe/proba +1 -1
- data/lib/probatio/assertions.rb +7 -6
- data/lib/probatio/examples/a_test.rb +53 -0
- data/lib/probatio/helpers.rb +16 -0
- data/lib/probatio/plugins.rb +2 -2
- data/lib/probatio.rb +3 -1
- 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: f855685ad365c5dfbaa6c719b930f0b5113d35ab47cee5e31dff2c9af994b1f7
|
4
|
+
data.tar.gz: be76c4d06ec56b0541bf256b87fede46a30d455bba1c2b55192ebfd3da9fa8e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3192dc95ac4aa5c09e965f25207331ebb8801607c92e9c72fbc6373644be62a2a961ddfce26cdbfc50969aed3e2640b461427ee23896e8c236d946b3908a99a8
|
7
|
+
data.tar.gz: 8fb9d38e3a4111d2d968b4a54deb10ce997ac9ea1dd16127d99289ab71789ca825e768d01c770d07e6b23c00fd0945fe80fbe5ce47f3bf97a05cc5cea2718567
|
data/CHANGELOG.md
CHANGED
@@ -2,30 +2,41 @@
|
|
2
2
|
# CHANGELOG.md
|
3
3
|
|
4
4
|
|
5
|
-
##
|
5
|
+
## probatio 1.3.0 released 2025-08-08
|
6
|
+
|
7
|
+
* Add windows? and jruby? to Probatio::Group
|
8
|
+
* Alias `assert_nothing_raised` to `assert_no_error`
|
9
|
+
|
10
|
+
|
11
|
+
## probatio 1.2.1 released 2025-05-20
|
12
|
+
|
13
|
+
* Tighten Probatio.beep and friends
|
14
|
+
|
15
|
+
|
16
|
+
## probatio 1.2.0 released 2025-05-19
|
6
17
|
|
7
18
|
* Introduce Probatio::Context#beep
|
8
19
|
* Introduce --beeps {n || 1}
|
9
20
|
* Allow for list.rb as 'list'
|
10
21
|
|
11
22
|
|
12
|
-
##
|
23
|
+
## probatio 1.1.1 released 2025-05-08
|
13
24
|
|
14
25
|
* Fix .probatio-output.rb string/number alignment
|
15
26
|
* Fix assert_error and assert_no_error
|
16
27
|
|
17
28
|
|
18
|
-
##
|
29
|
+
## probatio 1.1.0 released 2025-04-16
|
19
30
|
|
20
31
|
* Introduce `assert_no_error { do_this_or_that() }`
|
21
32
|
|
22
33
|
|
23
|
-
##
|
34
|
+
## probatio 1.0.0 released 2025-02-08
|
24
35
|
|
25
36
|
* Initial release
|
26
37
|
|
27
38
|
|
28
|
-
##
|
39
|
+
## probatio 0.9.0 released 2024-12-19
|
29
40
|
|
30
41
|
* Initial bogus release ;-)
|
31
42
|
|
data/README.md
CHANGED
@@ -39,6 +39,7 @@ Usage: bundle exec proba [OPTIONS] [DIRS] [FILES] [OTHERS] [ENVS]
|
|
39
39
|
-d, --debug smr 's' for start opts, 'm' for messages, 'r' for $DEBUG
|
40
40
|
-x, --example Outputs an example test file
|
41
41
|
-X, --plugin-example Outputs an example plugin file
|
42
|
+
-b, --beep[s] {n || 1} Beeps n time before exit
|
42
43
|
--mangle Turns the given _spec.rb files into proba _test.rb
|
43
44
|
|
44
45
|
Dirs:
|
@@ -174,6 +175,8 @@ group 'core' do
|
|
174
175
|
assert_no_error lambda { do_this_or_that() }
|
175
176
|
assert_not_error { do_this_or_that() }
|
176
177
|
assert_not_error lambda { do_this_or_that() }
|
178
|
+
assert_nothing_raised { do_this_or_that() }
|
179
|
+
assert_nothing_raised lambda { do_this_or_that() }
|
177
180
|
# checks that the block or Proc does not raise an error
|
178
181
|
|
179
182
|
assert_hashy(
|
@@ -230,6 +233,51 @@ group 'core < sub-core < sub-sub-core' do
|
|
230
233
|
test 'that' do
|
231
234
|
end
|
232
235
|
end
|
236
|
+
|
237
|
+
|
238
|
+
group 'notcore' do
|
239
|
+
|
240
|
+
# A section allows for some kind of "inheritance" between groups...
|
241
|
+
#
|
242
|
+
section 'with db' do
|
243
|
+
|
244
|
+
setup do
|
245
|
+
|
246
|
+
prepare_db
|
247
|
+
end
|
248
|
+
|
249
|
+
before do
|
250
|
+
|
251
|
+
reset_and_load_fixtures
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
group 'alpha' do
|
256
|
+
|
257
|
+
group 'without db' do
|
258
|
+
|
259
|
+
# ...
|
260
|
+
end
|
261
|
+
|
262
|
+
group 'with db' do
|
263
|
+
|
264
|
+
# gets the setup and before from the "with db" section
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
group 'bravo' do
|
269
|
+
|
270
|
+
group 'without db' do
|
271
|
+
|
272
|
+
# ...
|
273
|
+
end
|
274
|
+
|
275
|
+
group 'with db' do
|
276
|
+
|
277
|
+
# gets the setup and before from the "with db" section
|
278
|
+
end
|
279
|
+
end
|
280
|
+
end
|
233
281
|
```
|
234
282
|
|
235
283
|
|
@@ -276,10 +324,13 @@ some_env:
|
|
276
324
|
{
|
277
325
|
USER: "jmettraux",
|
278
326
|
HOME: "/home/jmettraux",
|
279
|
-
PATH: "/home/jmettraux/.gem/ruby/3.3/bin:/home/jmettraux/.pkg_rubies/ruby33:/usr/local/jdk-21/bin:/home/jmettraux/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin",
|
280
327
|
SHELL: "/usr/local/bin/fish",
|
281
328
|
GEM_HOME: "/home/jmettraux/.gem/ruby/3.3",
|
282
329
|
PWD: "/home/jmettraux/w/probatio/test",
|
330
|
+
PATH:
|
331
|
+
"/home/jmettraux/.gem/ruby/3.3/bin:/home/jmettraux/.pkg_rubies/ruby33:" +
|
332
|
+
"/usr/local/jdk-21/bin:/home/jmettraux/bin:/bin:/usr/bin:/sbin:" +
|
333
|
+
"/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin",
|
283
334
|
},
|
284
335
|
}
|
285
336
|
```
|
@@ -289,6 +340,28 @@ Probatio uses it when servicing `bundle exec proba 0` or `bundle exe proba -1`.
|
|
289
340
|
It can also be useful to other tools around probatio.
|
290
341
|
|
291
342
|
|
343
|
+
## Helpers
|
344
|
+
|
345
|
+
Built-in helpers:
|
346
|
+
```ruby
|
347
|
+
jruby? # => returns true when running on JRuby
|
348
|
+
windows? # => returns true when running on Windows
|
349
|
+
```
|
350
|
+
|
351
|
+
_Waiter_ helpers:
|
352
|
+
```ruby
|
353
|
+
wait_for {
|
354
|
+
some_condition == true
|
355
|
+
}
|
356
|
+
wait_for(timeout: 60, frequency: 1) { # wait for 60 seconds, check every sec
|
357
|
+
some_condition == true
|
358
|
+
}
|
359
|
+
wait_until { # wait_until is an alias to wait_for
|
360
|
+
some_condition == true
|
361
|
+
}
|
362
|
+
```
|
363
|
+
|
364
|
+
|
292
365
|
## Warnings
|
293
366
|
|
294
367
|
```
|
data/exe/proba
CHANGED
@@ -100,7 +100,7 @@ if switches['-h'] || switches['--help']
|
|
100
100
|
-d, --debug smr 's' for start opts, 'm' for messages, 'r' for $DEBUG
|
101
101
|
-x, --example Outputs an example test file
|
102
102
|
-X, --plugin-example Outputs an example plugin file
|
103
|
-
-b, --
|
103
|
+
-b, --beep[s] {n || 1} Beeps n time before exit
|
104
104
|
--mangle Turns the given _spec.rb files into proba _test.rb
|
105
105
|
|
106
106
|
Dirs:
|
data/lib/probatio/assertions.rb
CHANGED
@@ -176,6 +176,7 @@ class Probatio::Context
|
|
176
176
|
err && "no error expected but returned #{err.class} #{err.name}" }
|
177
177
|
end
|
178
178
|
alias assert_no_error assert_not_error
|
179
|
+
alias assert_nothing_raised assert_not_error
|
179
180
|
|
180
181
|
# Checks whether its "_assert_something", if that's the case,
|
181
182
|
# just flags the assertion as :pending an moves on
|
@@ -298,13 +299,13 @@ class Probatio::Context
|
|
298
299
|
|
299
300
|
def extract_file_and_line(backtrace)
|
300
301
|
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
302
|
+
l =
|
303
|
+
backtrace.find { |l| l.index('_test.rb') } ||
|
304
|
+
backtrace.find { |l| ! l.index('/lib/probatio/') }
|
305
|
+
m =
|
306
|
+
l && l.match(/([^:]+):(\d+)/)
|
305
307
|
|
306
|
-
m
|
307
|
-
m && [ m[1], m[2].to_i ]
|
308
|
+
m ? [ m[1], m[2].to_i ] : [ nil, -1 ]
|
308
309
|
end
|
309
310
|
|
310
311
|
def extract_assert_method(backtrace)
|
@@ -69,6 +69,14 @@ group 'core' do
|
|
69
69
|
# checks that the given Proc raises an ArgumentError and
|
70
70
|
# the error message == "bad"
|
71
71
|
|
72
|
+
assert_no_error { do_this_or_that() }
|
73
|
+
assert_no_error lambda { do_this_or_that() }
|
74
|
+
assert_not_error { do_this_or_that() }
|
75
|
+
assert_not_error lambda { do_this_or_that() }
|
76
|
+
assert_nothing_raised { do_this_or_that() }
|
77
|
+
assert_nothing_raised lambda { do_this_or_that() }
|
78
|
+
# checks that the block or Proc does not raise an error
|
79
|
+
|
72
80
|
assert_hashy(
|
73
81
|
this_thing => 1,
|
74
82
|
that_thing => 'two')
|
@@ -124,3 +132,48 @@ group 'core < sub-core < sub-sub-core' do
|
|
124
132
|
end
|
125
133
|
end
|
126
134
|
|
135
|
+
|
136
|
+
group 'notcore' do
|
137
|
+
|
138
|
+
# A section allows for some kind of "inheritance" between groups...
|
139
|
+
#
|
140
|
+
section 'with db' do
|
141
|
+
|
142
|
+
setup do
|
143
|
+
|
144
|
+
prepare_db
|
145
|
+
end
|
146
|
+
|
147
|
+
before do
|
148
|
+
|
149
|
+
reset_and_load_fixtures
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
group 'alpha' do
|
154
|
+
|
155
|
+
group 'without db' do
|
156
|
+
|
157
|
+
# ...
|
158
|
+
end
|
159
|
+
|
160
|
+
group 'with db' do
|
161
|
+
|
162
|
+
# gets the setup and before from the "with db" section
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
group 'bravo' do
|
167
|
+
|
168
|
+
group 'without db' do
|
169
|
+
|
170
|
+
# ...
|
171
|
+
end
|
172
|
+
|
173
|
+
group 'with db' do
|
174
|
+
|
175
|
+
# gets the setup and before from the "with db" section
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
data/lib/probatio/helpers.rb
CHANGED
@@ -8,6 +8,22 @@ module Probatio::Helpers
|
|
8
8
|
|
9
9
|
Probatio.beep(count || 0)
|
10
10
|
end
|
11
|
+
|
12
|
+
def jruby?
|
13
|
+
|
14
|
+
!! RUBY_PLATFORM.match?(/java/)
|
15
|
+
end
|
16
|
+
|
17
|
+
def windows?
|
18
|
+
|
19
|
+
Gem.win_platform?
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
class Probatio::Group
|
25
|
+
|
26
|
+
include Probatio::Helpers
|
11
27
|
end
|
12
28
|
|
13
29
|
class Probatio::Section
|
data/lib/probatio/plugins.rb
CHANGED
@@ -246,7 +246,7 @@ module Probatio
|
|
246
246
|
|
247
247
|
def self.beep(count=1)
|
248
248
|
|
249
|
-
count.times { Probatio._beep; sleep 0.5 }
|
249
|
+
(count || 0).times { Probatio._beep; sleep 0.5 }
|
250
250
|
end
|
251
251
|
end
|
252
252
|
|
@@ -254,7 +254,7 @@ class Probatio::Beeper
|
|
254
254
|
|
255
255
|
def on_exit(ev)
|
256
256
|
|
257
|
-
Probatio.beep(ev.opts[:beeps])
|
257
|
+
Probatio.beep(ev.opts[:beeps] || 0)
|
258
258
|
end
|
259
259
|
end
|
260
260
|
|
data/lib/probatio.rb
CHANGED
@@ -15,7 +15,7 @@ require 'probatio/more'
|
|
15
15
|
|
16
16
|
module Probatio
|
17
17
|
|
18
|
-
VERSION = '1.
|
18
|
+
VERSION = '1.3.0'
|
19
19
|
|
20
20
|
class << self
|
21
21
|
|
@@ -845,6 +845,8 @@ module Probatio
|
|
845
845
|
|
846
846
|
def select_source_lines(path, line)
|
847
847
|
|
848
|
+
return [] unless path
|
849
|
+
|
848
850
|
File.readlines(path).each_with_index.to_a[line - 1..-1]
|
849
851
|
.map { |l, i| [ i + 1, l.rstrip ] }
|
850
852
|
.take_while { |_, l|
|
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.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorato
|