Sha256: 397b7e865e80ff79c6256de6850eacc1636d5c5b2449d56076ea6485143e45d3

Contents?: true

Size: 1.08 KB

Versions: 20

Compression:

Stored size: 1.08 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe ProcessEnvironment do
  context '#initialize' do
    it 'accepts an environment' do
      env = double('ENV')
      allow(env).to receive(:to_hash).and_return({})

      expect {
        ProcessEnvironment.new(env)
      }.not_to raise_error
    end
  end

  context '#fetch' do
    it 'fetches environment variable' do
      env = double('ENV')
      allow(env).to receive(:to_hash).and_return({variable: 'value'})

      env = ProcessEnvironment.new(env)
      expect(env.fetch(:variable)).to eq('value')
    end

    it 'returns an empty string if variable cannot be found' do
      env = double('ENV')
      allow(env).to receive(:to_hash).and_return({})

      env = ProcessEnvironment.new(env)
      expect(env.fetch(:variable)).to eq('')
    end
  end

  context '#write' do
    it 'writes to environment' do
      env = double('ENV')
      allow(env).to receive(:to_hash).and_return({})
      expect(env).to receive(:[]=).with('variable', 'value')

      env = ProcessEnvironment.new(env)
      env.write(:variable, 'value')
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
test_server-0.5.2 spec/process_environment_spec.rb
test_server-0.5.1 spec/process_environment_spec.rb
test_server-0.5.0 spec/process_environment_spec.rb
test_server-0.4.1 spec/process_environment_spec.rb
test_server-0.4.0 spec/process_environment_spec.rb
test_server-0.3.7 spec/process_environment_spec.rb
test_server-0.3.6 spec/process_environment_spec.rb
test_server-0.3.5 spec/process_environment_spec.rb
test_server-0.3.4 spec/process_environment_spec.rb
test_server-0.3.2 spec/process_environment_spec.rb
test_server-0.3.1 spec/process_environment_spec.rb
test_server-0.2.4 spec/process_environment_spec.rb
test_server-0.2.3 spec/process_environment_spec.rb
test_server-0.2.2 spec/process_environment_spec.rb
test_server-0.2.1 spec/process_environment_spec.rb
test_server-0.2.0 spec/process_environment_spec.rb
test_server-0.1.2 spec/process_environment_spec.rb
test_server-0.1.1 spec/process_environment_spec.rb
test_server-0.1.0 spec/process_environment_spec.rb
test_server-0.0.11 spec/process_environment_spec.rb