ruby-progressbar 1.4.0 → 1.4.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.
@@ -36,13 +36,13 @@ class ProgressBar
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def increment
|
39
|
-
|
39
|
+
warn "WARNING: Your progress bar is currently at #{progress} out of #{total} and cannot be incremented. In v2.0.0 this will become a ProgressBar::InvalidProgressError." if progress == total
|
40
40
|
|
41
41
|
self.progress += 1 unless progress == total
|
42
42
|
end
|
43
43
|
|
44
44
|
def decrement
|
45
|
-
|
45
|
+
warn "WARNING: Your progress bar is currently at #{progress} out of #{total} and cannot be decremented. In v2.0.0 this will become a ProgressBar::InvalidProgressError." if progress == 0
|
46
46
|
|
47
47
|
self.progress -= 1 unless progress == 0
|
48
48
|
end
|
@@ -682,4 +682,26 @@ describe ProgressBar::Base do
|
|
682
682
|
end
|
683
683
|
end
|
684
684
|
end
|
685
|
+
|
686
|
+
context 'when the bar is started after having total set to 0' do
|
687
|
+
let(:progressbar) { ProgressBar::Base.new(:output => output, :autostart => false) }
|
688
|
+
|
689
|
+
it 'does not throw an error' do
|
690
|
+
progressbar.total = 0
|
691
|
+
|
692
|
+
expect { progressbar.start }.not_to raise_error
|
693
|
+
end
|
694
|
+
end
|
695
|
+
|
696
|
+
context 'when the bar has no items to process' do
|
697
|
+
context 'and it has not been started' do
|
698
|
+
let(:progressbar) { ProgressBar::Base.new(:started_at => 0, :total => 0, :autostart => false, :smoothing => 0.0, :format => ' %c/%C |%w>%i| %e ', :output => output) }
|
699
|
+
|
700
|
+
it 'does not throw an error if told to stop' do
|
701
|
+
progressbar.stop
|
702
|
+
|
703
|
+
expect { progressbar.start }.not_to raise_error
|
704
|
+
end
|
705
|
+
end
|
706
|
+
end
|
685
707
|
end
|
@@ -74,5 +74,18 @@ describe ProgressBar::Components::ElapsedTimer do
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
77
|
+
|
78
|
+
context "when the timer has yet to be started" do
|
79
|
+
it 'is false' do
|
80
|
+
@timer.should_not be_stopped
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
context "when the timer is stopped without having been started" do
|
85
|
+
before { @timer.stop }
|
86
|
+
it 'is false' do
|
87
|
+
@timer.should_not be_stopped
|
88
|
+
end
|
89
|
+
end
|
77
90
|
end
|
78
91
|
end
|
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.4.
|
4
|
+
version: 1.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2014-01-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|