Sha256: da0b84fc7f5b2adc9c8158b68d9829c6ef7cfe5f5c3fb885cf45ded53c16ec34

Contents?: true

Size: 922 Bytes

Versions: 5

Compression:

Stored size: 922 Bytes

Contents

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

5 entries across 5 versions & 1 rubygems

Version Path
proxy_pac_rb-0.9.1 spec/support/shared_examples/configuration.rb
proxy_pac_rb-0.8.2 spec/support/shared_examples/configuration.rb
proxy_pac_rb-0.8.1 spec/support/shared_examples/configuration.rb
proxy_pac_rb-0.8.0 spec/support/shared_examples/configuration.rb
proxy_pac_rb-0.7.0 spec/support/shared_examples/configuration.rb