spec/rails_config_spec.rb in td-logger-0.3.15 vs spec/rails_config_spec.rb in td-logger-0.3.16

- old
+ new

@@ -54,10 +54,11 @@ context 'init' do it 'load_env' do ENV['TREASURE_DATA_API_KEY'] = 'test1' ENV['TREASURE_DATA_DB'] = 'db1' c = TreasureData::Logger::Agent::Rails::Config.init + c.disabled.should == false c.agent_mode?.should == false c.apikey.should == 'test1' c.database.should == 'db1' c.auto_create_table.should == true end @@ -71,17 +72,32 @@ database: db2 debug_mode: true EOF } c = TreasureData::Logger::Agent::Rails::Config.init + c.disabled.should == false c.agent_mode?.should == false c.apikey.should == 'test2' c.database.should == 'db2' c.auto_create_table.should == true c.debug_mode.should == true end + it 'load_file without test' do + FileUtils.mkdir_p("#{TMP_DIR}/config") + File.open("#{TMP_DIR}/config/treasure_data.yml", "w") {|f| + f.write <<EOF +development: + apikey: test2 + database: db2 + debug_mode: true +EOF + } + c = TreasureData::Logger::Agent::Rails::Config.init + c.disabled.should == true + end + it 'prefer file than env' do ENV['TREASURE_DATA_API_KEY'] = 'test3' ENV['TREASURE_DATA_DB'] = 'db3' FileUtils.mkdir_p("#{TMP_DIR}/config") @@ -92,10 +108,11 @@ database: db4 auto_create_table: false EOF } c = TreasureData::Logger::Agent::Rails::Config.init + c.disabled.should == false c.agent_mode?.should == false c.apikey.should == 'test4' c.database.should == 'db4' c.auto_create_table.should == false c.debug_mode.should == false @@ -109,9 +126,10 @@ agent: localhost tag: td.db5 EOF } c = TreasureData::Logger::Agent::Rails::Config.init + c.disabled.should == false c.agent_mode?.should == true c.tag.should == 'td.db5' c.agent_host.should == 'localhost' c.agent_port.should == 24224 end