Skip to content

Commit 23b1c56

Browse files
authored
Merge pull request rails#52045 from zzak/railties_clean_irb_homedir_tests
Avoid running console tests against users IRB config
2 parents db53eca + 0af962b commit 23b1c56

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

railties/test/application/console_test.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ def write_prompt(command, expected_output = nil, prompt: "> ")
3333
end
3434

3535
def spawn_console(options, wait_for_prompt: true, env: {})
36+
# Test should not depend on user's irbrc file
37+
home_tmp_dir = Dir.mktmpdir
38+
3639
pid = Process.spawn(
37-
{ "TERM" => "dumb" }.merge(env),
40+
{ "TERM" => "dumb", "HOME" => home_tmp_dir }.merge(env),
3841
"#{app_path}/bin/rails console #{options}",
3942
in: @replica, out: @replica, err: @replica
4043
)
@@ -44,6 +47,8 @@ def spawn_console(options, wait_for_prompt: true, env: {})
4447
end
4548

4649
pid
50+
ensure
51+
FileUtils.remove_entry(home_tmp_dir)
4752
end
4853

4954
def test_sandbox

0 commit comments

Comments
 (0)