require 'environment/spec_helper' require 'rad/environment' require 'rad/spec/environment' describe 'config' do before :each do @c = Rad::Config.new @c.environment = 'development' @c.key = 'value' @c.key2 = 'value2' end it "should merge with existing config" do @c.key2!.should == 'value2' @c.merge_config! "#{spec_dir}/config.yml" @c.key!.should == 'value' @c.key2!.should == 'another_value' end it "should merge hashes (with the following order: config.default <= config <= config.environment)" do @c.merge_config! "#{spec_dir}/config.yml" @c.user_service.default_key("invalid").should == 'default_value' @c.user_service.key("invalid").should == 'value' @c.user_service.test_key("invalid").should == 'test_value' @c.user_service.name.should == 'test_name' end end