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

- old
+ new

@@ -1,39 +1,41 @@ -require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper')) +# frozen_string_literal: true -describe 'ProgressBar bar output' do +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +describe "ProgressBar bar output" do let(:max) { 100 } let(:terminal_width) { 12 } let(:progress_bar) { ProgressBar.new(max, :bar) } before do - progress_bar.stub(:terminal_width) { terminal_width } + allow(progress_bar).to receive(:terminal_width).and_return(terminal_width) progress_bar.count = count end subject { progress_bar.to_s } - describe 'at count=0' do + describe "at count=0" do let(:count) { 0 } it { should == "[ ]" } end - describe 'at count=50' do + describe "at count=50" do let(:count) { 50 } it { should == "[##### ]" } end - describe 'at count=100' do + describe "at count=100" do let(:count) { 100 } it { should == "[##########]" } end - describe 'at count=25 (non-integer divide, should round down)' do + describe "at count=25 (non-integer divide, should round down)" do let(:count) { 25 } it { should == "[## ]" } end @@ -48,8 +50,6 @@ progress_bar.count = i expect( progress_bar.to_s.length ).to eq(80) end end end - end -