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

- old
+ new

@@ -1,50 +1,45 @@ -require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper')) +# frozen_string_literal: true -describe 'ProgressBar counter output' do - before do - @progress_bar = ProgressBar.new(100, :counter) - end +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) - subject { @progress_bar.to_s } +describe "ProgressBar counter output" do + let(:progress_bar) { ProgressBar.new(100, :counter) } - describe 'at count=0' do + subject { progress_bar.to_s } + + describe "at count=0" do before do - @progress_bar.count = 0 + progress_bar.count = 0 end it { should == "[ 0/100]" } end - describe 'at count=50' do + describe "at count=50" do before do - @progress_bar.count = 50 + progress_bar.count = 50 end it { should == "[ 50/100]" } end - describe 'at count=100' do + describe "at count=100" do before do - @progress_bar.count = 100 + progress_bar.count = 100 end it { should == "[100/100]" } end - describe 'with a shorter max' do - before do - @progress_bar = ProgressBar.new(42, :counter) - end + describe "with a shorter max" do + let(:progress_bar) { ProgressBar.new(42, :counter) } - it { should == '[ 0/42]' } + it { should == "[ 0/42]" } end - describe 'with a longer max' do - before do - @progress_bar = ProgressBar.new(4242, :counter) - end + describe "with a longer max" do + let(:progress_bar) { ProgressBar.new(4242, :counter) } - it { should == '[ 0/4242]' } + it { should == "[ 0/4242]" } end - end