Sha256: a36ab9f759cff44dcc94ccc6b9a0e69bd60d23c9463e88daec45ca591cff8231
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
require "spec_helper" module RockConfig describe Config do it "accepts a hash" do hash = {foo: "bar"} config = Config.new(hash) config.raw.should eq(hash) end it "returns config for given environment" do subhash_dev = {"a" => 123} subhash_prod = {"a" => 321} hash = { "development" => subhash_dev, "production" => subhash_prod } config = Config.new(hash) config.development.raw.should eq(subhash_dev) config.production.raw.should eq(subhash_prod) end it "returns nil when asked for non existing environment" do config = Config.new({}) config.for_environment("I do not exist").should be_nil end it "returns correct values when asked for" do hash = { "development" => { "host" => "localhost" } } config = Config.new(hash) config.development.host.should eq("localhost") end it "returns correct nested values when asked for" do hash = { "development" => { "elastic" => { "host" => "localhost" } } } config = Config.new(hash) config.development.elastic.host.should eq("localhost") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rock_config-0.0.2 | spec/config_spec.rb |
rock_config-0.0.1 | spec/config_spec.rb |