summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-07-23 17:32:33 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-08-03 09:30:00 +0900
commit2b7e39f364d76c74af6e04aa3d96888a6aeef1cd (patch)
tree5e7a8c37f3d6e3f753f307f0835e51fdaa74f035 /spec
parent267a72be800da0ec47f441d7d8210dc6aec137af (diff)
[bundler/bundler] Always set `cache_all` via config during tests
So that the behavior is the same regardless of the tested bundler version. https://github.com/bundler/bundler/commit/664549427a
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/cache/git_spec.rb32
-rw-r--r--spec/bundler/cache/path_spec.rb25
-rw-r--r--spec/bundler/commands/package_spec.rb12
-rw-r--r--spec/bundler/install/deploy_spec.rb4
-rw-r--r--spec/bundler/install/gemfile/git_spec.rb3
-rw-r--r--spec/bundler/lock/lockfile_spec.rb3
-rw-r--r--spec/bundler/plugins/source/example_spec.rb12
7 files changed, 60 insertions, 31 deletions
diff --git a/spec/bundler/cache/git_spec.rb b/spec/bundler/cache/git_spec.rb
index 1348d033e2..85d1d29043 100644
--- a/spec/bundler/cache/git_spec.rb
+++ b/spec/bundler/cache/git_spec.rb
@@ -22,7 +22,8 @@ end
gem "foo", :git => '#{lib_path("foo-1.0")}'
G
- bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle "config set cache_all true"
+ bundle cmd
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
@@ -40,7 +41,8 @@ end
G
bundle "install --path vendor/bundle"
- bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle "config set cache_all true"
+ bundle cmd
expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist
expect(bundled_app("vendor/cache/foo-1.0-#{ref}/.git")).not_to exist
@@ -56,8 +58,9 @@ end
gem "foo", :git => '#{lib_path("foo-1.0")}'
G
- bundle! cmd, forgotten_command_line_options([:all, :cache_all] => true)
- bundle! cmd, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle "config set cache_all true"
+ bundle! cmd
+ bundle! cmd
expect(out).to include "Updating files in vendor/cache"
FileUtils.rm_rf lib_path("foo-1.0")
@@ -72,7 +75,8 @@ end
gem "foo", :git => '#{lib_path("foo-1.0")}'
G
- bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle "config set cache_all true"
+ bundle cmd
update_git "foo" do |s|
s.write "lib/foo.rb", "puts :CACHE"
@@ -82,7 +86,8 @@ end
expect(ref).not_to eq(old_ref)
bundle! "update", :all => true
- bundle! cmd, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle "config set cache_all true"
+ bundle! cmd
expect(bundled_app("vendor/cache/foo-1.0-#{ref}")).to exist
expect(bundled_app("vendor/cache/foo-1.0-#{old_ref}")).not_to exist
@@ -100,7 +105,8 @@ end
gem "foo", :git => '#{lib_path("foo-1.0")}'
G
- bundle! cmd, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle "config set cache_all true"
+ bundle! cmd
update_git "foo" do |s|
s.write "lib/foo.rb", "puts :CACHE"
@@ -129,7 +135,8 @@ end
bundle %(config set local.foo #{lib_path("foo-1.0")})
bundle "install"
- bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle "config set cache_all true"
+ bundle cmd
expect(bundled_app("vendor/cache/foo-invalid-#{ref}")).to exist
@@ -161,7 +168,8 @@ end
G
ref = git.ref_for("master", 11)
- bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle "config set cache_all true"
+ bundle cmd
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
@@ -187,7 +195,8 @@ end
gem "foo", :git => '#{lib_path("foo-1.0")}'
G
- bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle "config set cache_all true"
+ bundle cmd
bundle cmd
expect(err).not_to include("Your Gemfile contains path and git dependencies.")
@@ -204,7 +213,8 @@ end
install_gemfile <<-G
gem "foo", :git => '#{lib_path("foo-1.0")}'
G
- bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle "config set cache_all true"
+ bundle cmd
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 0d7b154a37..3bbd7b1805 100644
--- a/spec/bundler/cache/path_spec.rb
+++ b/spec/bundler/cache/path_spec.rb
@@ -9,7 +9,8 @@
gem "foo", :path => '#{bundled_app("lib/foo")}'
G
- bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
+ 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
@@ -21,7 +22,8 @@
gem "foo", :path => '#{lib_path("foo-1.0")}'
G
- bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
+ 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
@@ -39,7 +41,8 @@
gem "#{libname}", :path => '#{libpath}'
G
- bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
+ 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
@@ -54,13 +57,14 @@
gem "foo", :path => '#{lib_path("foo-1.0")}'
G
- bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle "config set cache_all true"
+ bundle cmd
build_lib "foo" do |s|
s.write "lib/foo.rb", "puts :CACHE"
end
- bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle cmd
expect(bundled_app("vendor/cache/foo-1.0")).to exist
FileUtils.rm_rf lib_path("foo-1.0")
@@ -76,13 +80,14 @@
gem "foo", :path => '#{lib_path("foo-1.0")}'
G
- bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle "config set cache_all true"
+ bundle cmd
install_gemfile <<-G
gem "bar", :path => '#{lib_path("bar-1.0")}'
G
- bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle cmd
expect(bundled_app("vendor/cache/bar-1.0")).not_to exist
end
@@ -105,7 +110,8 @@
gem "foo", :path => '#{lib_path("foo-1.0")}'
G
- bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle "config set cache_all true"
+ bundle cmd
build_lib "bar"
install_gemfile <<-G
@@ -124,7 +130,8 @@
gem "foo", :path => '#{lib_path("foo-1.0")}'
G
- bundle cmd, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle "config set cache_all true"
+ bundle cmd
build_lib "baz"
gemfile <<-G
diff --git a/spec/bundler/commands/package_spec.rb b/spec/bundler/commands/package_spec.rb
index e051743fd0..da22c002eb 100644
--- a/spec/bundler/commands/package_spec.rb
+++ b/spec/bundler/commands/package_spec.rb
@@ -24,7 +24,8 @@ RSpec.describe "bundle package" do
gem 'bundler'
D
- bundle :package, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle "config set cache_all true"
+ bundle :package
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
expect(bundled_app("vendor/cache/bundler-0.9.gem")).to_not exist
@@ -54,7 +55,8 @@ RSpec.describe "bundle package" do
gemspec
D
- bundle! :package, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle "config set cache_all true"
+ bundle! :package
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
expect(bundled_app("vendor/cache/nokogiri-1.4.2.gem")).to exist
@@ -85,7 +87,8 @@ RSpec.describe "bundle package" do
gemspec
D
- bundle! :package, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle "config set cache_all true"
+ bundle! :package
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
expect(bundled_app("vendor/cache/nokogiri-1.4.2.gem")).to exist
@@ -129,7 +132,8 @@ RSpec.describe "bundle package" do
gemspec :name => 'mygem_test'
D
- bundle! :package, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle "config set cache_all true"
+ bundle! :package
expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist
expect(bundled_app("vendor/cache/nokogiri-1.4.2.gem")).to exist
diff --git a/spec/bundler/install/deploy_spec.rb b/spec/bundler/install/deploy_spec.rb
index 3fb6d28943..79a344eaa1 100644
--- a/spec/bundler/install/deploy_spec.rb
+++ b/spec/bundler/install/deploy_spec.rb
@@ -388,7 +388,9 @@ You have deleted from the Gemfile:
bundle! :install
expect(the_bundle).to include_gems "foo 1.0"
- bundle! :package, forgotten_command_line_options([:all, :cache_all] => true)
+
+ bundle "config set cache_all true"
+ bundle! :package
expect(bundled_app("vendor/cache/foo")).to be_directory
bundle! "install --local"
diff --git a/spec/bundler/install/gemfile/git_spec.rb b/spec/bundler/install/gemfile/git_spec.rb
index f2dcd33d7d..afcac8b153 100644
--- a/spec/bundler/install/gemfile/git_spec.rb
+++ b/spec/bundler/install/gemfile/git_spec.rb
@@ -1390,7 +1390,8 @@ In Gemfile:
gem 'foo'
end
G
- bundle :package, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle "config set cache_all true"
+ bundle :package
simulate_new_machine
bundle! "install", :env => { "PATH" => "" }
diff --git a/spec/bundler/lock/lockfile_spec.rb b/spec/bundler/lock/lockfile_spec.rb
index e32bb83b3d..df30bc0400 100644
--- a/spec/bundler/lock/lockfile_spec.rb
+++ b/spec/bundler/lock/lockfile_spec.rb
@@ -620,7 +620,8 @@ RSpec.describe "the lockfile format" do
gem "foo", :path => "#{lib_path("foo-1.0")}"
G
- bundle! :package, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle "config set cache_all true"
+ bundle! :package
bundle! :install, :local => true
lockfile_should_be <<-G
diff --git a/spec/bundler/plugins/source/example_spec.rb b/spec/bundler/plugins/source/example_spec.rb
index 93b61b850a..7bc8fb0f29 100644
--- a/spec/bundler/plugins/source/example_spec.rb
+++ b/spec/bundler/plugins/source/example_spec.rb
@@ -145,7 +145,8 @@ RSpec.describe "real source plugins" do
let(:uri_hash) { Digest(:SHA1).hexdigest(lib_path("a-path-gem-1.0").to_s) }
it "copies repository to vendor cache and uses it" do
bundle "install"
- bundle :cache, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle "config set cache_all true"
+ bundle :cache
expect(bundled_app("vendor/cache/a-path-gem-1.0-#{uri_hash}")).to exist
expect(bundled_app("vendor/cache/a-path-gem-1.0-#{uri_hash}/.git")).not_to exist
@@ -157,7 +158,8 @@ RSpec.describe "real source plugins" do
it "copies repository to vendor cache and uses it even when installed with bundle --path" do
bundle! :install, forgotten_command_line_options(:path => "vendor/bundle")
- bundle! :cache, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle "config set cache_all true"
+ bundle! :cache
expect(bundled_app("vendor/cache/a-path-gem-1.0-#{uri_hash}")).to exist
@@ -167,7 +169,8 @@ RSpec.describe "real source plugins" do
it "bundler package copies repository to vendor cache" do
bundle! :install, forgotten_command_line_options(:path => "vendor/bundle")
- bundle! :package, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle "config set cache_all true"
+ bundle! :package
expect(bundled_app("vendor/cache/a-path-gem-1.0-#{uri_hash}")).to exist
@@ -492,7 +495,8 @@ RSpec.describe "real source plugins" do
end
G
- bundle :cache, forgotten_command_line_options([:all, :cache_all] => true)
+ bundle "config set cache_all true"
+ bundle :cache
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