Sha256: 2e0f09f7f8fa27df55cb9944b1d81ad819dc4010c3710ef3eb400d6b8e78e451

Contents?: true

Size: 1.49 KB

Versions: 2

Compression:

Stored size: 1.49 KB

Contents

require "spec_helper"

describe Teaspoon::Formatters::JsonFormatter do

  let(:hash) { {original_json: "_original_json_"} }
  let(:result) { double(hash) }

  describe "#runner" do

    let(:result) { double(hash.merge(total: 42)) }

    it "logs the original json" do
      expect(subject).to receive(:log_result).with(result)
      subject.runner(result)
    end

  end

  describe "#suite" do

    it "logs the original json" do
      expect(subject).to receive(:log_result).with(result)
      subject.suite(result)
    end

  end

  describe "#spec" do

    let(:result) { double(hash.merge(passing?: true)) }

    it "logs the original json" do
      expect(subject).to receive(:log_result).with(result)
      subject.spec(result)
    end

  end

  describe "#error" do

    it "logs the original json" do
      expect(subject).to receive(:log_result).with(result)
      subject.error(result)
    end

  end

  describe "#exception" do

    it "logs the original json" do
      expect(subject).to receive(:log_result).with(result)
      subject.exception(result)
    end

  end

  describe "#console" do

    it "logs the message as json" do
      expect(subject).to receive(:log_line).with(%Q{{"type":"console","log":"_message_"}})
      subject.console("_message_")
    end

  end

  describe "#result" do

    let(:result) { double(hash.merge(coverage: nil)) }

    it "logs the original json" do
      expect(subject).to receive(:log_str).with("_original_json_")
      subject.result(result)
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

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