Sha256: 1bfd5a501c37835b9db186a72a346d41e30cda6e999210c6cdd614e75c9b6c15
Contents?: true
Size: 1.39 KB
Versions: 3
Compression:
Stored size: 1.39 KB
Contents
# # This file is part of the ballast gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>. # Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php. # require "spec_helper" describe Ballast::Configuration do describe "#initialize" do before(:each) do expect(YAML).to receive(:load_file).with("ROOT/config/section_a.yml").and_return({"ENV" => {a: {b: 1}}, "OTHER" => {aa: 3}}) expect(YAML).to receive(:load_file).with("ROOT/config/section-b.yml").and_return({"ENV" => {c: {d: 2}}, "OTHER" => {cc: 4}}) end it "should load a list of sections" do Ballast::Configuration.new(sections: ["section_a", "section-b"], root: "ROOT", environment: "ENV") end it "should only load specific environment" do subject = Ballast::Configuration.new(sections: ["section_a", "section-b"], root: "ROOT", environment: "ENV") expect(subject["section_a"].keys).to eq(["a"]) expect(subject["section_b"].keys).to eq(["c"]) end it "should enable dotted access" do subject = Ballast::Configuration.new(sections: ["section_a", "section-b"], root: "ROOT", environment: "ENV") expect(subject.section_a.a.b).to eq(1) expect(subject.section_b.c).to eq({"d" => 2}) expect { subject.section_a.e }.to raise_error(NoMethodError) expect { subject.e }.to raise_error(NoMethodError) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ballast-1.9.3 | spec/ballast/configuration_spec.rb |
ballast-1.9.2 | spec/ballast/configuration_spec.rb |
ballast-1.9.1 | spec/ballast/configuration_spec.rb |