Sha256: 5468f3f06c6cd7c1e2b82d10cba4c4c100cb6f98ba4463f8f4a8f1cedf804bb5

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Sinclair::Settable do
  context 'when reading from env' do
    subject(:settable) { Class.new(AppClient) }

    let(:username) { 'my_login' }
    let(:password) { Random.rand(10_000).to_s }

    let(:username_key) { 'USERNAME' }
    let(:password_key) { 'PASSWORD' }
    let(:host_key)     { 'HOST' }
    let(:port_key)     { 'PORT' }

    it_behaves_like 'settings reading'

    context 'when defining a prefix' do
      subject(:settable) { Class.new(MyAppClient) }

      let(:username_key) { 'MY_APP_USERNAME' }
      let(:password_key) { 'MY_APP_PASSWORD' }
      let(:host_key)     { 'MY_APP_HOST' }
      let(:port_key)     { 'MY_APP_PORT' }

      it_behaves_like 'settings reading'
    end
  end

  context 'when reading from a hash constant' do
    subject(:settable) { Class.new(HashAppClient) }

    let(:username) { 'my_login' }
    let(:password) { Random.rand(10_000).to_s }

    let(:username_key) { :username }
    let(:password_key) { :password }
    let(:host_key)     { :host }
    let(:port_key)     { :port }

    it_behaves_like 'settings reading' do
      let(:env_hash) { HashAppClient::HASH }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sinclair-2.1.1 spec/lib/sinclair/settable_spec.rb
sinclair-2.1.0 spec/lib/sinclair/settable_spec.rb