Sha256: ccce4f91516a23f08ca71331056869f428403931eac7cda23c9d5f85819d4a1b

Contents?: true

Size: 734 Bytes

Versions: 8

Compression:

Stored size: 734 Bytes

Contents

# coding: utf-8

require 'spec_helper'

RSpec.describe TTY::ProgressBar::Pipeline, '.decorate' do
  subject(:pipeline) { described_class.new }

  it "decorates tokenized string with pipeline formatters" do
    pipeline.use TTY::ProgressBar::CurrentFormatter
    pipeline.use TTY::ProgressBar::TotalFormatter
    progress_bar = double(current: '3', total: '10')
    tokenized = "[:current/:total]"
    expect(pipeline.decorate(progress_bar, tokenized)).to eq("[3/10]")
  end

  it "enumerates pipeline formatters" do
    pipeline.use TTY::ProgressBar::CurrentFormatter
    pipeline.use TTY::ProgressBar::TotalFormatter
    yielded = []
    pipeline.each { |formatter| yielded << formatter }
    expect(yielded.size).to eq(2)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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