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

Version Path
engineyard-1.3.29 spec/engineyard/config_spec.rb
engineyard-1.3.28 spec/engineyard/config_spec.rb
engineyard-1.3.25 spec/engineyard/config_spec.rb
engineyard-1.3.22 spec/engineyard/config_spec.rb
engineyard-1.3.21 spec/engineyard/config_spec.rb
engineyard-1.3.20 spec/engineyard/config_spec.rb
engineyard-1.3.19 spec/engineyard/config_spec.rb
engineyard-1.3.18 spec/engineyard/config_spec.rb
engineyard-1.3.17 spec/engineyard/config_spec.rb
engineyard-1.3.16 spec/engineyard/config_spec.rb
engineyard-1.3.15 spec/engineyard/config_spec.rb
engineyard-1.3.14 spec/engineyard/config_spec.rb
engineyard-1.3.13 spec/engineyard/config_spec.rb
engineyard-1.3.12 spec/engineyard/config_spec.rb
engineyard-1.3.11 spec/engineyard/config_spec.rb
engineyard-1.3.10 spec/engineyard/config_spec.rb
engineyard-1.3.7 spec/engineyard/config_spec.rb
engineyard-1.3.4 spec/engineyard/config_spec.rb
engineyard-1.3.3 spec/engineyard/config_spec.rb
engineyard-1.3.2 spec/engineyard/config_spec.rb