Sha256: 25843ec149dd9767cad0cefa48901d02baf689a9ae2f847860095c7f7055509a

Contents?: true

Size: 950 Bytes

Versions: 3

Compression:

Stored size: 950 Bytes

Contents

# frozen_string_literal: true

describe 'Load from self (hash-like __END__ data representation with ERB inserts)' do
  specify 'defines config object by self-contained __END__ yaml data with ERB inserts' do
    class SelfDefinedWithErbConfig < Qonfig::DataSet
      load_from_self
    end

    SelfDefinedWithErbConfig.new.settings.tap do |conf|
      expect(conf.defaults.host).to eq('localhost')
      expect(conf.defaults.user).to eq('0exp')
      expect(conf.defaults.password).to eq('password4')
      expect(conf.defaults.credentials).to eq({})

      expect(conf.staging.host).to eq('yandex.ru')
      expect(conf.staging.user).to eq('0exp')
      expect(conf.staging.password).to eq('password4')
      expect(conf.staging.credentials).to eq({})
    end
  end
end

__END__

defaults: &defaults
  host: localhost
  user: <%= '0exp' %>
  password: <%= "password#{(2 * 2)}" %>
  credentials: <%= {} %>

staging:
  <<: *defaults
  host: yandex.ru

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
qonfig-0.28.0 spec/features/load_from_self/with_erb_instructions_spec.rb
qonfig-0.27.0 spec/features/load_from_self/with_erb_instructions_spec.rb
qonfig-0.26.0 spec/features/load_from_self/with_erb_instructions_spec.rb