summaryrefslogtreecommitdiff
path: root/spec/bundler/cache/path_spec.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2019-11-11 17:57:45 +0900
committerSHIBATA Hiroshi <hsbt@ruby-lang.org>2019-11-11 18:56:25 +0900
commit7585bc31877d4f9725f8de51b4a2faf47acb6f34 (patch)
treeadf61a7c20f7e54b595ebde05284b5e2862f552c /spec/bundler/cache/path_spec.rb
parentfd69f82675bf93a848e5aa58d117bf8bbf604188 (diff)
Merge Bundler 2.1.0.pre.3
Features: - Add caller information to some deprecation messages to make them easier to fix [#7361](https://github.com/bundler/bundler/pull/7361) - Reconcile `bundle cache` vs `bundle package` everywhere. Now in docs, CLI help and everywhere else `bundle cache` is the preferred version and `bundle package` remains as an alias [#7389](https://github.com/bundler/bundler/pull/7389) - Display some basic `bundler` documentation together with ruby's RDoc based documentation [#7394](https://github.com/bundler/bundler/pull/7394) Bugfixes: - Fix typos deprecation message and upgrading docs [#7374](https://github.com/bundler/bundler/pull/7374) - Deprecation warnings about `taint` usage on ruby 2.7 [#7385](https://github.com/bundler/bundler/pull/7385) - Fix `--help` flag not correctly delegating to `man` when used with command aliases [#7388](https://github.com/bundler/bundler/pull/7388) - `bundle add` should cache newly added gems if an application cache exists [#7393](https://github.com/bundler/bundler/pull/7393) - Stop using an insecure folder as a "fallback home" when user home is not defined [#7416](https://github.com/bundler/bundler/pull/7416) - Fix `bundler/inline` warning about `Bundler.root` redefinition [#7417](https://github.com/bundler/bundler/pull/7417)
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2668
Diffstat (limited to 'spec/bundler/cache/path_spec.rb')
-rw-r--r--spec/bundler/cache/path_spec.rb214
1 files changed, 106 insertions, 108 deletions
diff --git a/spec/bundler/cache/path_spec.rb b/spec/bundler/cache/path_spec.rb
index 3bbd7b1805..79e8b4a82b 100644
--- a/spec/bundler/cache/path_spec.rb
+++ b/spec/bundler/cache/path_spec.rb
@@ -1,146 +1,144 @@
# frozen_string_literal: true
-%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")
-
- install_gemfile <<-G
- gem "foo", :path => '#{bundled_app("lib/foo")}'
- G
-
- bundle "config set cache_all true"
- bundle cmd
- expect(bundled_app("vendor/cache/foo-1.0")).not_to exist
- expect(the_bundle).to include_gems "foo 1.0"
- end
+RSpec.describe "bundle cache with path" do
+ it "is no-op when the path is within the bundle" do
+ build_lib "foo", :path => bundled_app("lib/foo")
+
+ install_gemfile <<-G
+ gem "foo", :path => '#{bundled_app("lib/foo")}'
+ G
+
+ bundle "config set cache_all true"
+ bundle :cache
+ expect(bundled_app("vendor/cache/foo-1.0")).not_to exist
+ expect(the_bundle).to include_gems "foo 1.0"
+ end
- it "copies when the path is outside the bundle " do
- build_lib "foo"
+ it "copies when the path is outside the bundle " do
+ build_lib "foo"
- install_gemfile <<-G
- gem "foo", :path => '#{lib_path("foo-1.0")}'
- G
+ install_gemfile <<-G
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
+ G
- bundle "config set cache_all true"
- bundle cmd
- expect(bundled_app("vendor/cache/foo-1.0")).to exist
- expect(bundled_app("vendor/cache/foo-1.0/.bundlecache")).to be_file
+ bundle "config set cache_all true"
+ bundle :cache
+ 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
+ FileUtils.rm_rf lib_path("foo-1.0")
+ expect(the_bundle).to include_gems "foo 1.0"
+ 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)
+ 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)
- build_lib libname, :path => libpath
+ build_lib libname, :path => libpath
- install_gemfile <<-G
- gem "#{libname}", :path => '#{libpath}'
- G
+ install_gemfile <<-G
+ gem "#{libname}", :path => '#{libpath}'
+ G
- bundle "config set cache_all true"
- bundle cmd
- expect(bundled_app("vendor/cache/#{libname}")).to exist
- expect(bundled_app("vendor/cache/#{libname}/.bundlecache")).to be_file
+ bundle "config set cache_all true"
+ bundle :cache
+ 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
+ FileUtils.rm_rf libpath
+ expect(the_bundle).to include_gems "#{libname} 1.0"
+ end
- it "updates the path on each cache" do
- build_lib "foo"
+ it "updates the path on each cache" do
+ build_lib "foo"
- install_gemfile <<-G
- gem "foo", :path => '#{lib_path("foo-1.0")}'
- G
+ install_gemfile <<-G
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
+ G
- bundle "config set cache_all true"
- bundle cmd
+ bundle "config set cache_all true"
+ bundle :cache
- build_lib "foo" do |s|
- s.write "lib/foo.rb", "puts :CACHE"
- end
+ build_lib "foo" do |s|
+ s.write "lib/foo.rb", "puts :CACHE"
+ end
- bundle cmd
+ bundle :cache
- expect(bundled_app("vendor/cache/foo-1.0")).to exist
- FileUtils.rm_rf lib_path("foo-1.0")
+ 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")
- end
+ run "require 'foo'"
+ expect(out).to eq("CACHE")
+ end
- it "removes stale entries cache" do
- build_lib "foo"
+ it "removes stale entries cache" do
+ build_lib "foo"
- install_gemfile <<-G
- gem "foo", :path => '#{lib_path("foo-1.0")}'
- G
+ install_gemfile <<-G
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
+ G
- bundle "config set cache_all true"
- bundle cmd
+ bundle "config set cache_all true"
+ bundle :cache
- install_gemfile <<-G
- gem "bar", :path => '#{lib_path("bar-1.0")}'
- G
+ install_gemfile <<-G
+ gem "bar", :path => '#{lib_path("bar-1.0")}'
+ G
- bundle cmd
- expect(bundled_app("vendor/cache/bar-1.0")).not_to exist
- end
+ bundle :cache
+ expect(bundled_app("vendor/cache/bar-1.0")).not_to exist
+ end
- it "raises a warning without --all", :bundler => "< 3" do
- build_lib "foo"
+ it "raises a warning without --all", :bundler => "< 3" do
+ build_lib "foo"
- install_gemfile <<-G
- gem "foo", :path => '#{lib_path("foo-1.0")}'
- G
+ install_gemfile <<-G
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
+ G
- bundle cmd
- expect(err).to match(/please pass the \-\-all flag/)
- expect(bundled_app("vendor/cache/foo-1.0")).not_to exist
- end
+ bundle :cache
+ expect(err).to match(/please pass the \-\-all flag/)
+ expect(bundled_app("vendor/cache/foo-1.0")).not_to exist
+ end
- it "stores the given flag" do
- build_lib "foo"
+ it "stores the given flag" do
+ build_lib "foo"
- install_gemfile <<-G
- gem "foo", :path => '#{lib_path("foo-1.0")}'
- G
+ install_gemfile <<-G
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
+ G
- bundle "config set cache_all true"
- bundle cmd
- build_lib "bar"
+ bundle "config set cache_all true"
+ bundle :cache
+ build_lib "bar"
- install_gemfile <<-G
- gem "foo", :path => '#{lib_path("foo-1.0")}'
- gem "bar", :path => '#{lib_path("bar-1.0")}'
- G
+ install_gemfile <<-G
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
+ gem "bar", :path => '#{lib_path("bar-1.0")}'
+ G
- bundle cmd
- expect(bundled_app("vendor/cache/bar-1.0")).to exist
- end
+ bundle :cache
+ expect(bundled_app("vendor/cache/bar-1.0")).to exist
+ end
- it "can rewind chosen configuration" do
- build_lib "foo"
+ it "can rewind chosen configuration" do
+ build_lib "foo"
- install_gemfile <<-G
- gem "foo", :path => '#{lib_path("foo-1.0")}'
- G
+ install_gemfile <<-G
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
+ G
- bundle "config set cache_all true"
- bundle cmd
- build_lib "baz"
+ bundle "config set cache_all true"
+ bundle :cache
+ build_lib "baz"
- gemfile <<-G
- gem "foo", :path => '#{lib_path("foo-1.0")}'
- gem "baz", :path => '#{lib_path("baz-1.0")}'
- G
+ gemfile <<-G
+ gem "foo", :path => '#{lib_path("foo-1.0")}'
+ gem "baz", :path => '#{lib_path("baz-1.0")}'
+ G
- bundle "#{cmd} --no-all"
- expect(bundled_app("vendor/cache/baz-1.0")).not_to exist
- end
+ bundle "cache --no-all"
+ expect(bundled_app("vendor/cache/baz-1.0")).not_to exist
end
end