Sha256: f40fa8bd61acd29f63046ce57889b351d3ebd9534ac3da0a92eba4a81262d38a

Contents?: true

Size: 880 Bytes

Versions: 1

Compression:

Stored size: 880 Bytes

Contents

require 'spec_helper'

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

  describe 'load' do
    context 'with no args' do
      it 'defaults to .env' do
        Dotenv::Environment.should_receive(:new).with('.env').
          and_return(mock(:apply => {}))
        Dotenv.load
      end
    end

    context 'with multiple files' do
      let(:expected) do
        {'OPTION_A' => '1', 'OPTION_B' => '2', 'DOTENV' => 'true'}
      end

      subject do
        Dotenv.load('.env', env_path)
      end

      it 'loads all files' do
        subject
        expected.each do |key, value|
          expect(ENV[key]).to eq(value)
        end
      end

      it 'returns hash of loaded environments' do
        expect(subject).to eq(expected)
      end
    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.6.0 spec/dotenv_spec.rb