From e2815b6347b9288e74139b543303129c4dd72c6a Mon Sep 17 00:00:00 2001 From: Jacob Herrington Date: Wed, 22 Sep 2021 11:24:45 -0500 Subject: [PATCH] Reimplement delete environment tests (#2710) --- test/test_cli.rb | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/test/test_cli.rb b/test/test_cli.rb index c8726ea3c5..4710b7ce60 100644 --- a/test/test_cli.rb +++ b/test/test_cli.rb @@ -439,4 +439,25 @@ def test_environment_app_env ENV.delete 'APP_ENV' ENV.delete 'RAILS_ENV' end -end \ No newline at end of file + + def test_environment_rack_env + ENV['RACK_ENV'] = @environment + + cli = Puma::CLI.new [] + cli.send(:setup_options) + + assert_equal @environment, cli.instance_variable_get(:@conf).environment.call + end + + def test_environment_rails_env + ENV.delete 'RACK_ENV' + ENV['RAILS_ENV'] = @environment + + cli = Puma::CLI.new [] + cli.send(:setup_options) + + assert_equal @environment, cli.instance_variable_get(:@conf).environment.call + ensure + ENV.delete 'RAILS_ENV' + end +end