<commit_before>require 'rspec'
require 'colored'

require './lib/rudo.rb'

describe Rudo do

  it "should pass a dumb test" do
    r = Rudo.new
    r.class.should == Rudo
  end

  describe "#print" do
    def stars
      '*' * 40
    end

    context "when the color option is set to false" do
      before(:each) do
        file = File.open('spec/fixtures/empty.yml')
        File.stub(:open).and_return(file)
      end

      it "doesn't color highlighted output" do
        r = Rudo.new
        r.should_receive(:puts).with(stars).twice
        r.should_receive(:puts).with('0 tasks remaining')
        r.print({:color => false})
      end
    end

    context "when there are no tasks" do
      before(:each) do
        file =  File.open('spec/fixtures/empty.yml')
        File.stub(:open).and_return(file)
      end

      it "prints two lines of stars and green text '0 tasks remaining'" do
        r = Rudo.new
        r.should_receive(:puts).with(stars).twice
        r.should_receive(:puts).with('0 tasks remaining'.green)
        r.print
      end
    end

    context "when there are two tasks" do
      before(:each) do
        file =  File.open('spec/fixtures/twotasks.yml')
        File.stub(:open).and_return(file)
      end

      it "prints both tasks" do
        r = Rudo.new
        r.should_receive(:puts).with(stars)
        r.should_receive(:puts).with('1: clean gutters')
        r.should_receive(:puts).with('2: do laundry')
        r.should_receive(:puts).with(stars)
        r.should_receive(:puts).with('2 tasks remaining'.green)
        r.print
      end
    end
  end

end<commit_msg>refactoring #print specs<commit_after>require 'rspec'
require 'colored'

require './lib/rudo.rb'

describe Rudo do
  describe '#print' do
    def stars
      '*' * 40
    end

    context 'when the color option is set to false' do
      before(:each) do
        file = File.open('spec/fixtures/empty.yml')
        File.stub(:open).and_return(file)
        @rudo = Rudo.new
      end

      it 'does not color output' do
        @rudo.should_receive(:puts).with(stars).twice
        @rudo.should_receive(:puts).with('0 tasks remaining')
        @rudo.print({:color => false})
      end
    end

    context 'when there are no tasks' do
      before(:each) do
        file =  File.open('spec/fixtures/empty.yml')
        File.stub(:open).and_return(file)
        @rudo = Rudo.new
        @rudo.stub(:puts).with(stars)
        @rudo.stub(:puts).with('0 tasks remaining'.green)
      end

      it 'prints two lines of stars' do
        @rudo.should_receive(:puts).with(stars).twice
        @rudo.print
      end

      it 'prints "0 tasks remaining" in green' do
        @rudo.should_receive(:puts).with('0 tasks remaining'.green)
        @rudo.print
      end
    end

    context 'when there are two tasks' do
      before(:each) do
        file =  File.open('spec/fixtures/twotasks.yml')
        File.stub(:open).and_return(file)
        @rudo = Rudo.new
        @rudo.stub(:puts).with(stars)
        @rudo.stub(:puts).with('1: clean gutters')
        @rudo.stub(:puts).with('2: do laundry')
        @rudo.stub(:puts).with('2 tasks remaining'.green)
      end

      it 'prints both tasks between rows of stars' do
        @rudo.should_receive(:puts).with(stars)
        @rudo.should_receive(:puts).with('1: clean gutters')
        @rudo.should_receive(:puts).with('2: do laundry')
        @rudo.should_receive(:puts).with(stars)
        @rudo.print
      end

      it 'prints the task count in green' do
        @rudo.should_receive(:puts).with('2 tasks remaining'.green)
        @rudo.print
      end
    end
  end

  describe '#add'
  describe '#remove'
  describe '#walk'
end
{'fraction_non_alphanumeric': 0.12835093419983754, 'fraction_numerical': 0.005415651232060655, 'mean_word_length': 2.286476868327402, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1953607', 'n_tokens_mistral': 1258, 'n_tokens_neox': 1207, 'n_words': 289}