annotate test/unit/lib/redmine/configuration_test.rb @ 1472:f0b798dad2d6 feature_526

Close obsolete branch feature_526
author Chris Cannam
date Tue, 20 Nov 2012 19:45:51 +0000
parents cbb26bc654de
children 433d4f72a19b
rev   line source
Chris@210 1 # Redmine - project management software
Chris@210 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
Chris@210 3 #
Chris@210 4 # This program is free software; you can redistribute it and/or
Chris@210 5 # modify it under the terms of the GNU General Public License
Chris@210 6 # as published by the Free Software Foundation; either version 2
Chris@210 7 # of the License, or (at your option) any later version.
Chris@909 8 #
Chris@210 9 # This program is distributed in the hope that it will be useful,
Chris@210 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@210 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@210 12 # GNU General Public License for more details.
Chris@909 13 #
Chris@210 14 # You should have received a copy of the GNU General Public License
Chris@210 15 # along with this program; if not, write to the Free Software
Chris@210 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Chris@210 17
Chris@210 18 require File.expand_path('../../../../test_helper', __FILE__)
Chris@210 19
Chris@210 20 class Redmine::ConfigurationTest < ActiveSupport::TestCase
Chris@210 21 def setup
Chris@210 22 @conf = Redmine::Configuration
Chris@210 23 end
Chris@210 24
Chris@210 25 def test_empty
Chris@210 26 assert_kind_of Hash, load_conf('empty.yml', 'test')
Chris@210 27 end
Chris@909 28
Chris@210 29 def test_default
Chris@210 30 assert_kind_of Hash, load_conf('default.yml', 'test')
Chris@210 31 assert_equal 'foo', @conf['somesetting']
Chris@210 32 end
Chris@909 33
Chris@210 34 def test_no_default
Chris@210 35 assert_kind_of Hash, load_conf('no_default.yml', 'test')
Chris@210 36 assert_equal 'foo', @conf['somesetting']
Chris@210 37 end
Chris@909 38
Chris@210 39 def test_overrides
Chris@210 40 assert_kind_of Hash, load_conf('overrides.yml', 'test')
Chris@210 41 assert_equal 'bar', @conf['somesetting']
Chris@210 42 end
Chris@909 43
Chris@245 44 def test_with
Chris@245 45 load_conf('default.yml', 'test')
Chris@245 46 assert_equal 'foo', @conf['somesetting']
Chris@245 47 @conf.with 'somesetting' => 'bar' do
Chris@245 48 assert_equal 'bar', @conf['somesetting']
Chris@245 49 end
Chris@245 50 assert_equal 'foo', @conf['somesetting']
Chris@245 51 end
Chris@909 52
Chris@210 53 private
Chris@909 54
Chris@210 55 def load_conf(file, env)
Chris@210 56 @conf.load(
Chris@210 57 :file => File.join(Rails.root, 'test', 'fixtures', 'configuration', file),
Chris@210 58 :env => env
Chris@210 59 )
Chris@210 60 end
Chris@210 61 end