mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[bundler/bundler] Always set cache_all
via config during tests
So that the behavior is the same regardless of the tested bundler
version.
664549427a
This commit is contained in:
parent
267a72be80
commit
2b7e39f364
7 changed files with 60 additions and 31 deletions
32
spec/bundler/cache/git_spec.rb
vendored
32
spec/bundler/cache/git_spec.rb
vendored
|
@ -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
|
||||
|
|
25
spec/bundler/cache/path_spec.rb
vendored
25
spec/bundler/cache/path_spec.rb
vendored
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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" => "" }
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue