Sha256: 6917407c322314a4a048413da9318a3c20335c222e2b8b09e100ce98901e9357

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

module Pacto
  describe Configuration do
    subject(:configuration) { Configuration.new }
    let(:contracts_path) { 'path_to_contracts' }

    it 'sets the stub provider by default to WebMockAdapter' do
      expect(configuration.provider).to be_kind_of Stubs::WebMockAdapter
    end

    it 'sets strict matchers by default to true' do
      expect(configuration.strict_matchers).to be_true
    end

    it 'sets contracts path by default to nil' do
      expect(configuration.contracts_path).to be_nil
    end

    it 'sets logger by default to Logger' do
      expect(configuration.logger).to be_kind_of Logger::SimpleLogger
    end

    context 'about logging' do

      context 'when PACTO_DEBUG is enabled' do
        around do |example|
          ENV['PACTO_DEBUG'] = 'true'
          example.run
          ENV.delete 'PACTO_DEBUG'
        end

        it 'sets the log level to debug' do
          expect(configuration.logger.level).to eq :debug
        end
      end

      context 'when PACTO_DEBUG is disabled' do
        it 'sets the log level to default' do
          expect(configuration.logger.level).to eq :error
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pacto-0.3.1 spec/unit/pacto/configuration_spec.rb