ruby-progressbar 1.3.1 → 1.3.2
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.
- data/lib/ruby-progressbar/version.rb +1 -1
- data/spec/lib/ruby-progressbar/base_spec.rb +27 -6
- data/spec/spec_helper.rb +1 -7
- metadata +4 -20
@@ -18,12 +18,18 @@ describe ProgressBar::Base do
|
|
18
18
|
|
19
19
|
context 'when the terminal width is shorter than the string being output' do
|
20
20
|
it 'can properly handle outputting the bar when the length changes on the fly to less than the minimum width' do
|
21
|
-
IO.stub_chain(:console, :winsize).and_return [1, 30]
|
22
21
|
progressbar = ProgressBar::Base.new(:output => output, :title => 'a' * 25, :format => '%t%B', :throttle_rate => 0.0)
|
23
22
|
|
23
|
+
IO.stub_chain(:console, :winsize).and_return [1, 30]
|
24
|
+
allow(progressbar).to receive(:dynamic_width_stty).
|
25
|
+
and_return 30
|
26
|
+
|
24
27
|
progressbar.start
|
25
28
|
|
26
29
|
IO.stub_chain(:console, :winsize).and_return [1, 20]
|
30
|
+
allow(progressbar).to receive(:dynamic_width_stty).
|
31
|
+
and_return 20
|
32
|
+
|
27
33
|
progressbar.increment
|
28
34
|
|
29
35
|
output.rewind
|
@@ -32,8 +38,11 @@ describe ProgressBar::Base do
|
|
32
38
|
|
33
39
|
context 'and the bar length is calculated' do
|
34
40
|
it 'returns the proper string' do
|
41
|
+
progressbar = ProgressBar::Base.new(:output => output, :title => ('*' * 21), :starting_at => 5, :total => 10, :autostart => false)
|
42
|
+
|
35
43
|
IO.stub_chain(:console, :winsize).and_return [1, 20]
|
36
|
-
progressbar
|
44
|
+
allow(progressbar).to receive(:dynamic_width_stty).
|
45
|
+
and_return 20
|
37
46
|
|
38
47
|
progressbar.to_s('%t%w').should eql '*********************'
|
39
48
|
end
|
@@ -41,15 +50,21 @@ describe ProgressBar::Base do
|
|
41
50
|
|
42
51
|
context 'and the incomplete bar length is calculated' do
|
43
52
|
it 'returns the proper string' do
|
53
|
+
progressbar = ProgressBar::Base.new(:output => output, :title => ('*' * 21), :autostart => false)
|
54
|
+
|
44
55
|
IO.stub_chain(:console, :winsize).and_return [1, 20]
|
45
|
-
progressbar
|
56
|
+
allow(progressbar).to receive(:dynamic_width_stty).
|
57
|
+
and_return 20
|
46
58
|
|
47
59
|
progressbar.to_s('%t%i').should eql '*********************'
|
48
60
|
end
|
49
61
|
|
50
62
|
it 'returns the proper string' do
|
63
|
+
progressbar = ProgressBar::Base.new(:output => output, :title => ('*' * 21), :starting_at => 5, :total => 10, :autostart => false)
|
64
|
+
|
51
65
|
IO.stub_chain(:console, :winsize).and_return [1, 20]
|
52
|
-
progressbar
|
66
|
+
allow(progressbar).to receive(:dynamic_width_stty).
|
67
|
+
and_return 20
|
53
68
|
|
54
69
|
progressbar.to_s('%t%i').should eql '*********************'
|
55
70
|
end
|
@@ -57,15 +72,21 @@ describe ProgressBar::Base do
|
|
57
72
|
|
58
73
|
context 'and the full bar length is calculated (but lacks the space to output the entire bar)' do
|
59
74
|
it 'returns the proper string' do
|
75
|
+
progressbar = ProgressBar::Base.new(:output => output, :title => ('*' * 19), :starting_at => 5, :total => 10, :autostart => false)
|
76
|
+
|
60
77
|
IO.stub_chain(:console, :winsize).and_return [1, 20]
|
61
|
-
progressbar
|
78
|
+
allow(progressbar).to receive(:dynamic_width_stty).
|
79
|
+
and_return 20
|
62
80
|
|
63
81
|
progressbar.to_s('%t%B').should eql '******************* '
|
64
82
|
end
|
65
83
|
|
66
84
|
it 'returns the proper string' do
|
85
|
+
progressbar = ProgressBar::Base.new(:output => output, :title => ('*' * 19), :starting_at => 5, :total => 10, :autostart => false)
|
86
|
+
|
67
87
|
IO.stub_chain(:console, :winsize).and_return [1, 20]
|
68
|
-
progressbar
|
88
|
+
allow(progressbar).to receive(:dynamic_width_stty).
|
89
|
+
and_return 20
|
69
90
|
|
70
91
|
progressbar.to_s('%t%w%i').should eql '******************* '
|
71
92
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,12 +1,6 @@
|
|
1
|
-
require 'simplecov'
|
2
|
-
SimpleCov.start do
|
3
|
-
add_filter '/spec/'
|
4
|
-
end
|
5
|
-
|
6
1
|
require 'mathn'
|
7
2
|
require 'rspec'
|
3
|
+
require 'timecop'
|
8
4
|
|
9
5
|
Dir[File.join(File.dirname(__FILE__), '..', 'lib', 'ruby-progressbar.rb')].each {|f| require f}
|
10
6
|
Dir[File.join(File.dirname(__FILE__), '..', 'spec', 'support', '**', '*.rb')].each {|f| require f}
|
11
|
-
|
12
|
-
require 'rspectacular'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-progressbar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -29,13 +29,13 @@ dependencies:
|
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
version: '2.13'
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
|
-
name:
|
32
|
+
name: fuubar
|
33
33
|
requirement: !ruby/object:Gem::Requirement
|
34
34
|
none: false
|
35
35
|
requirements:
|
36
36
|
- - ~>
|
37
37
|
- !ruby/object:Gem::Version
|
38
|
-
version: '
|
38
|
+
version: '1.3'
|
39
39
|
type: :development
|
40
40
|
prerelease: false
|
41
41
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - ~>
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '1.3'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: timecop
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,22 +60,6 @@ dependencies:
|
|
60
60
|
- - ~>
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0.6'
|
63
|
-
- !ruby/object:Gem::Dependency
|
64
|
-
name: simplecov
|
65
|
-
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
|
-
requirements:
|
68
|
-
- - ~>
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: 0.8pre
|
71
|
-
type: :development
|
72
|
-
prerelease: false
|
73
|
-
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
|
-
requirements:
|
76
|
-
- - ~>
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
version: 0.8pre
|
79
63
|
description: ! 'Ruby/ProgressBar is an extremely flexible text progress bar library
|
80
64
|
for Ruby.
|
81
65
|
|