Sha256: 1da548f44c9c24206fcddec53d728b93a01607ad439b17b710a830239b01b3a4

Contents?: true

Size: 632 Bytes

Versions: 6

Compression:

Stored size: 632 Bytes

Contents

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

  before { Timecop.safe_mode = false }

  it "displays elapsed time" do
    time_now = Time.local(2014, 10, 5, 12, 0, 0)
    Timecop.freeze(time_now)
    progress = TTY::ProgressBar.new(":eta", output: output, total: 5)

    5.times do |sec|
      time_now = Time.local(2014, 10, 5, 12, 0, sec)
      Timecop.freeze(time_now)
      progress.advance
    end

    output.rewind
    expect(output.read).to eq([
      "\e[1G 0s",
      "\e[1G 1s",
      "\e[1G 1s",
      "\e[1G 0s",
      "\e[1G 0s\n"
    ].join)
    Timecop.return
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tty-progressbar-0.17.0 spec/unit/formatter/estimated_spec.rb
tty-progressbar-0.16.0 spec/unit/formatter/estimated_spec.rb
tty-progressbar-0.15.1 spec/unit/formatter/estimated_spec.rb
tty-progressbar-0.15.0 spec/unit/formatter/estimated_spec.rb
tty-progressbar-0.14.0 spec/unit/formatter/estimated_spec.rb
tty-progressbar-0.13.0 spec/unit/formatter/estimated_spec.rb