diaspora/spec/lib/configuration/provider/env_spec.rb
Jonne Haß 2a4db54db9 New configuration system
* Throw away old system
* Add new system
* Add new example files
* Replace all calls
* add the most important docs
* Add Specs
* rename disable_ssl_requirement to require_ssl
* cloudfiles isn't used/called in our code
* since community_spotlight.list is only used as enable flag replace it with such one and remove all legacy and irelevant codepaths around it
* die if session secret is unset and on heroku
* First basic infrastructure for version information
2012-09-26 20:19:37 +02:00

32 lines
867 B
Ruby

require 'spec_helper'
describe Configuration::Provider::Env do
subject { described_class.new }
let(:existing_path) { ['existing', 'setting']}
let(:not_existing_path) { ['not', 'existing', 'path']}
let(:array_path) { ['array'] }
before(:all) do
ENV['EXISTING_SETTING'] = "there"
ENV['ARRAY'] = "foo,bar,baz"
end
after(:all) do
ENV['EXISTING_SETTING'] = nil
ENV['ARRAY'] = nil
end
describe '#lookup_path' do
it "joins and upcases the path" do
ENV.should_receive(:[]).with("EXISTING_SETTING")
subject.lookup_path(existing_path)
end
it "returns nil if the setting isn't available" do
subject.lookup_path(not_existing_path).should be_nil
end
it "makes an array out of comma separated values" do
subject.lookup_path(array_path).should == ["foo", "bar", "baz"]
end
end
end