From a50b8ea3503f5642330c1e6b94320115796b4bab Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 8 Dec 2017 13:42:01 -0800 Subject: Set the Rails environment from an environment variable Option parsing happens too late to have any impact on the Rails environment. Rails accesses the environment name and memoizes it too early in the boot process for a commandline option to have any impact on the database connection, so we'll change this test to set the environment from an environment variable (and ensure it still works when running tests with `ruby`) --- railties/test/application/test_runner_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/test') diff --git a/railties/test/application/test_runner_test.rb b/railties/test/application/test_runner_test.rb index 17333b6ac9..a01325fdb8 100644 --- a/railties/test/application/test_runner_test.rb +++ b/railties/test/application/test_runner_test.rb @@ -593,7 +593,7 @@ module ApplicationTests file = create_test_for_env("development") results = Dir.chdir(app_path) { - `ruby -Ilib:test #{file} -e development`.each_line.map { |line| JSON.parse line } + `RAILS_ENV=development ruby -Ilib:test #{file}`.each_line.map { |line| JSON.parse line } } assert_equal 1, results.length failures = results.first["failures"] -- cgit v1.2.3