Sha256: 749f03aff22028761b3afbde76f222e16f4b9d4c5f2a20999e0837a25d956d85

Contents?: true

Size: 1.18 KB

Versions: 8

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'
require 'pact/configuration'

module Pact

  describe Configuration do

    subject { Configuration.default_configuration }

    describe "#color_enabled" do

      it "sets color_enabled to be true by default" do
        expect(subject.color_enabled).to be true
      end

      it "allows configuration of colour_enabled" do
        subject.color_enabled = false
        expect(subject.color_enabled).to be false
      end

    end


    describe "#body_differ_for_content_type" do
      context "when the Content-Type is nil" do

        before do
          allow(Pact.configuration.error_stream).to receive(:puts)
        end

        subject { Pact.configuration.body_differ_for_content_type nil }

        it "returns the TextDiffer" do
          expect(subject).to eq Pact::TextDiffer
        end

        it "logs a warning to log file" do
          expect(Pact.configuration.logger).to receive(:warn).with(/No content type found/)
          subject
        end

        it "logs a warning to the error stream" do
          expect(Pact.configuration.error_stream).to receive(:puts).with(/WARN: No content type found/)
          subject
        end

      end
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pact-support-0.5.7 spec/lib/pact/configuration_spec.rb
pact-support-0.5.5 spec/lib/pact/configuration_spec.rb
pact-support-0.5.4 spec/lib/pact/configuration_spec.rb
pact-support-0.5.3 spec/lib/pact/configuration_spec.rb
pact-support-0.5.1 spec/lib/pact/configuration_spec.rb
pact-support-0.5.0 spec/lib/pact/configuration_spec.rb
pact-support-0.4.4 spec/lib/pact/configuration_spec.rb
pact-support-0.4.3 spec/lib/pact/configuration_spec.rb