Sha256: 42795df1243089dc5505ff0be2ec8db7ae771df99163672099a16f22c7afba60
Contents?: true
Size: 1.69 KB
Versions: 2
Compression:
Stored size: 1.69 KB
Contents
require "spec_helper" require "baton/server" describe Baton::Server do describe "#configure" do context "given a facts file" do before :each do Baton::Server.any_instance.stub(:facts_path).and_return("#{File.dirname(__FILE__)}/../fixtures/facts.json") end it "will set the fqdn" do subject.fqdn.should eq("build-prod-i-722b0004.dsci.it") end it "will set the environment" do subject.environment.should eq("production") end it "will set the apps" do subject.app_names.first.should eq("octobutler") end end context "given an invalid facts file" do before :each do Baton::Server.any_instance.stub(:facts_path).and_return("#{File.dirname(__FILE__)}/../fixtures/invalid_facts.json") end it "will raise an exception" do expect{subject.configure}.to raise_error(JSON::ParserError) end end context "given a facts file doesn't exist" do before :each do Baton::Server.any_instance.stub(:facts_path).and_return("/foo/bar") end it "will raise an exception" do expect{subject.configure}.to raise_error(Errno::ENOENT) end end context "given the required facts are not available" do before(:each) do Baton::Server.any_instance.stub(:facts).and_return({}) subject.configure end it "will default the fqdn to an empty string" do subject.fqdn.should be_empty end it "will default environment to development" do subject.environment.should eq("development") end it "will default apps to an empty array" do subject.app_names.should be_empty end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
baton-0.3.7 | spec/baton/server_spec.rb |
baton-0.3.6 | spec/baton/server_spec.rb |