Sha256: 6463801e9d293b424157ee70045f30337836cc131f132011c564ca2074cccaca

Contents?: true

Size: 443 Bytes

Versions: 4

Compression:

Stored size: 443 Bytes

Contents

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

  it "allows to specify custom tokens" do
    progress = TTY::ProgressBar.new("(:current) :title", output: output, total: 4)
    progress.advance(title: 'Hello Piotr!')
    progress.advance(3, title: 'Bye Piotr!')
    output.rewind
    expect(output.read).to eq([
      "\e[1G(1) Hello Piotr!",
      "\e[1G(4) Bye Piotr!  \n"
    ].join)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tty-progressbar-0.17.0 spec/unit/custom_token_spec.rb
tty-progressbar-0.16.0 spec/unit/custom_token_spec.rb
tty-progressbar-0.15.1 spec/unit/custom_token_spec.rb
tty-progressbar-0.15.0 spec/unit/custom_token_spec.rb