From 1ef8175dd0bd6ef57badd726c612dd768a1a9145 Mon Sep 17 00:00:00 2001 From: Jeff Felchner Date: Sat, 4 Aug 2012 02:46:40 -0500 Subject: [PATCH] Because we're using the formatters, we no longer have to manually update the counts after each increment Conflicts: spec/fuubar_spec.rb --- lib/fuubar.rb | 5 +---- spec/fuubar_spec.rb | 13 ++----------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/lib/fuubar.rb b/lib/fuubar.rb index c42a9c6..2286897 100644 --- a/lib/fuubar.rb +++ b/lib/fuubar.rb @@ -4,18 +4,15 @@ class Fuubar < RSpec::Core::Formatters::BaseTextFormatter - attr_reader :example_count, :finished_count + attr_reader :example_count def start(example_count) @example_count = example_count - @finished_count = 0 @progress_bar = ProgressBar.create(:format => ' %c/%C |%w>%i| %e ', :total => example_count, :output => output) end def increment with_color do - @finished_count += 1 - @progress_bar.title = " #{finished_count}/#{example_count}" @progress_bar.increment end end diff --git a/spec/fuubar_spec.rb b/spec/fuubar_spec.rb index 6621225..f08bb67 100644 --- a/spec/fuubar_spec.rb +++ b/spec/fuubar_spec.rb @@ -37,10 +37,6 @@ formatter.instance_variable_get(:@example_count).should == 2 end - it 'should set the finished_count to 0' do - formatter.instance_variable_get(:@finished_count).should == 0 - end - it 'should set the bar mark to =' do progress_bar.instance_variable_get(:@bar).progress_mark.should == '=' end @@ -114,20 +110,15 @@ formatter.increment end - it 'should change the progress bar title' do + pending 'should change the progress bar title' do formatter.stub!(:finished_count).and_return(1) formatter.stub!(:example_count).and_return(2) formatter.increment progress_bar.instance_variable_get(:@title).should == ' 1/2' end - it 'should increment the finished_count' do - lambda { formatter.increment }.should change(formatter, :finished_count).by(1) - end - it 'should increment the progress bar before updating the title' do - progress_bar.should_receive(:title=).ordered - progress_bar.should_receive(:increment).ordered + progress_bar.should_receive(:increment) formatter.increment end