Sha256: 431281edc62e3e38e2212fe2cff3b414057c6c299e6b12ed81af81581d7e3c81

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

require "spec_helper"
require "teabag/formatters/base_formatter"
require "teabag/result"

describe Teabag::Formatters::BaseFormatter do

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

  describe "#result" do

    it "calls log_coverage" do
      subject.should_receive(:log_coverage).with("_coverage_")
      subject.result("coverage" => "_coverage_")
    end

  end

  describe "#log_coverage" do

    it "logs the coverage information" do
      mock = mock(reports: nil)
      Teabag::Coverage.should_receive(:new).with("_data_").and_return(mock)
      mock.should_receive(:reports).and_return("_reports_")
      STDOUT.should_receive(:print).with("_reports_")
      subject.send(:log_coverage, "_data_")
    end

    it "doesn't log if there's no data" do
      Teabag::Coverage.should_not_receive(:new)
      subject.send(:log_coverage, {})
    end

    it "doesn't log when suppressing logs" do
      subject.should_receive(:suppress_logs?).and_return(true)
      Teabag::Coverage.should_not_receive(:new)
      subject.send(:log_coverage, "_data_")
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
teabag-0.7.3 spec/teabag/formatters/base_formatter_spec.rb
teabag-0.7.2 spec/teabag/formatters/base_formatter_spec.rb
teabag-0.7.1 spec/teabag/formatters/base_formatter_spec.rb