Sha256: 168f8de104bae5293976cedc43f80cc06cdf401a07dbe02d873ce38f3cf92ece
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
require "spec_helper" require "dsc" RSpec.describe Dsc do describe '.load_file' do before do File.open(config_file, 'w') do |file| file.puts <<EOF production: host: 'http://www.wimdu.com' awesome: true development: host: 'http://example.com' stable: false number: 42 array: [1, 2, 3] subconfig: works: 'aswell' EOF end end subject(:dsc) { Dsc.load_file(config_file, env: env) } let(:config_file) { File.expand_path(__FILE__ + '/../../tmp/config.yml') } let(:env) { 'development' } it 'works' do expect(dsc).to have_attributes( host: 'http://example.com', stable: false, number: 42, array: [1, 2, 3], subconfig: { works: 'aswell' } ) end it "raises an error when trying to access undefined methods" do expect { dsc.awesome }.to raise_error( Dsc::UndefinedAttribute, /awesome is not defined/ ) end context 'with env production' do let(:env) { 'production' } it 'provides the production stuff' do expect(dsc).to have_attributes( host: 'http://www.wimdu.com', awesome: true ) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dsc-0.0.1 | spec/dsc_spec.rb |