diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2020-03-04 16:50:27 +0100 |
---|---|---|
committer | David RodrÃguez <deivid.rodriguez@riseup.net> | 2020-03-04 18:26:31 +0100 |
commit | 02c39dd8eef95941d1dcfe8fc11ab469ba2670b3 (patch) | |
tree | e31a071456d6660e8dbafe04774dfbf7f971577d /Rakefile | |
parent | 512cceea4e5b9f6898523b147810b55de32c82d0 (diff) | |
download | bundler-02c39dd8eef95941d1dcfe8fc11ab469ba2670b3.tar.gz |
Move sudo specs setup to `rake spec:sudo`
Diffstat (limited to 'Rakefile')
-rw-r--r-- | Rakefile | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -55,7 +55,20 @@ namespace :spec do end desc "Run the spec suite with the sudo tests" - task :sudo => %w[set_sudo spec] + task :sudo => %w[set_sudo] do + require "open3" + + output, status = Open3.capture2e("sudo sed -i '/secure_path/d' /etc/sudoers") + raise "Couldn't configure sudo to preserve path: #{output}" unless status.success? + + raise "Couldn't configure sudo correctly to preserve path" unless `ruby -v` == `sudo -E ruby -v` + + begin + sh("sudo -E bin/rspec") + ensure + system("sudo", "chown", "-R", ENV["USER"], "tmp") + end + end task :set_sudo do ENV["BUNDLER_SUDO_TESTS"] = "1" |