Sha256: c568d462ee689a7673acdf0acf58af45d21e1527c097001792a9ab5648ad87f7

Contents?: true

Size: 1.52 KB

Versions: 36

Compression:

Stored size: 1.52 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Sinclair::Configurable do
  describe '#yard' do
    describe '#configurable_with' do
      before do
        MyConfigurable.configure do
          host 'interstella.com'
          port 5555
        end
      end

      after do
        MyConfigurable.reset_config
      end

      it 'sets right value for config host' do
        expect(MyConfigurable.config.host)
          .to eq('interstella.com')
      end

      it 'sets right value for config port' do
        expect(MyConfigurable.config.port)
          .to eq(5555)
      end

      context 'when reset_config is called' do
        before { MyConfigurable.reset_config }

        it 'returns initial value for host' do
          expect(MyConfigurable.config.host).to be_nil
        end

        it 'returns initial value for port' do
          expect(MyConfigurable.config.port).to eq(80)
        end
      end
    end

    describe '#configurable_by' do
      before do
        Client.configure do
          host 'interstella.com'
        end
      end

      after do
        Client.reset_config
      end

      it 'sets host' do
        expect(Client.config.url)
          .to eq('http://interstella.com')
      end

      context 'when setting the port' do
        before do
          Client.configure do |config|
            config.port 8080
          end
        end

        it 'sets host and port' do
          expect(Client.config.url)
            .to eq('http://interstella.com:8080')
        end
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
sinclair-2.1.1 spec/integration/yard/sinclair/configurable_spec.rb
sinclair-2.1.0 spec/integration/yard/sinclair/configurable_spec.rb
sinclair-2.0.1 spec/integration/yard/sinclair/configurable_spec.rb
sinclair-2.0.0 spec/integration/yard/sinclair/configurable_spec.rb
sinclair-1.16.3 spec/integration/yard/sinclair/configurable_spec.rb
sinclair-1.16.2 spec/integration/yard/sinclair/configurable_spec.rb
sinclair-1.16.1 spec/integration/yard/sinclair/configurable_spec.rb
sinclair-1.16.0 spec/integration/yard/sinclair/configurable_spec.rb
sinclair-1.15.0 spec/integration/yard/sinclair/configurable_spec.rb
sinclair-1.14.2 spec/integration/yard/sinclair/configurable_spec.rb
sinclair-1.14.1 spec/integration/yard/sinclair/configurable_spec.rb
sinclair-1.14.0 spec/integration/yard/sinclair/configurable_spec.rb
sinclair-1.13.0 spec/integration/yard/sinclair/configurable_spec.rb
sinclair-1.12.1 spec/integration/yard/sinclair/configurable_spec.rb
sinclair-1.12.0 spec/integration/yard/sinclair/configurable_spec.rb
sinclair-1.11.0 spec/integration/yard/sinclair/configurable_spec.rb
sinclair-1.10.0 spec/integration/yard/sinclair/configurable_spec.rb
sinclair-1.9.0 spec/integration/yard/sinclair/configurable_spec.rb
sinclair-1.8.0 spec/integration/yard/sinclair/configurable_spec.rb
sinclair-1.7.0 spec/integration/yard/sinclair/configurable_spec.rb