From 9dd43cecfe098774919a53cea1f5805a9be3d831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Fri, 24 Jan 2020 21:47:34 +0100 Subject: Create test lib in tmp, not in the root of the repo So it runs in the isolated tmp as expected. Also, as it is written, this spec would leave a leftover `_gem` folder in the root of the repo in case it fails, since the root of the repo is obviously not cleaned up after each test. --- spec/cache/path_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/cache/path_spec.rb b/spec/cache/path_spec.rb index 79e8b4a82b..3f3d4ec893 100644 --- a/spec/cache/path_spec.rb +++ b/spec/cache/path_spec.rb @@ -31,8 +31,8 @@ RSpec.describe "bundle cache with path" do end it "copies when the path is outside the bundle and the paths intersect" do - libname = File.basename(Dir.pwd) + "_gem" - libpath = File.join(File.dirname(Dir.pwd), libname) + libname = File.basename(bundled_app) + "_gem" + libpath = File.join(File.dirname(bundled_app), libname) build_lib libname, :path => libpath -- cgit v1.2.1 From b4675e9f3009014a89a283fca717515ec524cb76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Fri, 24 Jan 2020 21:49:21 +0100 Subject: Remove unnecessary folder removals Everything in this tests happens inside `tmp/` and `tmp/` is cleaned up after each spec. --- spec/cache/path_spec.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/spec/cache/path_spec.rb b/spec/cache/path_spec.rb index 3f3d4ec893..bd47ac925d 100644 --- a/spec/cache/path_spec.rb +++ b/spec/cache/path_spec.rb @@ -26,7 +26,6 @@ RSpec.describe "bundle cache with path" do expect(bundled_app("vendor/cache/foo-1.0")).to exist expect(bundled_app("vendor/cache/foo-1.0/.bundlecache")).to be_file - FileUtils.rm_rf lib_path("foo-1.0") expect(the_bundle).to include_gems "foo 1.0" end @@ -45,7 +44,6 @@ RSpec.describe "bundle cache with path" do expect(bundled_app("vendor/cache/#{libname}")).to exist expect(bundled_app("vendor/cache/#{libname}/.bundlecache")).to be_file - FileUtils.rm_rf libpath expect(the_bundle).to include_gems "#{libname} 1.0" end @@ -66,7 +64,6 @@ RSpec.describe "bundle cache with path" do bundle :cache expect(bundled_app("vendor/cache/foo-1.0")).to exist - FileUtils.rm_rf lib_path("foo-1.0") run "require 'foo'" expect(out).to eq("CACHE") -- cgit v1.2.1