Sha256: 2c56c9b68402f495fa24c742a54592833b537f61dcd34c7254d3f36cdc563b45

Contents?: true

Size: 1.42 KB

Versions: 5

Compression:

Stored size: 1.42 KB

Contents

require 'spec_helper'
require 'resolv'

describe Fozzie::Configuration do

  it "#host" do
    subject.host.should be_kind_of(String)
  end

  it "#port" do
    subject.port.should be_kind_of(Fixnum)
  end

  it "attempts to load configuration from yaml" do
    c = Fozzie::Configuration.new({:env => 'test', :config_path => 'spec/'})
    c.stubs(:origin_name).returns ""
    c.host.should eq '1.1.1.1'
    c.port.should eq 9876
    c.appname.should eq 'fozzie'
    c.data_prefix.should eq 'fozzie.test'
  end

  it "defaults env" do
    subject.env.should eq 'development'
  end

  it "creates a data prefix" do
    subject.stubs(:origin_name).returns("")
    subject.data_prefix.should eq 'development'
  end

  it "creates a data prefix with appname when set" do
    subject.stubs(:origin_name).returns("")
    subject.appname = 'astoria'
    subject.data_prefix.should eq 'astoria.development'
  end

  it "creates a prefix with origin" do
    subject.stubs(:origin_name).returns("app.server.local")
    subject.appname = 'astoria'
    subject.data_prefix.should eq 'astoria.app-server-local.development'
  end

  it "handles missing configuration namespace" do
    proc { Fozzie::Configuration.new({:env => 'blbala', :config_path => 'spec/'}) }.should_not raise_error
  end

  it "#namespaces" do
    subject.namespaces.should be_kind_of(Array)
    subject.namespaces.should include("Stats")
    subject.namespaces.should include("S")
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fozzie-0.0.20 spec/lib/fozzie/configuration_spec.rb
fozzie-0.0.19 spec/lib/fozzie/configuration_spec.rb
fozzie-0.0.18 spec/lib/fozzie/configuration_spec.rb
fozzie-0.0.17 spec/lib/fozzie/configuration_spec.rb
fozzie-0.0.16 spec/lib/fozzie/configuration_spec.rb