test/test_progress_bar.rb in rubikon-0.4.1 vs test/test_progress_bar.rb in rubikon-0.5.0

- old
+ new

@@ -98,8 +98,26 @@ assert_equal ("#" * 100) << "\n", ostream.string assert_equal 100, @bar.instance_variable_get(:@progress) assert_equal 101, @bar.instance_variable_get(:@value) end + should 'have brackets when enabled' do + ostream = StringIO.new + options = { + :brackets => true, + :bracket_filler => '-', + :ostream => ostream + } + + @bar = ProgressBar.new options + assert_equal '[' + '-' * 20 + ']' + "\b" * 21, ostream.string + + @bar + 50 + assert_equal '[' + '-' * 20 + ']' + "\b" * 21 + '#' * 10, ostream.string + + @bar + 50 + assert_equal '[' + '-' * 20 + ']' + "\b" * 21 + '#' * 20 + "\n", ostream.string + end + end end