test/test_load_config.rb in rest-graph-1.7.0 vs test/test_load_config.rb in rest-graph-1.8.0

- old
+ new

@@ -3,38 +3,40 @@ require_relative 'common' else require File.dirname(__FILE__) + '/common' end -require 'rest-graph/load_config' +require 'rest-graph/config_util' -describe RestGraph::LoadConfig do +describe RestGraph::ConfigUtil do after do RR.verify end should 'honor rails config' do ::Rails = Object.new - mock(Rails).env { 'test' } - mock(Rails).root{ File.dirname(__FILE__) } + mock(Rails).env { 'test' }.times(2) + mock(Rails).root{ File.dirname(__FILE__) }.times(2) check = lambda{ RestGraph.default_app_id.should == 41829 RestGraph.default_secret.should == 'r41829'.reverse RestGraph.default_auto_decode.should == false RestGraph.default_lang.should == 'zh-tw' } - TestHelper.ensure_rollback{ - RestGraph::LoadConfig.load_if_rails! - check - } + [RestGraph::ConfigUtil, RestGraph].each{ |const| + TestHelper.ensure_rollback{ + const.load_config_for_rails + check.call + } - TestHelper.ensure_rollback{ - RestGraph::LoadConfig.load_config!( - "#{File.dirname(__FILE__)}/config/rest-graph.yaml", - 'test') - check + TestHelper.ensure_rollback{ + const.load_config( + "#{File.dirname(__FILE__)}/config/rest-graph.yaml", + 'test') + check.call + } } end end