spec/eta_spec.rb in progress_bar-1.3.1 vs spec/eta_spec.rb in progress_bar-1.3.2

- old
+ new

@@ -1,50 +1,51 @@ -require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper')) +# frozen_string_literal: true -describe 'ProgressBar eta output' do +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +describe "ProgressBar eta output" do + let(:progress_bar) { ProgressBar.new(100, :eta) } + before do Timecop.freeze Time.utc(2010, 3, 10, 0, 0, 0) - @progress_bar = ProgressBar.new(100, :eta) + progress_bar Timecop.freeze Time.utc(2010, 3, 10, 0, 0, 10) # 10 seconds later end - subject { @progress_bar.to_s } + subject { progress_bar.to_s } - describe 'at count=0' do + describe "at count=0" do before do - @progress_bar.count = 0 + progress_bar.count = 0 end it { should == "[00:00]" } end - describe 'at count=50' do + describe "at count=50" do before do - @progress_bar.count = 50 + progress_bar.count = 50 end it { should == "[00:10]" } end - describe 'at count=100' do + describe "at count=100" do before do - @progress_bar.count = 100 + progress_bar.count = 100 end it { should == "[00:00]" } end - describe 'with times over 1 hour' do + describe "with times over 1 hour" do + let(:progress_bar) { ProgressBar.new(42, :eta) } + before do Timecop.freeze Time.utc(2010, 3, 10, 0, 0, 0) - @progress_bar = ProgressBar.new(42, :eta) - @progress_bar.count = 21 + progress_bar.count = 21 Timecop.freeze Time.utc(2010, 3, 10, 2, 0, 0) # 2 hours later end - it { should == '[02:00:00]' } + it { should == "[02:00:00]" } end - end - - -