Skip to content

Avoid deprecation warning with Bundler.with_clean_env #2240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions spec/sanity_check_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@

before{ FileUtils.mkdir_p tmp_root }

def with_clean_env
if Bundler.respond_to?(:with_unbundled_env)
Bundler.with_unbundled_env { yield }
else
Bundler.with_clean_env { yield }
end
end

it "fails when libraries are not required" do
script = tmp_root.join("fail_sanity_check")
File.open(script, "w") do |f|
Expand All @@ -17,7 +25,7 @@
end
FileUtils.chmod 0777, script

Bundler.with_clean_env do
with_clean_env do
expect(`bundle exec #{script} 2>&1`).
to match(/uninitialized constant RSpec::Support/).
or match(/undefined method `require_rspec_core' for RSpec::Support:Module/)
Expand All @@ -38,7 +46,7 @@
end
FileUtils.chmod 0777, script

Bundler.with_clean_env do
with_clean_env do
expect(`bundle exec #{script} 2>&1`).to be_empty
expect($?.exitstatus).to eq(0)
end
Expand Down