aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/support/config.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/support/config.rb')
-rw-r--r--activerecord/test/support/config.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/activerecord/test/support/config.rb b/activerecord/test/support/config.rb
index 3b1598e368..6d123688a3 100644
--- a/activerecord/test/support/config.rb
+++ b/activerecord/test/support/config.rb
@@ -1,6 +1,7 @@
require 'yaml'
require 'erubis'
require 'fileutils'
+require 'pathname'
module ARTest
class << self
@@ -10,13 +11,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