sus 0.22.2 → 0.24.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/sus/assertions.rb +2 -8
- data/lib/sus/be_within.rb +4 -2
- data/lib/sus/have.rb +6 -2
- data/lib/sus/have_duration.rb +1 -3
- data/lib/sus/output/backtrace.rb +15 -1
- data/lib/sus/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c2d41bca4906fd41229694de7d745d2801ab00eb528c4da69d7c8d7b3dfeb96
|
4
|
+
data.tar.gz: 9bcc82bf379b63ea46c8c15fcbc9528a391cc3cec60a960f2cc884e88ece4c20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78f77fb2e30226a9c73714f46d79e3652fbd18826b54fef2a267c04eb31ecdb931372bc60a96f64711e5486e91ebc8b56a00fc292e554c2e7e3f3916d2a16037
|
7
|
+
data.tar.gz: 99626e222b997286b22a6a9ecf00960d86f5d991ee9b8f841720868b396234fa17319a31ede8990bdc381b398020927ac32ecc1769ce21c7fc9b78aa1586f456
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/sus/assertions.rb
CHANGED
@@ -192,16 +192,10 @@ module Sus
|
|
192
192
|
|
193
193
|
if condition
|
194
194
|
@passed << assert
|
195
|
-
|
196
|
-
if !@orientation || @verbose
|
197
|
-
@output.assert(condition, @orientation, message || "assertion passed", backtrace)
|
198
|
-
end
|
195
|
+
@output.assert(condition, @orientation, message || "assertion passed", backtrace)
|
199
196
|
else
|
200
197
|
@failed << assert
|
201
|
-
|
202
|
-
if @orientation || @verbose
|
203
|
-
@output.assert(condition, @orientation, message || "assertion failed", backtrace)
|
204
|
-
end
|
198
|
+
@output.assert(condition, @orientation, message || "assertion failed", backtrace)
|
205
199
|
end
|
206
200
|
end
|
207
201
|
|
data/lib/sus/be_within.rb
CHANGED
@@ -16,7 +16,7 @@ module Sus
|
|
16
16
|
|
17
17
|
def call(assertions, subject)
|
18
18
|
assertions.nested(self) do |assertions|
|
19
|
-
assertions.assert(@range.include?(subject)
|
19
|
+
assertions.assert(@range.include?(subject))
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -32,7 +32,9 @@ module Sus
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def percent_of(value)
|
35
|
-
|
35
|
+
tolerance = Rational(@tolerance, 100)
|
36
|
+
|
37
|
+
return Bounded.new(Range.new(value - value * tolerance, value + value * tolerance))
|
36
38
|
end
|
37
39
|
|
38
40
|
def print(output)
|
data/lib/sus/have.rb
CHANGED
@@ -21,7 +21,9 @@ module Sus
|
|
21
21
|
def call(assertions, subject)
|
22
22
|
assertions.nested(self) do |assertions|
|
23
23
|
assertions.assert(subject.key?(@name), "has key")
|
24
|
-
@predicate
|
24
|
+
if @predicate
|
25
|
+
Expect.new(assertions, subject[@name]).to(@predicate)
|
26
|
+
end
|
25
27
|
end
|
26
28
|
end
|
27
29
|
end
|
@@ -39,7 +41,9 @@ module Sus
|
|
39
41
|
def call(assertions, subject)
|
40
42
|
assertions.nested(self) do |assertions|
|
41
43
|
assertions.assert(subject.respond_to?(@name), "has attribute")
|
42
|
-
@predicate
|
44
|
+
if @predicate
|
45
|
+
Expect.new(assertions, subject.send(@name)).to(@predicate)
|
46
|
+
end
|
43
47
|
end
|
44
48
|
end
|
45
49
|
end
|
data/lib/sus/have_duration.rb
CHANGED
data/lib/sus/output/backtrace.rb
CHANGED
@@ -15,7 +15,21 @@ 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
|
18
|
+
self.new(extract_stack(exception), identity&.path)
|
19
|
+
end
|
20
|
+
|
21
|
+
Location = Struct.new(:path, :lineno, :label)
|
22
|
+
|
23
|
+
def self.extract_stack(exception)
|
24
|
+
if stack = exception.backtrace_locations
|
25
|
+
return stack
|
26
|
+
elsif stack = exception.backtrace
|
27
|
+
return stack.map do |line|
|
28
|
+
Location.new(*line.split(":", 3))
|
29
|
+
end
|
30
|
+
else
|
31
|
+
[]
|
32
|
+
end
|
19
33
|
end
|
20
34
|
|
21
35
|
def initialize(stack, root = nil, limit = nil)
|
data/lib/sus/version.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.24.0
|
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-11-30 00:00:00.000000000 Z
|
42
42
|
dependencies: []
|
43
43
|
description:
|
44
44
|
email:
|
metadata.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
�
|
2
|
-
|
1
|
+
!�˷w�,���K{���YE���;QE��d�g�i��?qq�w�����!��{|�)+����d엺�t�u6c�2�<}������s�b�sm� �Y���2��);)�{ӾRy�9ᨍZXG$�sv+lGP8�8X��I�N9�䷖�(�[mes����)�U��p�L<�/�����{S�.����d�S[��:؆$8��_�1��0
|
2
|
+
�
|