Skip to content

Commit f07592f

Browse files
authored
Merge pull request rails#53226 from davidstosik/sto/fix-rails-env-leak
Prevent `Rails.env` change from leaking to other tests
2 parents fac6689 + 22c6c63 commit f07592f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

railties/test/commands/console_test.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ def self.start
1818
end
1919
end
2020

21+
def setup
22+
@prev_rails_env = Rails.env
23+
end
24+
25+
def teardown
26+
Rails.env = @prev_rails_env
27+
end
28+
2129
def test_sandbox_option
2230
console = Rails::Console.new(app, parse_arguments(["--sandbox"]))
2331
assert_predicate console, :sandbox?

0 commit comments

Comments
 (0)