Sha256: 58bcd33e51995d46b5d3b476818bab3260f6c9ae90026425a29a000bde5c71be

Contents?: true

Size: 823 Bytes

Versions: 1

Compression:

Stored size: 823 Bytes

Contents

require 'spec_helper'

RSpec.describe Rails::Service::AppConfig do
  let(:path) { 'config/app-config.yaml' }
  let(:logger) { double(:logger) }
  let(:env) { 'test' }
  let(:config) { described_class.new(path: path, logger: logger, env: env) }

  before do
    @root_old = Rails.root
    Rails.application.config.root = File.expand_path('spec/rails_app')
  end

  after do
    Rails.application.config.root = @root_old
  end

  describe 'loading yaml config' do
    before do
      allow(logger).to receive(:info)
    end

    it 'load config by environment' do
      expect(config.barfoo).to eq 'barfoo'
    end

    it 'should inherit defaults' do
      expect(config.foo.bar).to eq 'foobar'
    end

    it 'should overwrite inherited configs' do
      expect(config.foobar).to eq 'foobar-overwritten'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails-service-0.1.0 spec/lib/app_config_spec.rb