sus 0.22.2 → 0.23.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c70a977a33735903d76e45646448e680ad8c296d5a78b82c8cb06d597f79764b
4
- data.tar.gz: 724ed6df638cc6871340b0f716f1a30f5c02952fb915889f31666c56f03d3c7d
3
+ metadata.gz: d9e2b0cb3a0b9f4a5c3f32729a13f5f29935108f5a3606afe3a6189d1c58e2ed
4
+ data.tar.gz: a7a637715ff6a75f6bb6d1bd1bf2e536c1211c5eb304c7ea045797d68ab9d90b
5
5
  SHA512:
6
- metadata.gz: 74683ea93689e366705fa06bd54f179901fe6b6c275c8898c5e4def4efba00f27f6bc0d4ec1931546efadaa0478a47a1a19c16f6a8635f3859eee340a05d2383
7
- data.tar.gz: dc51defc2fd29cd488037fae3411ccddd93c58d9a124264ba03bb4369253aec2721ea4f3b62c863ff853a83d7a250aec6c22e3daa4d68baeb69d211b27c408b1
6
+ metadata.gz: a7ba7d839d58bd10e22cb331685f5c5d3428227f36151d19a0c40a80362f5b7e71d3a063d80258df5bb6e7cb3f21755e43ebfca7c455541a73deb83172a35590
7
+ data.tar.gz: 3c77ddc24a627492904209fe84b4b4ca93c03c368b63607306fe4d9a58c8e41b99dabf580579dbbac31e61afcaec8f5cc91f834aa26bc4f15e80bf5ba08e92a5
checksums.yaml.gz.sig CHANGED
Binary file
@@ -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), 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
- of(value * Rational(@tolerance, 100))
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&.call(assertions, subject[@name])
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&.call(assertions, subject.send(@name))
44
+ if @predicate
45
+ Expect.new(assertions, subject.send(@name)).to(@predicate)
46
+ end
43
47
  end
44
48
  end
45
49
  end
@@ -16,9 +16,7 @@ module Sus
16
16
 
17
17
  def call(assertions, subject)
18
18
  assertions.nested(self) do |assertions|
19
- duration = measure(subject)
20
-
21
- @predicate.call(assertions, duration)
19
+ Expect.new(assertions, measure(subject)).to(@predicate)
22
20
  end
23
21
  end
24
22
 
data/lib/sus/version.rb CHANGED
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2021-2023, by Samuel Williams.
5
5
 
6
6
  module Sus
7
- VERSION = "0.22.2"
7
+ VERSION = "0.23.0"
8
8
  end
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.22.2
4
+ version: 0.23.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-08-01 00:00:00.000000000 Z
41
+ date: 2023-08-22 00:00:00.000000000 Z
42
42
  dependencies: []
43
43
  description:
44
44
  email:
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
123
  requirements: []
124
- rubygems_version: 3.4.10
124
+ rubygems_version: 3.4.7
125
125
  signing_key:
126
126
  specification_version: 4
127
127
  summary: A fast and scalable test runner.
metadata.gz.sig CHANGED
Binary file