Sha256: f617a73902ef492e5449a56af6d7a1d4727397a601b0b08240b9a32628078a49

Contents?: true

Size: 768 Bytes

Versions: 3

Compression:

Stored size: 768 Bytes

Contents

require 'spec_helper'

describe Dotenvious::Loaders::DotenvFile do
  describe '.load_from' do
    context 'given a file which does not exist' do
      before do
        expect(File).to receive(:exists?).and_return false
      end
      it 'aborts the process' do
        described_class.load_from('.env')
      end
    end

    context 'given a file which exists' do
      before do
        expect(File).to receive(:exists?).and_return true
      end

      it 'reads the given Dotenv format file and returns hash' do
        expect(File).to receive(:read).and_return "TEST=123\nEXAMPLE=234"

        response = described_class.load_from('.env')

        expect(response['TEST']).to eq '123'
        expect(response['EXAMPLE']).to eq '234'
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dotenvious-0.0.7 spec/dotenvious/loaders/dotenv_file_spec.rb
dotenvious-0.0.6 spec/dotenvious/loaders/dotenv_file_spec.rb
dotenvious-0.0.5 spec/dotenvious/loaders/dotenv_file_spec.rb