spec/dotenv/environment_spec.rb in dotenv-0.6.0 vs spec/dotenv/environment_spec.rb in dotenv-0.7.0

- old
+ new

@@ -6,10 +6,16 @@ describe 'initialize' do it 'reads the file' do expect(subject['OPTION_A']).to eq('1') expect(subject['OPTION_B']).to eq('2') end + + it 'fails if file does not exist' do + expect { + Dotenv::Environment.new('.does_not_exists') + }.to raise_error(Errno::ENOENT) + end end describe 'apply' do it 'sets variables in ENV' do subject.apply @@ -18,18 +24,9 @@ it 'does not override defined variables' do ENV['OPTION_A'] = 'predefined' subject.apply expect(ENV['OPTION_A']).to eq('predefined') - end - - context 'when the file does not exist' do - subject { Dotenv::Environment.new('.env_does_not_exist') } - - it 'fails silently' do - expect { subject.apply }.not_to raise_error - expect(ENV.keys).to eq(@env_keys) - end end end it 'parses unquoted values' do expect(env('FOO=bar')).to eql({'FOO' => 'bar'})