summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spec/runtime/with_unbundled_env_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/runtime/with_unbundled_env_spec.rb b/spec/runtime/with_unbundled_env_spec.rb
index 2c3cc1dbaa..83eb1eac13 100644
--- a/spec/runtime/with_unbundled_env_spec.rb
+++ b/spec/runtime/with_unbundled_env_spec.rb
@@ -156,6 +156,24 @@ RSpec.describe "Bundler.with_env helpers" do
expect(ENV).not_to have_key("FOO")
end
+
+ it "prints a deprecation", :bundler => 2 do
+ code = "Bundler.with_clean_env {}"
+ bundle_exec_ruby! code.dump
+ expect(last_command.stdboth).to include(
+ "[DEPRECATED FOR 2.0] `Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. " \
+ "If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env`"
+ )
+ end
+
+ it "does not print a deprecation", :bundler => "< 2" do
+ code = "Bundler.with_clean_env {}"
+ bundle_exec_ruby! code.dump
+ expect(last_command.stdboth).not_to include(
+ "[DEPRECATED FOR 2.0] `Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. " \
+ "If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env`"
+ )
+ end
end
describe "Bundler.with_unbundled_env" do