aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/RUNNING_UNIT_TESTS5
-rw-r--r--activerecord/test/support/config.rb11
2 files changed, 12 insertions, 4 deletions
diff --git a/activerecord/RUNNING_UNIT_TESTS b/activerecord/RUNNING_UNIT_TESTS
index 8fe9a357b4..6a2e23b01f 100644
--- a/activerecord/RUNNING_UNIT_TESTS
+++ b/activerecord/RUNNING_UNIT_TESTS
@@ -32,3 +32,8 @@ By default the tests run with the Identity Map turned off. But all tests should
not the identity map is on or off. You can turn it on using the IM env variable:
$ IM=true ruby -Itest test/case/base_test.rb
+
+== Config file
+
+By default, the config file is expected to be at the path test/config.yml. You can specify a
+custom location with the ARCONFIG environment variable.
diff --git a/activerecord/test/support/config.rb b/activerecord/test/support/config.rb
index 3b1598e368..c7ac077599 100644
--- a/activerecord/test/support/config.rb
+++ b/activerecord/test/support/config.rb
@@ -10,13 +10,16 @@ module ARTest
private
+ def config_file
+ Pathname.new(ENV['ARCONFIG'] || TEST_ROOT + '/config.yml')
+ end
+
def read_config
- unless File.exist?(TEST_ROOT + '/config.yml')
- FileUtils.cp TEST_ROOT + '/config.example.yml', TEST_ROOT + '/config.yml'
+ unless config_file.exist?
+ FileUtils.cp TEST_ROOT + '/config.example.yml', config_file
end
- raw = File.read(TEST_ROOT + '/config.yml')
- erb = Erubis::Eruby.new(raw)
+ erb = Erubis::Eruby.new(config_file.read)
expand_config(YAML.parse(erb.result(binding)).transform)
end