Sha256: d1cbe766d59c5c0b350a21a2febea3b972685960f279ca62535b25abed5bc192

Contents?: true

Size: 666 Bytes

Versions: 1

Compression:

Stored size: 666 Bytes

Contents

require 'spec_helper'

describe Dotenv::Environment do
  let(:env_path) { fixture_path('plain.env') }
  let(:dotenv)   { Dotenv::Environment.new(env_path) }

  before do
    @env_keys = ENV.keys
  end

  after do
    ENV.delete_if { |k,v| !@env_keys.include?(k) }
  end

  describe 'initialize' do
    it 'reads environment config' do
      expect(dotenv['OPTION_A']).to eq('1')
      expect(dotenv['OPTION_B']).to eq('2')
    end
  end

  describe 'apply' do
    it 'sets variables in ENV' do
      dotenv.apply
      expect(ENV['OPTION_A']).to eq('1')
    end
  end

  def fixture_path(name)
    File.join(File.expand_path('../fixtures', __FILE__), name)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dotenv-0.1.0 spec/dotenv_spec.rb