sus 0.21.2 → 0.22.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
- checksums.yaml.gz.sig +0 -0
- data/lib/sus/config.rb +7 -3
- data/lib/sus/context.rb +7 -1
- data/lib/sus/identity.rb +4 -0
- data/lib/sus/integrations.rb +9 -0
- data/lib/sus/it.rb +17 -5
- data/lib/sus/output/backtrace.rb +34 -12
- data/lib/sus/registry.rb +1 -1
- data/lib/sus/version.rb +1 -1
- data/lib/sus/with.rb +1 -0
- data.tar.gz.sig +0 -0
- metadata +4 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d98d9db638357180f67cf8eb50386e099d8ec38adf112fe86bbddd950faa2bb6
|
4
|
+
data.tar.gz: b26ceb6e7fabd8817ffa6c033bdbe9216b7656efea458d0c23f6783a8fc8c9ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed2b150dd585fd0f3f71c3ee5c21067be8989145b96bf8c7eb2606eae7bd7b9b33c0bbec5c2c6a9c83d6ece774fc6539c53d7e5e8e5c1201c2c191862648db35
|
7
|
+
data.tar.gz: e1103fa59201767edbcae235d05e49515b763eeb28fa92d117bd1a97aff0e34644a6b3f9eea2b2b493248965e3ad57d861f1ca329c60d0ed63065a9e1bc861f2
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/sus/config.rb
CHANGED
@@ -78,12 +78,12 @@ module Sus
|
|
78
78
|
return Dir.glob(DEFAULT_TEST_PATTERN, base: @root)
|
79
79
|
end
|
80
80
|
|
81
|
-
def
|
82
|
-
@
|
81
|
+
def make_registry
|
82
|
+
Sus::Registry.new(root: @root)
|
83
83
|
end
|
84
84
|
|
85
85
|
def load_registry(paths = @paths)
|
86
|
-
registry =
|
86
|
+
registry = make_registry
|
87
87
|
|
88
88
|
if paths&.any?
|
89
89
|
registry = Sus::Filter.new(registry)
|
@@ -99,6 +99,10 @@ module Sus
|
|
99
99
|
return registry
|
100
100
|
end
|
101
101
|
|
102
|
+
def registry
|
103
|
+
@registry ||= self.load_registry
|
104
|
+
end
|
105
|
+
|
102
106
|
def before_tests(assertions, output: self.output)
|
103
107
|
@clock.reset!
|
104
108
|
@clock.start!
|
data/lib/sus/context.rb
CHANGED
@@ -47,7 +47,13 @@ module Sus
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def print(output)
|
50
|
-
output.write("context
|
50
|
+
output.write("context", :context, self.description)
|
51
|
+
end
|
52
|
+
|
53
|
+
def full_name
|
54
|
+
output = Output::Buffered.new
|
55
|
+
print(output)
|
56
|
+
return output.string
|
51
57
|
end
|
52
58
|
|
53
59
|
def call(assertions)
|
data/lib/sus/identity.rb
CHANGED
@@ -15,6 +15,10 @@ module Sus
|
|
15
15
|
self.new(location.path, name, location.lineno, parent, **options)
|
16
16
|
end
|
17
17
|
|
18
|
+
def self.current
|
19
|
+
self.nested(nil, nil, caller_locations(1...2).first)
|
20
|
+
end
|
21
|
+
|
18
22
|
# @parameter unique [Boolean | Symbol] Whether this identity is unique or needs a unique key/line number suffix.
|
19
23
|
def initialize(path, name = nil, line = nil, parent = nil, unique: true)
|
20
24
|
@path = path
|
data/lib/sus/it.rb
CHANGED
@@ -28,11 +28,11 @@ module Sus
|
|
28
28
|
def print(output)
|
29
29
|
self.superclass.print(output)
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
31
|
+
output.write(" it ", :it, self.description, :reset, " ", :identity, self.identity.to_s, :reset)
|
32
|
+
end
|
33
|
+
|
34
|
+
def to_s
|
35
|
+
"it #{description}"
|
36
36
|
end
|
37
37
|
|
38
38
|
def call(assertions)
|
@@ -77,5 +77,17 @@ module Sus
|
|
77
77
|
skip "Constant #{constant} is not defined in #{target}!"
|
78
78
|
end
|
79
79
|
end
|
80
|
+
|
81
|
+
def skip_unless_minimum_ruby_version(version)
|
82
|
+
unless RUBY_VERSION >= version
|
83
|
+
skip "Ruby #{version} is required, but running #{RUBY_VERSION}!"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def skip_if_maximum_ruby_version(version)
|
88
|
+
if RUBY_VERSION >= version
|
89
|
+
skip "Ruby #{version} is not supported, but running #{RUBY_VERSION}!"
|
90
|
+
end
|
91
|
+
end
|
80
92
|
end
|
81
93
|
end
|
data/lib/sus/output/backtrace.rb
CHANGED
@@ -15,7 +15,7 @@ module Sus
|
|
15
15
|
def self.for(exception, identity = nil)
|
16
16
|
# I've disabled the root filter here, because partial backtraces are not very useful.
|
17
17
|
# We might want to do something to improve presentation of the backtrace based on the root instead.
|
18
|
-
self.new(exception.backtrace_locations
|
18
|
+
self.new(exception.backtrace_locations, identity&.path)
|
19
19
|
end
|
20
20
|
|
21
21
|
def initialize(stack, root = nil, limit = nil)
|
@@ -24,20 +24,26 @@ module Sus
|
|
24
24
|
@limit = limit
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
attr :stack
|
28
|
+
attr :root
|
29
|
+
attr :limit
|
30
|
+
|
31
|
+
def filter(root: @root, limit: @limit)
|
32
|
+
if root
|
33
|
+
if limit
|
34
|
+
return @stack.lazy.select do |frame|
|
35
|
+
frame.path.start_with?(root)
|
36
|
+
end.first(limit)
|
37
|
+
else
|
38
|
+
return up_to_and_matching(@stack) do |frame|
|
39
|
+
frame.path.start_with?(root)
|
40
|
+
end
|
31
41
|
end
|
42
|
+
elsif limit
|
43
|
+
return @stack.first(limit)
|
32
44
|
else
|
33
|
-
|
45
|
+
return @stack
|
34
46
|
end
|
35
|
-
|
36
|
-
if @limit
|
37
|
-
stack = stack.take(@limit)
|
38
|
-
end
|
39
|
-
|
40
|
-
return stack
|
41
47
|
end
|
42
48
|
|
43
49
|
def print(output)
|
@@ -53,6 +59,22 @@ module Sus
|
|
53
59
|
end
|
54
60
|
end
|
55
61
|
end
|
62
|
+
|
63
|
+
private def up_to_and_matching(things, &block)
|
64
|
+
preface = true
|
65
|
+
things.select do |thing|
|
66
|
+
if preface
|
67
|
+
if yield(thing)
|
68
|
+
preface = false
|
69
|
+
end
|
70
|
+
true
|
71
|
+
elsif yield(thing)
|
72
|
+
true
|
73
|
+
else
|
74
|
+
false
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
56
78
|
end
|
57
79
|
end
|
58
80
|
end
|
data/lib/sus/registry.rb
CHANGED
data/lib/sus/version.rb
CHANGED
data/lib/sus/with.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.22.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -38,7 +38,7 @@ cert_chain:
|
|
38
38
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
39
39
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
40
40
|
-----END CERTIFICATE-----
|
41
|
-
date: 2023-
|
41
|
+
date: 2023-08-01 00:00:00.000000000 Z
|
42
42
|
dependencies: []
|
43
43
|
description:
|
44
44
|
email:
|
@@ -74,6 +74,7 @@ files:
|
|
74
74
|
- lib/sus/have_duration.rb
|
75
75
|
- lib/sus/identity.rb
|
76
76
|
- lib/sus/include_context.rb
|
77
|
+
- lib/sus/integrations.rb
|
77
78
|
- lib/sus/it.rb
|
78
79
|
- lib/sus/it_behaves_like.rb
|
79
80
|
- lib/sus/let.rb
|
@@ -120,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
121
|
- !ruby/object:Gem::Version
|
121
122
|
version: '0'
|
122
123
|
requirements: []
|
123
|
-
rubygems_version: 3.4.
|
124
|
+
rubygems_version: 3.4.7
|
124
125
|
signing_key:
|
125
126
|
specification_version: 4
|
126
127
|
summary: A fast and scalable test runner.
|
metadata.gz.sig
CHANGED
Binary file
|