spec/lib/ruby-progressbar/base_spec.rb in ruby-progressbar-1.4.0 vs spec/lib/ruby-progressbar/base_spec.rb in ruby-progressbar-1.4.1
- old
+ new
@@ -680,6 +680,28 @@
progressbar.to_s('%f').should match /^ ETA: 100:00:00\z/
end
end
end
end
+
+ context 'when the bar is started after having total set to 0' do
+ let(:progressbar) { ProgressBar::Base.new(:output => output, :autostart => false) }
+
+ it 'does not throw an error' do
+ progressbar.total = 0
+
+ expect { progressbar.start }.not_to raise_error
+ end
+ end
+
+ context 'when the bar has no items to process' do
+ context 'and it has not been started' do
+ let(:progressbar) { ProgressBar::Base.new(:started_at => 0, :total => 0, :autostart => false, :smoothing => 0.0, :format => ' %c/%C |%w>%i| %e ', :output => output) }
+
+ it 'does not throw an error if told to stop' do
+ progressbar.stop
+
+ expect { progressbar.start }.not_to raise_error
+ end
+ end
+ end
end