Sha256: 931b37b01b1eab28a51e2b1b5f9f8d1174365ab97c7447b5480eecd5bbf5c42a
Contents?: true
Size: 1.43 KB
Versions: 2
Compression:
Stored size: 1.43 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "ConfigLoader" do describe ".load" do it "raises exception when no config file name is given" do lambda { ConfigLoader.load(nil) }.should raise_error(ConfigLoader::MissingConfigFileNameError) end it "raises exception when the config file can't be found" do lambda { ConfigLoader.load('database', 'development', 'invalid_location') }.should raise_error(ConfigLoader::MissingConfigFileError) end it "loads keys for Rails.env from the config file located in Rails.root/config" do ConfigLoader.load('database')['name'].should == 'customers_test' end it "loads keys for the given environament from the config file located in Rails.root/config" do ConfigLoader.load('database', 'development')['name'].should == 'customers_development' end it "loads keys for the given environmanent from the config file located under the given directory/config" do alternative_root_dir = File.expand_path(File.join(File.dirname(__FILE__), "..", "spec", "alternative_root_dir")) ConfigLoader.load('database', 'development', alternative_root_dir)['name'].should == 'alternative_customers_development' end it "loads dinamic keys" do # KEY: # name: <%= "CUSTOMERS".downcase %>_test config = ConfigLoader.load('database', 'test') config['name'].should == 'customers_test' end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
configloader-0.3.2 | spec/config_loader_spec.rb |
configloader-0.3.1 | spec/config_loader_spec.rb |