Sha256: f698cf9c6bed6ef7e88fd1fff201b46cc8fad0281e94e3ab092fe6028c954547

Contents?: true

Size: 757 Bytes

Versions: 3

Compression:

Stored size: 757 Bytes

Contents

# encoding: utf-8
require 'spec_helper'

describe DataSources::Environment do
  context '#fetch' do
    it 'retrieves environment variables as string' do
      in_environment 'MY_NAME' => 'Karl' do
        source = DataSources::Environment.new
        expect(source.fetch('MY_NAME')).to eq('Karl')
      end
    end

    it 'retrieves environment variables as symbol' do
      in_environment 'MY_NAME' => 'Karl' do
        source = DataSources::Environment.new
        expect(source.fetch(:MY_NAME)).to eq('Karl')
      end
    end

    it 'returns nil if variable cannot be found' do
      in_environment 'MY_NAME' => 'Karl' do
        source = DataSources::Environment.new
        expect(source.fetch('NOT_MY_NAME')).to be_nil
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
filegen-0.4.3 spec/data_sources/environment_spec.rb
filegen-0.4.1 spec/data_sources/environment_spec.rb
filegen-0.4.0 spec/data_sources/environment_spec.rb