summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-01-23 10:22:00 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-01-23 10:22:00 +0000
commit4cefae0aaadfadae71d695b17468fca2dfe74541 (patch)
treeaeceb744a0d9c38c17f0408d953baf614497bf6a /test
parente173f7e72dff82dfe55656a0ea0b7cf25f0c45de (diff)
downloadredmine-4cefae0aaadfadae71d695b17468fca2dfe74541.tar.gz
redmine-4cefae0aaadfadae71d695b17468fca2dfe74541.zip
Adds an application configuration file: config/configuration.yml (#7408).
Email delivery settings that were stored in config/email.yml should be moved to this new configuration file. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4752 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/configuration/default.yml8
-rw-r--r--test/fixtures/configuration/empty.yml7
-rw-r--r--test/fixtures/configuration/no_default.yml8
-rw-r--r--test/fixtures/configuration/overrides.yml9
-rw-r--r--test/unit/lib/redmine/configuration_test.rb52
5 files changed, 84 insertions, 0 deletions
diff --git a/test/fixtures/configuration/default.yml b/test/fixtures/configuration/default.yml
new file mode 100644
index 000000000..89a60f13a
--- /dev/null
+++ b/test/fixtures/configuration/default.yml
@@ -0,0 +1,8 @@
+default:
+ somesetting: foo
+
+production:
+
+development:
+
+test:
diff --git a/test/fixtures/configuration/empty.yml b/test/fixtures/configuration/empty.yml
new file mode 100644
index 000000000..f280431c4
--- /dev/null
+++ b/test/fixtures/configuration/empty.yml
@@ -0,0 +1,7 @@
+default:
+
+production:
+
+development:
+
+test:
diff --git a/test/fixtures/configuration/no_default.yml b/test/fixtures/configuration/no_default.yml
new file mode 100644
index 000000000..161224a46
--- /dev/null
+++ b/test/fixtures/configuration/no_default.yml
@@ -0,0 +1,8 @@
+default:
+
+production:
+
+development:
+
+test:
+ somesetting: foo
diff --git a/test/fixtures/configuration/overrides.yml b/test/fixtures/configuration/overrides.yml
new file mode 100644
index 000000000..d9be392ba
--- /dev/null
+++ b/test/fixtures/configuration/overrides.yml
@@ -0,0 +1,9 @@
+default:
+ somesetting: foo
+
+production:
+
+development:
+
+test:
+ somesetting: bar
diff --git a/test/unit/lib/redmine/configuration_test.rb b/test/unit/lib/redmine/configuration_test.rb
new file mode 100644
index 000000000..239f2d3d4
--- /dev/null
+++ b/test/unit/lib/redmine/configuration_test.rb
@@ -0,0 +1,52 @@
+# Redmine - project management software
+# Copyright (C) 2006-2011 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+require File.expand_path('../../../../test_helper', __FILE__)
+
+class Redmine::ConfigurationTest < ActiveSupport::TestCase
+ def setup
+ @conf = Redmine::Configuration
+ end
+
+ def test_empty
+ assert_kind_of Hash, load_conf('empty.yml', 'test')
+ end
+
+ def test_default
+ assert_kind_of Hash, load_conf('default.yml', 'test')
+ assert_equal 'foo', @conf['somesetting']
+ end
+
+ def test_no_default
+ assert_kind_of Hash, load_conf('no_default.yml', 'test')
+ assert_equal 'foo', @conf['somesetting']
+ end
+
+ def test_overrides
+ assert_kind_of Hash, load_conf('overrides.yml', 'test')
+ assert_equal 'bar', @conf['somesetting']
+ end
+
+ private
+
+ def load_conf(file, env)
+ @conf.load(
+ :file => File.join(Rails.root, 'test', 'fixtures', 'configuration', file),
+ :env => env
+ )
+ end
+end