summaryrefslogtreecommitdiff
path: root/spec/cache
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2017-07-21 14:21:56 -0500
committerSamuel Giddins <segiddins@segiddins.me>2017-07-23 12:51:36 -0500
commitdcd9963876f1405a19671a6bd34d42a6add9e16a (patch)
tree1cfee962063fdf074972211b6f0fe99ae329bf7b /spec/cache
parent07fedc3f9ee972d5da43f8a77a162bf2c9ca4b1b (diff)
downloadbundler-dcd9963876f1405a19671a6bd34d42a6add9e16a.tar.gz
Update the specs for the default bundle path being ./.bundle
Diffstat (limited to 'spec/cache')
-rw-r--r--spec/cache/gems_spec.rb27
1 files changed, 20 insertions, 7 deletions
diff --git a/spec/cache/gems_spec.rb b/spec/cache/gems_spec.rb
index aef4c5f05a..4a0b953830 100644
--- a/spec/cache/gems_spec.rb
+++ b/spec/cache/gems_spec.rb
@@ -1,14 +1,14 @@
# frozen_string_literal: true
RSpec.describe "bundle cache" do
- describe "when there are only gemsources" do
+ shared_examples_for "when there are only gemsources" do
before :each do
gemfile <<-G
gem 'rack'
G
- system_gems "rack-1.0.0"
- bundle :cache
+ system_gems "rack-1.0.0", :path => :bundle_path
+ bundle! :cache
end
it "copies the .gem file to vendor/cache" do
@@ -27,7 +27,7 @@ RSpec.describe "bundle cache" do
end
it "uses the cache as a source when installing gems with --local" do
- system_gems []
+ system_gems [], :path => :bundle_path
bundle "install --local"
expect(the_bundle).to include_gems("rack 1.0.0")
@@ -46,7 +46,7 @@ RSpec.describe "bundle cache" do
end
it "does not reinstall gems from the cache if they exist in the bundle" do
- system_gems "rack-1.0.0"
+ system_gems "rack-1.0.0", :path => :bundle_path
gemfile <<-G
gem "rack"
@@ -56,7 +56,7 @@ RSpec.describe "bundle cache" do
s.write "lib/rack.rb", "RACK = 'FAIL'"
end
- bundle "install --local"
+ bundle! :install, :local => true
expect(the_bundle).to include_gems("rack 1.0.0")
end
@@ -73,6 +73,16 @@ RSpec.describe "bundle cache" do
end
end
+ context "using system gems" do
+ before { bundle! "config path.system true" }
+ it_behaves_like "when there are only gemsources"
+ end
+
+ context "installing into a local path" do
+ before { bundle! "config path ./.bundle" }
+ it_behaves_like "when there are only gemsources"
+ end
+
describe "when there is a built-in gem", :ruby => "2.0" do
before :each do
build_repo2 do
@@ -86,7 +96,8 @@ RSpec.describe "bundle cache" do
FileUtils.rm("#{system_gem_path}/cache/builtin_gem-1.0.2.gem")
end
- it "uses builtin gems" do
+ it "uses builtin gems when installing to system gems" do
+ bundle! "config path.system true"
install_gemfile %(gem 'builtin_gem', '1.0.2')
expect(the_bundle).to include_gems("builtin_gem 1.0.2")
end
@@ -118,6 +129,8 @@ RSpec.describe "bundle cache" do
end
it "errors if the builtin gem isn't available to cache" do
+ bundle! "config path.system true"
+
install_gemfile <<-G
gem 'builtin_gem', '1.0.2'
G