Sha256: 9c6acf91783bfe4fef5fd7096dd879c911d5eb5c21fb3a92b18d5b4a1c407491

Contents?: true

Size: 952 Bytes

Versions: 4

Compression:

Stored size: 952 Bytes

Contents

# frozen_string_literal: true
RSpec.shared_examples 'a basic configuration' do
  subject(:config) do
    Class.new(described_class) do
      option :use_test, contract: { Contracts::Bool => Contracts::Bool }, default: false
    end.new
  end

  it { expect(config).not_to be_nil }

  describe 'option?' do
    let(:name) { :use_test }

    context 'when valid option' do
      it { expect(name).to be_valid_option }
    end

    context 'when invalid_option' do
      let(:name) { :blub }
      it { expect(name).not_to be_valid_option }
    end
  end

  describe 'set_if_option' do
    let(:name) { :use_test }
    let(:value) { true }

    context 'when valid option' do
      before(:each) { config.set_if_option(name, value) }
      it { expect(name).to have_option_value true }
    end

    context 'when invalid_option' do
      let(:name) { :blub }

      it { expect { config.set_if_option(name, value) }.not_to raise_error }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
proxy_pac_rb-3.0.0 spec/support/shared_examples/configuration.rb
proxy_pac_rb-2.1.0 spec/support/shared_examples/configuration.rb
proxy_pac_rb-2.0.0 spec/support/shared_examples/configuration.rb
proxy_pac_rb-1.0.0 spec/support/shared_examples/configuration.rb