summaryrefslogtreecommitdiff
path: root/spec/bundler/cache
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-01 23:29:38 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-01 23:29:38 +0000
commitbe7b5929126cb3e696ef222339237faba9b8fe5a (patch)
tree51eae376f93c09bc82dde5a657a91df2c89062e4 /spec/bundler/cache
parentae49dbd392083f69026f2a0fff4a1d5f42d172a7 (diff)
Update bundled bundler to 1.16.0.
* lib/bundler, spec/bundler: Merge bundler-1.16.0. * common.mk: rspec examples of bundler-1.16.0 needs require option. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/bundler/cache')
-rw-r--r--spec/bundler/cache/cache_path_spec.rb8
-rw-r--r--spec/bundler/cache/gems_spec.rb30
-rw-r--r--spec/bundler/cache/git_spec.rb37
-rw-r--r--spec/bundler/cache/path_spec.rb23
-rw-r--r--spec/bundler/cache/platform_spec.rb9
5 files changed, 55 insertions, 52 deletions
diff --git a/spec/bundler/cache/cache_path_spec.rb b/spec/bundler/cache/cache_path_spec.rb
index ec6d6e312a..69d3809964 100644
--- a/spec/bundler/cache/cache_path_spec.rb
+++ b/spec/bundler/cache/cache_path_spec.rb
@@ -1,5 +1,4 @@
# frozen_string_literal: true
-require "spec_helper"
RSpec.describe "bundle package" do
before do
@@ -24,11 +23,10 @@ RSpec.describe "bundle package" do
end
end
- context "when given an absolute path" do
- it "exits with non-zero status" do
+ context "with absolute --cache-path" do
+ it "caches gems at given path" do
bundle :package, "cache-path" => "/tmp/cache-foo"
- expect(out).to match(/must be relative/)
- expect(exitstatus).to eq(15) if exitstatus
+ expect(bundled_app("/tmp/cache-foo/rack-1.0.0.gem")).to exist
end
end
end
diff --git a/spec/bundler/cache/gems_spec.rb b/spec/bundler/cache/gems_spec.rb
index 7828c87fec..4a0b953830 100644
--- a/spec/bundler/cache/gems_spec.rb
+++ b/spec/bundler/cache/gems_spec.rb
@@ -1,15 +1,14 @@
# frozen_string_literal: true
-require "spec_helper"
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
@@ -28,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")
@@ -47,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"
@@ -57,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
@@ -74,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
@@ -87,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
@@ -119,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
@@ -184,7 +196,7 @@ RSpec.describe "bundle cache" do
it "adds and removes when gems are updated" do
update_repo2
- bundle "update"
+ bundle "update", :all => bundle_update_requires_all?
expect(cached_gem("rack-1.2")).to exist
expect(cached_gem("rack-1.0.0")).not_to exist
end
diff --git a/spec/bundler/cache/git_spec.rb b/spec/bundler/cache/git_spec.rb
index 31b3816a3b..33387dbbb2 100644
--- a/spec/bundler/cache/git_spec.rb
+++ b/spec/bundler/cache/git_spec.rb
@@ -1,5 +1,4 @@
# frozen_string_literal: true
-require "spec_helper"
RSpec.describe "git base name" do
it "base_name should strip private repo uris" do
@@ -13,7 +12,7 @@ RSpec.describe "git base name" do
end
end
-%w(cache package).each do |cmd|
+%w[cache package].each do |cmd|
RSpec.describe "bundle #{cmd} with git" do
it "copies repository to vendor cache and uses it" do
git = build_git "foo"
@@ -23,7 +22,7 @@ end
gem "foo", :git => '#{lib_path("foo-1.0")}'
G
- bundle "#{cmd} --all"
+ bundle "#{cmd}", forgotten_command_line_options([:all, :cache_all] => true)
expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist
expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.git")).not_to exist
expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.bundlecache")).to be_file
@@ -41,7 +40,7 @@ end
G
bundle "install --path vendor/bundle"
- bundle "#{cmd} --all"
+ bundle "#{cmd}", forgotten_command_line_options([:all, :cache_all] => true)
expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist
expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.git")).not_to exist
@@ -53,14 +52,14 @@ end
it "runs twice without exploding" do
build_git "foo"
- install_gemfile <<-G
+ install_gemfile! <<-G
gem "foo", :git => '#{lib_path("foo-1.0")}'
G
- bundle "#{cmd} --all"
- bundle "#{cmd} --all"
+ bundle! "#{cmd}", forgotten_command_line_options([:all, :cache_all] => true)
+ bundle! "#{cmd}", forgotten_command_line_options([:all, :cache_all] => true)
- expect(err).to lack_errors
+ expect(last_command.stdout).to include "Updating files in vendor/cache"
FileUtils.rm_rf lib_path("foo-1.0")
expect(the_bundle).to include_gems "foo 1.0"
end
@@ -73,7 +72,7 @@ end
gem "foo", :git => '#{lib_path("foo-1.0")}'
G
- bundle "#{cmd} --all"
+ bundle "#{cmd}", forgotten_command_line_options([:all, :cache_all] => true)
update_git "foo" do |s|
s.write "lib/foo.rb", "puts :CACHE"
@@ -82,14 +81,14 @@ end
ref = git.ref_for("master", 11)
expect(ref).not_to eq(old_ref)
- bundle "update"
- bundle "#{cmd} --all"
+ bundle! "update", :all => bundle_update_requires_all?
+ bundle! "#{cmd}", forgotten_command_line_options([:all, :cache_all] => true)
expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist
expect(bundled_app("vendor/cache/foo-1.0-#{old_ref}")).not_to exist
FileUtils.rm_rf lib_path("foo-1.0")
- run "require 'foo'"
+ run! "require 'foo'"
expect(out).to eq("CACHE")
end
@@ -101,7 +100,7 @@ end
gem "foo", :git => '#{lib_path("foo-1.0")}'
G
- bundle "#{cmd} --all"
+ bundle! cmd, forgotten_command_line_options([:all, :cache_all] => true)
update_git "foo" do |s|
s.write "lib/foo.rb", "puts :CACHE"
@@ -130,7 +129,7 @@ end
bundle %(config local.foo #{lib_path("foo-1.0")})
bundle "install"
- bundle "#{cmd} --all"
+ bundle "#{cmd}", forgotten_command_line_options([:all, :cache_all] => true)
expect(bundled_app("vendor/cache/foo-invalid-#{ref}")).to exist
@@ -162,14 +161,14 @@ end
G
ref = git.ref_for("master", 11)
- bundle "#{cmd} --all"
+ bundle "#{cmd}", forgotten_command_line_options([:all, :cache_all] => true)
expect(bundled_app("vendor/cache/has_submodule-1.0-#{ref}")).to exist
expect(bundled_app("vendor/cache/has_submodule-1.0-#{ref}/submodule-1.0")).to exist
expect(the_bundle).to include_gems "has_submodule 1.0"
end
- it "displays warning message when detecting git repo in Gemfile" do
+ it "displays warning message when detecting git repo in Gemfile", :bundler => "< 2" do
build_git "foo"
install_gemfile <<-G
@@ -188,8 +187,8 @@ end
gem "foo", :git => '#{lib_path("foo-1.0")}'
G
- bundle "#{cmd} --all"
- bundle "#{cmd}"
+ bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle cmd
expect(out).not_to include("Your Gemfile contains path and git dependencies.")
end
@@ -205,7 +204,7 @@ end
install_gemfile <<-G
gem "foo", :git => '#{lib_path("foo-1.0")}'
G
- bundle "#{cmd} --all"
+ bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
ref = git.ref_for("master", 11)
gemspec = bundled_app("vendor/cache/foo-1.0-#{ref}/foo.gemspec").read
diff --git a/spec/bundler/cache/path_spec.rb b/spec/bundler/cache/path_spec.rb
index bbce448759..8c6a843476 100644
--- a/spec/bundler/cache/path_spec.rb
+++ b/spec/bundler/cache/path_spec.rb
@@ -1,7 +1,6 @@
# frozen_string_literal: true
-require "spec_helper"
-%w(cache package).each do |cmd|
+%w[cache package].each do |cmd|
RSpec.describe "bundle #{cmd} with path" do
it "is no-op when the path is within the bundle" do
build_lib "foo", :path => bundled_app("lib/foo")
@@ -10,7 +9,7 @@ require "spec_helper"
gem "foo", :path => '#{bundled_app("lib/foo")}'
G
- bundle "#{cmd} --all"
+ bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
expect(bundled_app("vendor/cache/foo-1.0")).not_to exist
expect(the_bundle).to include_gems "foo 1.0"
end
@@ -22,7 +21,7 @@ require "spec_helper"
gem "foo", :path => '#{lib_path("foo-1.0")}'
G
- bundle "#{cmd} --all"
+ bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
expect(bundled_app("vendor/cache/foo-1.0")).to exist
expect(bundled_app("vendor/cache/foo-1.0/.bundlecache")).to be_file
@@ -40,7 +39,7 @@ require "spec_helper"
gem "#{libname}", :path => '#{libpath}'
G
- bundle "#{cmd} --all"
+ bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
expect(bundled_app("vendor/cache/#{libname}")).to exist
expect(bundled_app("vendor/cache/#{libname}/.bundlecache")).to be_file
@@ -55,13 +54,13 @@ require "spec_helper"
gem "foo", :path => '#{lib_path("foo-1.0")}'
G
- bundle "#{cmd} --all"
+ bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
build_lib "foo" do |s|
s.write "lib/foo.rb", "puts :CACHE"
end
- bundle "#{cmd} --all"
+ bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
expect(bundled_app("vendor/cache/foo-1.0")).to exist
FileUtils.rm_rf lib_path("foo-1.0")
@@ -77,17 +76,17 @@ require "spec_helper"
gem "foo", :path => '#{lib_path("foo-1.0")}'
G
- bundle "#{cmd} --all"
+ bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
install_gemfile <<-G
gem "bar", :path => '#{lib_path("bar-1.0")}'
G
- bundle "#{cmd} --all"
+ bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
expect(bundled_app("vendor/cache/bar-1.0")).not_to exist
end
- it "raises a warning without --all" do
+ it "raises a warning without --all", :bundler => "< 2" do
build_lib "foo"
install_gemfile <<-G
@@ -106,7 +105,7 @@ require "spec_helper"
gem "foo", :path => '#{lib_path("foo-1.0")}'
G
- bundle "#{cmd} --all"
+ bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
build_lib "bar"
install_gemfile <<-G
@@ -125,7 +124,7 @@ require "spec_helper"
gem "foo", :path => '#{lib_path("foo-1.0")}'
G
- bundle "#{cmd} --all"
+ bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
build_lib "baz"
gemfile <<-G
diff --git a/spec/bundler/cache/platform_spec.rb b/spec/bundler/cache/platform_spec.rb
index ed80c949aa..c0622a3c94 100644
--- a/spec/bundler/cache/platform_spec.rb
+++ b/spec/bundler/cache/platform_spec.rb
@@ -1,5 +1,4 @@
# frozen_string_literal: true
-require "spec_helper"
RSpec.describe "bundle cache with multiple platforms" do
before :each do
@@ -35,18 +34,14 @@ RSpec.describe "bundle cache with multiple platforms" do
end
it "ensures that a successful bundle install does not delete gems for other platforms" do
- bundle "install"
-
- expect(exitstatus).to eq 0 if exitstatus
+ bundle! "install"
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
expect(bundled_app("vendor/cache/activesupport-2.3.5.gem")).to exist
end
it "ensures that a successful bundle update does not delete gems for other platforms" do
- bundle "update"
-
- expect(exitstatus).to eq 0 if exitstatus
+ bundle! "update", :all => bundle_update_requires_all?
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
expect(bundled_app("vendor/cache/activesupport-2.3.5.gem")).to exist