Sha256: 775ffd81b7601b22fe9d3b99f966276cc7147c0e3295da91ece1ee7fd23882f4

Contents?: true

Size: 796 Bytes

Versions: 3

Compression:

Stored size: 796 Bytes

Contents

require 'spec_helper'

class ProgressableClass
  include ProgressBar::Components::Progressable
end

describe ProgressBar::Components::Progressable do
  subject { ProgressableClass.new }

  describe '#running_average' do
    it 'is always reset when the progressable is started' do
      subject.running_average = 10
      subject.start :at => 0
      subject.running_average.should be_zero

      subject.start :at => 40
      subject.running_average.should eql 36.0
    end
  end

  describe '#smoothing' do
    it 'can be passed in as an option to the initializer' do
      ProgressableClass.new(:smoothing => 0.3).smoothing.should eql 0.3
    end

    it 'does not have to be passed in as an option to the initializer' do
      ProgressableClass.new.smoothing.should eql 0.1
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-progressbar-1.0.1 spec/progress_bar/components/progressable_spec.rb
ruby-progressbar-1.0.0 spec/progress_bar/components/progressable_spec.rb
ruby-progressbar-1.0.0rc1 spec/progress_bar/components/progressable_spec.rb