summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-04-26 13:54:58 +0200
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-05-27 13:03:20 +0200
commit15d33c2a396e4a403bc7d74cf9d1454de8393f92 (patch)
treec9689126deb71d449c5bae66fb9fb459a3ad8196
parente3ade9ee5eaa512b81f3aa272dc7fa71c307c4ae (diff)
downloadbundler-15d33c2a396e4a403bc7d74cf9d1454de8393f92.tar.gz
Remove sudo-created files after the test themselves
Instead of creating a separate rake task. This should allow the tests to properly clean after themselves also when not run through rake.
-rw-r--r--Rakefile11
-rw-r--r--spec/install/gems/sudo_spec.rb2
2 files changed, 5 insertions, 8 deletions
diff --git a/Rakefile b/Rakefile
index fbbd3365b6..c9835b1333 100644
--- a/Rakefile
+++ b/Rakefile
@@ -97,17 +97,12 @@ namespace :spec do
end
desc "Run the spec suite with the sudo tests"
- task :sudo => %w[set_sudo spec clean_sudo]
+ task :sudo => %w[set_sudo spec]
task :set_sudo do
ENV["BUNDLER_SUDO_TESTS"] = "1"
end
- task :clean_sudo do
- puts "Cleaning up sudo test files..."
- system "sudo rm -rf #{File.expand_path("../tmp/sudo_gem_home", __FILE__)}"
- end
-
# RubyGems specs by version
namespace :rubygems do
# When editing this list, also edit .travis.yml!
@@ -121,7 +116,7 @@ namespace :spec do
# Create tasks like spec:rubygems:v1.8.3:sudo to run the sudo specs
namespace rg do
- task :sudo => ["set_sudo", rg, "clean_sudo"]
+ task :sudo => ["set_sudo", rg]
task :realworld => ["set_realworld", rg]
end
@@ -139,7 +134,7 @@ namespace :spec do
end
namespace "co" do
- task :sudo => ["set_sudo", "co", "clean_sudo"]
+ task :sudo => ["set_sudo", "co"]
task :realworld => ["set_realworld", "co"]
end
diff --git a/spec/install/gems/sudo_spec.rb b/spec/install/gems/sudo_spec.rb
index a7372b1fbe..8338a7794b 100644
--- a/spec/install/gems/sudo_spec.rb
+++ b/spec/install/gems/sudo_spec.rb
@@ -142,6 +142,8 @@ RSpec.describe "when using sudo", :sudo => true do
bundle :install, :env => { "GEM_HOME" => gem_home.to_s, "GEM_PATH" => nil }
expect(gem_home.join("bin/rackup")).to exist
expect(the_bundle).to include_gems "rack 1.0", :env => { "GEM_HOME" => gem_home.to_s, "GEM_PATH" => nil }
+
+ sudo "rm -rf #{tmp("sudo_gem_home")}"
end
end