Sha256: 236b3c17444f6f3afec6bc8f82203f3c47c59e05753ee2bdb625169b726cf2da

Contents?: true

Size: 974 Bytes

Versions: 2

Compression:

Stored size: 974 Bytes

Contents

require "spec_helper"

describe Teaspoon::Formatters::PrideFormatter do

  let(:passing_spec) { double(passing?: true) }
  let(:pending_spec) { double(passing?: false, pending?: true) }
  let(:failing_spec) { double(passing?: false, pending?: false) }

  before do
    @log = ""
    allow(STDOUT).to receive(:print) { |s| @log << s }
  end

  describe "#spec" do

    it "logs a colorful . on passing results" do
      subject.spec(passing_spec)
      subject.spec(passing_spec)
      subject.spec(passing_spec)
      subject.spec(passing_spec)
      subject.spec(passing_spec)
      expect(@log).to eq("\e[38;5;154m.\e[0m\e[38;5;154m.\e[0m\e[38;5;148m.\e[0m\e[38;5;184m.\e[0m\e[38;5;184m.\e[0m")
    end

    it "logs a yellow * on pending results" do
      subject.spec(pending_spec)
      expect(@log).to eq("\e[33m*\e[0m")
    end

    it "logs a red F on failing results" do
      subject.spec(failing_spec)
      expect(@log).to eq("\e[31mF\e[0m")
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
teaspoon-0.9.1 spec/teaspoon/formatters/pride_formatter_spec.rb
teaspoon-0.9.0 spec/teaspoon/formatters/pride_formatter_spec.rb