Sha256: 4fc2659ce6cb9b5f2bb53315f60f9c321c4c8df07a6906f5c1564aa7fe5c564e

Contents?: true

Size: 436 Bytes

Versions: 9

Compression:

Stored size: 436 Bytes

Contents

# coding: utf-8

require 'spec_helper'

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

  it "displays percent finished" do
    progress = TTY::ProgressBar.new(":percent", output: output, total: 5)
    5.times { progress.advance }
    output.rewind
    expect(output.read).to eq([
      "\e[1G20%",
      "\e[1G40%",
      "\e[1G60%",
      "\e[1G80%",
      "\e[1G100%\n"
    ].join)
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
tty-progressbar-0.8.0 spec/unit/formatter/percent_spec.rb
tty-progressbar-0.7.0 spec/unit/formatter/percent_spec.rb
tty-progressbar-0.6.0 spec/unit/formatter/percent_spec.rb
tty-progressbar-0.5.1 spec/unit/formatter/percent_spec.rb
tty-progressbar-0.5.0 spec/unit/formatter/percent_spec.rb
tty-progressbar-0.4.0 spec/unit/formatter/percent_spec.rb
tty-progressbar-0.3.0 spec/unit/formatter/percent_spec.rb
tty-progressbar-0.2.0 spec/unit/percent_formatter_spec.rb
tty-progressbar-0.1.0 spec/unit/percent_formatter_spec.rb