Sha256: 289ba53048d6a979c98444123ec52476c3e9cb679d639c235426b64af2c84d5b
Contents?: true
Size: 839 Bytes
Versions: 1
Compression:
Stored size: 839 Bytes
Contents
require 'spec_helper' RSpec.describe Idxprb::Configurator do subject { Idxprb::Configurator.new('config_key') } context 'when running in production' do before do ENV['PRODUCTION'] = 'true' expect_any_instance_of(Diplomat::Kv) .to receive(:get) .with('config_key') .and_return('{"config_from":"consul"}') end it 'loads the config from consul' do expect(subject.configs).to eq('config_from' => 'consul') end end context 'when running other environment than production' do before do ENV['PRODUCTION'] = nil expect(File) .to receive(:read) .with('config.json') .and_return('{"config_from":"file"}') end it 'loads the config from config file' do expect(subject.configs).to eq('config_from' => 'file') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
idxprb-0.0.1 | spec/idxprb/configurator_spec.rb |