Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add support for using an ARCONFIG environment variable to specify the…

… location of the config.yml file for running the tests
  • Loading branch information...
commit fb1fd61634ba39a109bdcd88f19ee05906d4c2ed 1 parent df63c99
@jonleighton jonleighton authored
View
22 activerecord/RUNNING_UNIT_TESTS
@@ -9,17 +9,31 @@ You can build postgres and mysql databases using the build_postgresql and build_
You can run a particular test file from the command line, e.g.
- $ ruby test/cases/base_test.rb
+ $ ruby -Itest test/cases/base_test.rb
To run a specific test:
- $ ruby test/cases/base_test.rb -n test_something_works
+ $ ruby -Itest test/cases/base_test.rb -n test_something_works
You can run with a database other than the default you set in test/config.yml, using the ARCONN
environment variable:
- $ ARCONN=postgresql ruby test/cases/base_test.rb
+ $ ARCONN=postgresql ruby -Itest test/cases/base_test.rb
You can run all the tests for a given database via rake:
- $ rake test_postgresql
+ $ rake test_mysql
+
+The 'rake test' task will run all the tests for mysql, mysql2, sqlite3 and postgresql.
+
+== Identity Map
+
+By default the tests run with the Identity Map turned off. But all tests should pass whether or
+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.
View
11 activerecord/test/support/config.rb
@@ -10,13 +10,16 @@ def config
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
Please sign in to comment.
Something went wrong with that request. Please try again.