sus 0.6.2 → 0.8.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.
metadata CHANGED
@@ -1,14 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain: []
11
- date: 2022-01-06 00:00:00.000000000 Z
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11
14
+ ZWwud2lsbGlhbXMxHTAbBgoJkiaJk/IsZAEZFg1vcmlvbnRyYW5zZmVyMRIwEAYK
15
+ CZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJuejAeFw0yMjA4MDYwNDUz
16
+ MjRaFw0zMjA4MDMwNDUzMjRaMGExGDAWBgNVBAMMD3NhbXVlbC53aWxsaWFtczEd
17
+ MBsGCgmSJomT8ixkARkWDW9yaW9udHJhbnNmZXIxEjAQBgoJkiaJk/IsZAEZFgJj
18
+ bzESMBAGCgmSJomT8ixkARkWAm56MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB
19
+ igKCAYEAomvSopQXQ24+9DBB6I6jxRI2auu3VVb4nOjmmHq7XWM4u3HL+pni63X2
20
+ 9qZdoq9xt7H+RPbwL28LDpDNflYQXoOhoVhQ37Pjn9YDjl8/4/9xa9+NUpl9XDIW
21
+ sGkaOY0eqsQm1pEWkHJr3zn/fxoKPZPfaJOglovdxf7dgsHz67Xgd/ka+Wo1YqoE
22
+ e5AUKRwUuvaUaumAKgPH+4E4oiLXI4T1Ff5Q7xxv6yXvHuYtlMHhYfgNn8iiW8WN
23
+ XibYXPNP7NtieSQqwR/xM6IRSoyXKuS+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39
+ -----END CERTIFICATE-----
40
+ date: 2022-08-18 00:00:00.000000000 Z
12
41
  dependencies: []
13
42
  description:
14
43
  email:
@@ -25,6 +54,8 @@ files:
25
54
  - lib/sus/base.rb
26
55
  - lib/sus/be.rb
27
56
  - lib/sus/be_within.rb
57
+ - lib/sus/clock.rb
58
+ - lib/sus/config.rb
28
59
  - lib/sus/context.rb
29
60
  - lib/sus/describe.rb
30
61
  - lib/sus/expect.rb
@@ -36,17 +67,20 @@ files:
36
67
  - lib/sus/it.rb
37
68
  - lib/sus/it_behaves_like.rb
38
69
  - lib/sus/let.rb
70
+ - lib/sus/mock.rb
39
71
  - lib/sus/output.rb
40
72
  - lib/sus/output/bar.rb
41
73
  - lib/sus/output/buffered.rb
42
74
  - lib/sus/output/lines.rb
43
75
  - lib/sus/output/null.rb
76
+ - lib/sus/output/progress.rb
44
77
  - lib/sus/output/status.rb
45
78
  - lib/sus/output/text.rb
46
79
  - lib/sus/output/xterm.rb
47
- - lib/sus/progress.rb
48
80
  - lib/sus/raise_exception.rb
81
+ - lib/sus/receive.rb
49
82
  - lib/sus/registry.rb
83
+ - lib/sus/respond_to.rb
50
84
  - lib/sus/shared.rb
51
85
  - lib/sus/version.rb
52
86
  - lib/sus/with.rb
@@ -70,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
104
  - !ruby/object:Gem::Version
71
105
  version: '0'
72
106
  requirements: []
73
- rubygems_version: 3.1.6
107
+ rubygems_version: 3.3.7
74
108
  signing_key:
75
109
  specification_version: 4
76
110
  summary: A fast and scalable test runner.
metadata.gz.sig ADDED
Binary file
data/lib/sus/progress.rb DELETED
@@ -1,144 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
- #
5
- # Permission is hereby granted, free of charge, to any person obtaining a copy
6
- # of this software and associated documentation files (the "Software"), to deal
7
- # in the Software without restriction, including without limitation the rights
8
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- # copies of the Software, and to permit persons to whom the Software is
10
- # furnished to do so, subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be included in
13
- # all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- # THE SOFTWARE.
22
-
23
- require_relative 'output/bar'
24
- require_relative 'output/status'
25
- require_relative 'output/lines'
26
-
27
- module Sus
28
- class Progress
29
- def self.now
30
- ::Process.clock_gettime(Process::CLOCK_MONOTONIC)
31
- end
32
-
33
- def initialize(output, total = 0, minimum_output_duration: 1.0)
34
- @output = output
35
- @subject = subject
36
-
37
- @start_time = Progress.now
38
-
39
- if @output.interactive?
40
- @bar = Output::Bar.new
41
- @lines = Output::Lines.new(@output)
42
- @lines[0] = @bar
43
- end
44
-
45
- @current = 0
46
- @total = total
47
- end
48
-
49
- attr :subject
50
- attr :current
51
- attr :total
52
-
53
- def duration
54
- Progress.now - @start_time
55
- end
56
-
57
- def progress
58
- @current.to_f / @total.to_f
59
- end
60
-
61
- def remaining
62
- @total - @current
63
- end
64
-
65
- def average_duration
66
- if @current > 0
67
- duration / @current
68
- end
69
- end
70
-
71
- def estimated_remaining_time
72
- if average_duration = self.average_duration
73
- average_duration * remaining
74
- end
75
- end
76
-
77
- # Increase the amont of work done.
78
- def increment(amount = 1)
79
- @current += amount
80
-
81
- @bar&.update(@current, @total, self.to_s)
82
- @lines&.redraw(0)
83
-
84
- return self
85
- end
86
-
87
- # Increase the total size of the progress.
88
- def expand(amount = 1)
89
- @total += amount
90
-
91
- @bar&.update(@current, @total, self.to_s)
92
- @lines&.redraw(0)
93
-
94
- return self
95
- end
96
-
97
- def report(index, context, state)
98
- @lines&.[]=(index+1, Output::Status.new(state, context))
99
-
100
- return self
101
- end
102
-
103
- def clear
104
- @lines&.clear
105
- end
106
-
107
- def to_s
108
- if estimated_remaining_time = self.estimated_remaining_time
109
- "#{@current}/#{@total} completed in #{formatted_duration(self.duration)}, #{formatted_duration(estimated_remaining_time)} remaining"
110
- else
111
- "#{@current}/#{@total} completed"
112
- end
113
- end
114
-
115
- private
116
-
117
- def formatted_duration(duration)
118
- seconds = duration.floor
119
-
120
- if seconds < 60.0
121
- return "#{seconds}s"
122
- end
123
-
124
- minutes = (duration / 60.0).floor
125
- seconds = (seconds - (minutes * 60)).round
126
-
127
- if minutes < 60.0
128
- return "#{minutes}m#{seconds}s"
129
- end
130
-
131
- hours = (minutes / 60.0).floor
132
- minutes = (minutes - (hours * 60)).round
133
-
134
- if hours < 24.0
135
- return "#{hours}h#{minutes}m"
136
- end
137
-
138
- days = (hours / 24.0).floor
139
- hours = (hours - (days * 24)).round
140
-
141
- return "#{days}d#{hours}h"
142
- end
143
- end
144
- end