Sha256: b69e90b0da23e564c3ebe15c0e28db5981e3fdec5da8f16ecac0c7d9077b5e34

Contents?: true

Size: 996 Bytes

Versions: 2

Compression:

Stored size: 996 Bytes

Contents

# frozen_string_literal: true
require 'spec_helper'

describe LinkChecker::Config do
  describe '#configure' do
    context 'methods' do
      before do
        LinkChecker.configure do |config|
          config.methods = %w[GET]
        end
      end

      it 'sets methods' do
        expect(LinkChecker.config.methods).to eq %w[GET]
      end
    end

    context 'retries' do
      it 'requires a positive integer' do
        expect { LinkChecker.config.retries = -1 }.to raise_error ArgumentError, 'Invalid number of retries: -1'
      end
    end
  end

  describe 'defaults' do
    it 'sets methods' do
      expect(LinkChecker.config.methods).to eq %w[HEAD GET]
    end
    it 'sets user agent' do
        expect(LinkChecker.config.user_agent).to eq "Ruby Link Checker/#{LinkChecker::VERSION}"
    end
    it 'does not set logger' do
        expect(LinkChecker.config.logger).to be nil
    end
    it 'sets retries' do
      expect(LinkChecker.config.retries).to eq 0
    end
  end  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-link-checker-0.2.0 spec/ruby-link-checker/config_spec.rb
ruby-link-checker-0.1.0 spec/ruby-link-checker/config_spec.rb