Sha256: 06d9c40441842cbba97675320bcea65a328fc68bc32d28f287172d6ea25a749e

Contents?: true

Size: 942 Bytes

Versions: 28

Compression:

Stored size: 942 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Sinclair::EnvSettable do
  describe '#yard' do
    subject(:settable) { Class.new(MyAppClient) }

    before do
      ENV['MY_APP_USERNAME'] = 'my_login'
    end

    after do
      ENV.delete('MY_APP_USERNAME')
    end

    it 'retrieves username from env' do
      expect(settable.username).to eq('my_login')
    end

    it 'retrieves password from env' do
      expect(settable.password).to be_nil
    end

    context 'when defining defaults' do
      it 'returns default value' do
        expect(settable.host).to eq('my-host.com')
      end

      context 'when setting the env variable' do
        before do
          ENV['MY_APP_HOST'] = 'other-host.com'
        end

        after do
          ENV.delete('MY_APP_HOST')
        end

        it 'retrieves host from env' do
          expect(settable.host).to eq('other-host.com')
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

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