Sha256: f394f437b819cb597b4087726ff3bd52534c399ed224434185febacccd6a3ba2

Contents?: true

Size: 844 Bytes

Versions: 28

Compression:

Stored size: 844 Bytes

Contents

# frozen_string_literal: true

require 'spec_helper'

describe Sinclair::EnvSettable::Builder do
  subject(:settable) { Class.new }

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

  let(:builder) do
    described_class.new(settable, prefix, :username, :password, host: 'my-host.com')
  end

  before { builder.build }

  context 'when not using prefix' do
    let(:prefix) { nil }

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

    it_behaves_like 'settings reading from env'
  end

  context 'when defining a prefix' do
    let(:prefix)       { 'MY_APP' }
    let(:username_key) { 'MY_APP_USERNAME' }
    let(:password_key) { 'MY_APP_PASSWORD' }
    let(:host_key)     { 'MY_APP_HOST' }

    it_behaves_like 'settings reading from env'
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
sinclair-1.6.5 spec/lib/sinclair/env_settable/builder_spec.rb
sinclair-1.6.4 spec/lib/sinclair/env_settable/builder_spec.rb
sinclair-1.6.3 spec/lib/sinclair/env_settable/builder_spec.rb
sinclair-1.6.2 spec/lib/sinclair/env_settable/builder_spec.rb
sinclair-1.6.1 spec/lib/sinclair/env_settable/builder_spec.rb
sinclair-1.6.0 spec/lib/sinclair/env_settable/builder_spec.rb
sinclair-1.5.2 spec/lib/sinclair/env_settable/builder_spec.rb
sinclair-1.5.1 spec/lib/sinclair/env_settable/builder_spec.rb