test/test.rb in progressbar_zobar-0.9.2.1 vs test/test.rb in progressbar_zobar-0.21.0.1
- old
+ new
@@ -2,12 +2,12 @@
require 'progressbar'
class ProgressBarTest < Test::Unit::TestCase
SleepUnit = 0.01
- def do_make_progress_bar (title, total)
- ProgressBar.new(title, total)
+ def do_make_progress_bar(title, total, &block)
+ ProgressBar.new(title, total, &block)
end
def test_bytes
total = 1024 * 1024
pbar = do_make_progress_bar("test(bytes)", total)
@@ -126,12 +126,22 @@
sleep(SleepUnit)
pbar.inc
}
pbar.finish
end
+
+ def test_with_block
+ total = 100
+ do_make_progress_bar("test(block)", total) do |pbar|
+ total.times {
+ sleep(SleepUnit)
+ pbar.inc
+ }
+ end
+ end
end
class ReversedProgressBarTest < ProgressBarTest
- def do_make_progress_bar (title, total)
- ReversedProgressBar.new(title, total)
+ def do_make_progress_bar(title, total, &block)
+ ReversedProgressBar.new(title, total, &block)
end
end