Sha256: fb95f5ebb143d0e9e9a080c08559e84e35dca69c4b79255a652ffb950f4ce637

Contents?: true

Size: 962 Bytes

Versions: 8

Compression:

Stored size: 962 Bytes

Contents

require 'spec_helper'
require 'wgif/download_bar'

describe WGif::DownloadBar do

  context 'setup' do

    let(:download_bar) { described_class.new }
    let(:mock_progress_bar) { double(ProgressBar) }

    before do
      ProgressBar.stub(:create).and_return(mock_progress_bar)
    end

    it 'creates a ProgressBar with the correct format, smoothing, and size' do
      progress_bar_params = {
        format: '==> %p%% |%B|',
        smoothing: 0.8,
        total: nil
      }
      expect(ProgressBar).to receive(:create).with(progress_bar_params)
      described_class.new
    end

    it 'updates the total size' do
      expect(mock_progress_bar).to receive(:total=).with(500)
      download_bar.update_total(500)
    end

    it 'increments the current progress' do
      expect(mock_progress_bar).to receive(:progress).and_return(1)
      expect(mock_progress_bar).to receive(:progress=)
      download_bar.increment_progress(100)
    end

  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
wgif-0.5.1 spec/unit/wgif/download_bar_spec.rb
wgif-0.5.0 spec/unit/wgif/download_bar_spec.rb
wgif-0.4.0 spec/unit/wgif/download_bar_spec.rb
wgif-0.3.1 spec/unit/wgif/download_bar_spec.rb
wgif-0.3.0 spec/unit/wgif/download_bar_spec.rb
wgif-0.2.0 spec/wgif/download_bar_spec.rb
wgif-0.0.1 spec/wgif/download_bar_spec.rb
wgif-0.0.1.pre spec/wgif/download_bar_spec.rb