Sha256: a8d6c49723b6a9b70dedf373a35666822b5bcb10ec0d49f5b84a7d873e919b43

Contents?: true

Size: 492 Bytes

Versions: 7

Compression:

Stored size: 492 Bytes

Contents

# coding: utf-8

require 'spec_helper'

RSpec.describe TTY::ProgressBar, 'clear' do
  let(:output) { StringIO.new('', 'w+') }

  it "clears progress bar when finished" do
    progress = TTY::ProgressBar.new("[:bar]", output: output, total: 5,
     clear: true)
    5.times { progress.advance }
    output.rewind
    expect(output.read).to eq([
      "\e[1G[=    ]",
      "\e[1G[==   ]",
      "\e[1G[===  ]",
      "\e[1G[==== ]",
      "\e[1G[=====]\e[0m\e[1000D\e[K"
    ].join)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
tty-progressbar-0.8.0 spec/unit/clear_spec.rb
tty-progressbar-0.7.0 spec/unit/clear_spec.rb
tty-progressbar-0.6.0 spec/unit/clear_spec.rb
tty-progressbar-0.5.1 spec/unit/clear_spec.rb
tty-progressbar-0.5.0 spec/unit/clear_spec.rb
tty-progressbar-0.4.0 spec/unit/clear_spec.rb
tty-progressbar-0.3.0 spec/unit/clear_spec.rb