Sha256: a70d2196c955e09d9b2b55f767c5ab7f613b9cd9405506cb9c3f046c0661912e

Contents?: true

Size: 643 Bytes

Versions: 4

Compression:

Stored size: 643 Bytes

Contents

require 'helper'

describe "Mutaconf.env" do

  it "should extract properties from environment variables" do
    ENV['FOO'] = 'bar'
    ENV['BAR'] = 'foo'
    ENV.delete 'NIL'
    Mutaconf.env(:foo, :bar, :nil).should == { foo: 'bar', bar: 'foo', nil: nil }
  end

  it "should not upcase keys if specified" do
    ENV['foo'] = 'bar'
    ENV['bar'] = 'foo'
    Mutaconf.env(:foo, :bar, upcase: false).should == { foo: 'bar', bar: 'foo' }
  end

  it "should use the given prefix" do
    ENV['MUTACONF_FOO'] = 'bar'
    ENV['MUTACONF_BAR'] = 'foo'
    Mutaconf.env(:foo, :bar, prefix: :mutaconf_).should == { foo: 'bar', bar: 'foo' }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mutaconf-0.1.1 spec/env_spec.rb
mutaconf-0.1.0 spec/env_spec.rb
mutaconf-0.0.7 spec/env_spec.rb
mutaconf-0.0.6 spec/env_spec.rb