diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-06-12 19:08:16 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-06-12 19:08:16 +0100 |
commit | 86bbba1ffbd7bf695021d0e6c0f269f808304143 (patch) | |
tree | 0d18d78295265425b59405a2ba0a5ae152964efe /activerecord/test | |
parent | 15e289147e72ab113299f806b4f6e7a0daddd684 (diff) | |
download | rails-86bbba1ffbd7bf695021d0e6c0f269f808304143.tar.gz rails-86bbba1ffbd7bf695021d0e6c0f269f808304143.tar.bz2 rails-86bbba1ffbd7bf695021d0e6c0f269f808304143.zip |
Add support for using an ARCONFIG environment variable to specify the location of the config.yml file for running the tests
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/support/config.rb | 11 |
1 files changed, 7 insertions, 4 deletions
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 |