Sha256: bd3635c4dbbb94fd778765a419de848307fff2332ad18aebb4c0b647559cd48e
Contents?: true
Size: 1.74 KB
Versions: 55
Compression:
Stored size: 1.74 KB
Contents
require 'spec_helper' require 'uri' describe EY::Config do describe "environments" do it "get loaded from the config file" do write_yaml("environments" => {"production" => {"default" => true}}) EY::Config.new.environments["production"]["default"].should be_true end it "are present when the config file has no environments key" do write_yaml("endpoint" => "http://localhost/") EY::Config.new.environments.should == {} end end describe "endpoint" do it "defaults to production EY Cloud" do EY::Config.new.endpoint.should == EY::Config.new.default_endpoint end it "gets loaded from the config file" do write_yaml("endpoint" => "http://localhost/") EY::Config.new.endpoint.should == URI.parse("http://localhost/") end it "raises on an invalid endpoint" do write_yaml("endpoint" => "non/absolute") lambda { EY::Config.new.endpoint }. should raise_error(EY::Config::ConfigurationError) end end it "provides default_endpoint?" do write_yaml("endpoint" => "http://localhost/") EY::Config.new.default_endpoint?.should_not be_true end describe "files" do it "looks for config/ey.yml" do write_yaml({"endpoint" => "http://something/"}, "ey.yml") write_yaml({"endpoint" => "http://localhost/"}, "config/ey.yml") EY::Config.new.endpoint.should == URI.parse("http://localhost/") end it "looks for ey.yml" do write_yaml({"endpoint" => "http://foo/"}, "ey.yml") EY::Config.new.endpoint.should == URI.parse("http://foo/") end it "looks for the file given" do write_yaml({"endpoint" => "http://bar/"}, "summat.yml") EY::Config.new("summat.yml").endpoint.should == URI.parse("http://bar/") end end end
Version data entries
55 entries across 55 versions & 1 rubygems