Sha256: 6ed434b620c7e061cfb2d06c381f2c8e4b276e4f6c402221c59cccbae435b7af
Contents?: true
Size: 1.56 KB
Versions: 2
Compression:
Stored size: 1.56 KB
Contents
require 'spec_helper' module ConfigurationOverride def configuration_options { root_path: Pathname.new(Dir.tmpdir), environment: 'this_is_a_test' } end end describe Quandl::Configurable do before(:each) do Quandl::Config.clear_internal_cache end shared_examples 'override configuration' do it 'should use the overwritten values' do expect(File).to receive(:read).with(Pathname.new(Dir.tmpdir).join('config', 'fake.yml')).and_return('---\n:a: :b\n') expect(subject.send(:project_environment)).to eq('this_is_a_test') expect(subject.send(:project_root)).to eq(Pathname.new(Dir.tmpdir)) end end context 'when extending' do subject { Fake.configuration } before(:each) do Fake.extend(Quandl::Configurable) Fake.instance_variable_set(:@configuration, nil) end it 'adds a configuration class method' do expect(subject).to be_kind_of(Quandl::Config) end context 'when overriding configuration options' do before(:each) do Fake.extend(ConfigurationOverride) end include_examples 'override configuration' end end context 'when including' do subject { Fake.new.configuration } before(:each) do Fake.include(Quandl::Configurable) end it 'adds a configuration instance method' do expect(subject).to be_kind_of(Quandl::Config) end context 'when overriding configuration options' do before(:each) do Fake.include(ConfigurationOverride) end include_examples 'override configuration' end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
quandl-config-1.0.0 | spec/quandl/quandl-configurable_spec.rb |
quandl-config-0.1.0 | spec/quandl/quandl-configurable_spec.rb |