diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2017-06-23 23:27:46 -0500 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2017-06-27 17:20:08 +0200 |
commit | 4dcd33379bdf203493f4ecbd28c04e519a8eab3d (patch) | |
tree | e725d22ef7ff97c08f4837107294432a12cb9ec9 | |
parent | 3497223754ed1928befd93f3be2ea998e2c5ae85 (diff) | |
download | bundler-seg-remove-rubygems-aggregate.tar.gz |
More bundler 2 spec fixesseg-remove-rubygems-aggregate
-rw-r--r-- | lib/bundler/definition.rb | 3 | ||||
-rw-r--r-- | lib/bundler/resolver.rb | 13 | ||||
-rw-r--r-- | lib/bundler/source/metadata.rb | 2 | ||||
-rw-r--r-- | spec/bundler/definition_spec.rb | 51 | ||||
-rw-r--r-- | spec/commands/newgem_spec.rb | 6 | ||||
-rw-r--r-- | spec/install/bundler_spec.rb | 2 | ||||
-rw-r--r-- | spec/install/gemfile/path_spec.rb | 5 | ||||
-rw-r--r-- | spec/install/gemfile/sources_spec.rb | 8 | ||||
-rw-r--r-- | spec/install/gems/compact_index_spec.rb | 83 | ||||
-rw-r--r-- | spec/install/gems/dependency_api_spec.rb | 107 | ||||
-rw-r--r-- | spec/install/gems/flex_spec.rb | 37 | ||||
-rw-r--r-- | spec/install/post_bundle_message_spec.rb | 17 | ||||
-rw-r--r-- | spec/install/yanked_spec.rb | 2 | ||||
-rw-r--r-- | spec/lock/lockfile_spec.rb | 30 | ||||
-rw-r--r-- | spec/plugins/source/example_spec.rb | 27 |
15 files changed, 349 insertions, 44 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index dc8bdc7bad..68bc40844e 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -925,7 +925,7 @@ module Bundler # specs will be available later when the resolver knows where to # look for that gemspec (or its dependencies) default = sources.default_source - source_requirements = { :default => default, "bundler" => sources.metadata_source } + source_requirements = { :default => default } default = nil unless Bundler.feature_flag.lockfile_uses_separate_rubygems_sources? dependencies.each do |dep| next unless source = dep.source || default @@ -934,6 +934,7 @@ module Bundler metadata_dependencies.each do |dep| source_requirements[dep.name] = sources.metadata_source end + source_requirements["bundler"] = sources.metadata_source # needs to come last to override source_requirements end diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb index 637c0b1313..8bdeae275f 100644 --- a/lib/bundler/resolver.rb +++ b/lib/bundler/resolver.rb @@ -415,6 +415,12 @@ module Bundler next if name == "bundler" next unless search_for(requirement).empty? + cache_message = begin + " or in gems cached in #{Bundler.settings.app_cache_path}" if Bundler.app_cache.exist? + rescue GemfileNotFound + nil + end + if (base = @base[name]) && !base.empty? version = base.first.version message = "You have requested:\n" \ @@ -426,18 +432,13 @@ module Bundler elsif source = @source_requirements[name] specs = source.specs[name] versions_with_platforms = specs.map {|s| [s.version, s.platform] } - message = String.new("Could not find gem '#{requirement}' in #{source}.\n") + message = String.new("Could not find gem '#{requirement}' in #{source}#{cache_message}.\n") message << if versions_with_platforms.any? "The source contains '#{name}' at: #{formatted_versions_with_platforms(versions_with_platforms)}" else "The source does not contain any versions of '#{requirement}'" end else - cache_message = begin - " or in gems cached in #{Bundler.settings.app_cache_path}" if Bundler.app_cache.exist? - rescue GemfileNotFound - nil - end message = "Could not find gem '#{requirement}' in any of the gem sources " \ "listed in your Gemfile#{cache_message}." end diff --git a/lib/bundler/source/metadata.rb b/lib/bundler/source/metadata.rb index e35a52e597..f6d2f0729d 100644 --- a/lib/bundler/source/metadata.rb +++ b/lib/bundler/source/metadata.rb @@ -22,6 +22,8 @@ module Bundler elsif local_spec = Bundler.rubygems.find_name("bundler").find {|s| s.version.to_s == VERSION } idx << local_spec end + + idx.each {|s| s.source = self } end end diff --git a/spec/bundler/definition_spec.rb b/spec/bundler/definition_spec.rb index ca280c70a1..4bc6b23106 100644 --- a/spec/bundler/definition_spec.rb +++ b/spec/bundler/definition_spec.rb @@ -107,7 +107,7 @@ RSpec.describe Bundler::Definition do G end - it "for a path gem with deps and no changes" do + it "for a path gem with deps and no changes", :bundler => "< 2" do build_lib "foo", "1.0", :path => lib_path("foo") do |s| s.add_dependency "rack", "1.0" s.add_development_dependency "net-ssh", "1.0" @@ -144,6 +144,43 @@ RSpec.describe Bundler::Definition do G end + it "for a path gem with deps and no changes", :bundler => "2" do + build_lib "foo", "1.0", :path => lib_path("foo") do |s| + s.add_dependency "rack", "1.0" + s.add_development_dependency "net-ssh", "1.0" + end + + install_gemfile <<-G + source "file://#{gem_repo1}" + gem "foo", :path => "#{lib_path("foo")}" + G + + bundle :check, :env => { "DEBUG" => 1 } + + expect(out).to match(/using resolution from the lockfile/) + lockfile_should_be <<-G + GEM + remote: file:#{gem_repo1}/ + specs: + rack (1.0.0) + + PATH + remote: #{lib_path("foo")} + specs: + foo (1.0) + rack (= 1.0) + + PLATFORMS + ruby + + DEPENDENCIES + foo! + + BUNDLED WITH + #{Bundler::VERSION} + G + end + it "for a rubygems gem" do install_gemfile <<-G source "file://#{gem_repo1}" @@ -197,6 +234,12 @@ RSpec.describe Bundler::Definition do end context "eager unlock" do + let(:source_list) do + Bundler::SourceList.new.tap do |source_list| + source_list.global_rubygems_source = "file://#{gem_repo4}" + end + end + before do gemfile <<-G source "file://#{gem_repo4}" @@ -240,11 +283,11 @@ RSpec.describe Bundler::Definition do definition = Bundler::Definition.new( bundled_app("Gemfile.lock"), updated_deps_in_gemfile, - Bundler::SourceList.new, + source_list, unlock_hash_for_bundle_install ) locked = definition.send(:converge_locked_specs).map(&:name) - expect(locked.include?("shared_dep")).to be_truthy + expect(locked).to include "shared_dep" end it "should not eagerly unlock shared dependency with bundle update conservative updating behavior" do @@ -254,7 +297,7 @@ RSpec.describe Bundler::Definition do definition = Bundler::Definition.new( bundled_app("Gemfile.lock"), updated_deps_in_gemfile, - Bundler::SourceList.new, + source_list, :gems => ["shared_owner_a"], :lock_shared_dependencies => true ) locked = definition.send(:converge_locked_specs).map(&:name) diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb index ebca2a2ddd..d08a0c0c6b 100644 --- a/spec/commands/newgem_spec.rb +++ b/spec/commands/newgem_spec.rb @@ -214,12 +214,10 @@ RSpec.describe "bundle gem" do end Dir.chdir(bundled_app("newgem")) do - bundle "exec rake build" + bundle! "exec rake build" end - expect(exitstatus).to be_zero if exitstatus - expect(out).not_to include("ERROR") - expect(err).not_to include("ERROR") + expect(last_command.stdboth).not_to include("ERROR") end context "gem naming with relative paths" do diff --git a/spec/install/bundler_spec.rb b/spec/install/bundler_spec.rb index ecddff616a..b59096e1ea 100644 --- a/spec/install/bundler_spec.rb +++ b/spec/install/bundler_spec.rb @@ -131,7 +131,7 @@ RSpec.describe "bundle install" do gem "rails", "3.0" G - simulate_bundler_version "10.0.0" + simulate_bundler_version "99999999.99.1" bundle "check" expect(out).to include("The Gemfile's dependencies are satisfied") diff --git a/spec/install/gemfile/path_spec.rb b/spec/install/gemfile/path_spec.rb index 5f5e82074b..283c66dbfa 100644 --- a/spec/install/gemfile/path_spec.rb +++ b/spec/install/gemfile/path_spec.rb @@ -281,8 +281,9 @@ RSpec.describe "bundle install with explicit source paths" do end install_gemfile <<-G - path "#{lib_path("foo-1.0")}" - gem 'foo' + path "#{lib_path("foo-1.0")}" do + gem 'foo' + end G expect(the_bundle).to include_gems "foo 1.0" diff --git a/spec/install/gemfile/sources_spec.rb b/spec/install/gemfile/sources_spec.rb index 285082438f..7641a14254 100644 --- a/spec/install/gemfile/sources_spec.rb +++ b/spec/install/gemfile/sources_spec.rb @@ -28,7 +28,7 @@ RSpec.describe "bundle install with gems on multiple sources" do bundle "config major_deprecations true" end - it "warns about ambiguous gems, but installs anyway, prioritizing sources last to first" do + it "warns about ambiguous gems, but installs anyway, prioritizing sources last to first", :bundler => "< 2" do bundle :install expect(out).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.") @@ -58,7 +58,7 @@ RSpec.describe "bundle install with gems on multiple sources" do bundle "config major_deprecations true" end - it "warns about ambiguous gems, but installs anyway" do + it "warns about ambiguous gems, but installs anyway", :bundler => "< 2" do bundle :install expect(out).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.") @@ -249,7 +249,7 @@ RSpec.describe "bundle install with gems on multiple sources" do G end - it "installs from the other source and warns about ambiguous gems" do + it "installs from the other source and warns about ambiguous gems", :bundler => "< 2" do bundle "config major_deprecations true" bundle :install expect(out).to have_major_deprecation a_string_including("Your Gemfile contains multiple primary sources.") @@ -277,7 +277,7 @@ RSpec.describe "bundle install with gems on multiple sources" do G end - it "installs the dependency from the pinned source without warning" do + it "installs the dependency from the pinned source without warning", :bundler => "< 2" do bundle :install expect(out).not_to include("Warning: the gem 'rack' was found in multiple sources.") diff --git a/spec/install/gems/compact_index_spec.rb b/spec/install/gems/compact_index_spec.rb index c9eae35016..fb5d97ce57 100644 --- a/spec/install/gems/compact_index_spec.rb +++ b/spec/install/gems/compact_index_spec.rb @@ -254,7 +254,7 @@ The checksum of /versions does not match the checksum provided by the server! So end end - it "fetches again when more dependencies are found in subsequent sources" do + it "fetches again when more dependencies are found in subsequent sources", :bundler => "< 2" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -269,7 +269,26 @@ The checksum of /versions does not match the checksum provided by the server! So G bundle! :install, :artifice => "compact_index_extra" - expect(the_bundle).to include_gems "back_deps 1.0" + expect(the_bundle).to include_gems "back_deps 1.0", "foo 1.0" + end + + it "fetches again when more dependencies are found in subsequent sources with source blocks" do + build_repo2 do + build_gem "back_deps" do |s| + s.add_dependency "foo" + end + FileUtils.rm_rf Dir[gem_repo2("gems/foo-*.gem")] + end + + gemfile <<-G + source "#{source_uri}" + source "#{source_uri}/extra" do + gem "back_deps" + end + G + + bundle! :install, :artifice => "compact_index_extra" + expect(the_bundle).to include_gems "back_deps 1.0", "foo 1.0" end it "fetches gem versions even when those gems are already installed" do @@ -295,7 +314,7 @@ The checksum of /versions does not match the checksum provided by the server! So expect(the_bundle).to include_gems "rack 1.2" end - it "considers all possible versions of dependencies from all api gem sources" do + it "considers all possible versions of dependencies from all api gem sources", :bundler => "< 2" do # In this scenario, the gem "somegem" only exists in repo4. It depends on specific version of activesupport that # exists only in repo1. There happens also be a version of activesupport in repo4, but not the one that version 1.0.0 # of somegem wants. This test makes sure that bundler actually finds version 1.2.3 of active support in the other @@ -319,6 +338,31 @@ The checksum of /versions does not match the checksum provided by the server! So expect(the_bundle).to include_gems "activesupport 1.2.3" end + it "considers all possible versions of dependencies from all api gem sources when using blocks", :bundler => "< 2" do + # In this scenario, the gem "somegem" only exists in repo4. It depends on specific version of activesupport that + # exists only in repo1. There happens also be a version of activesupport in repo4, but not the one that version 1.0.0 + # of somegem wants. This test makes sure that bundler actually finds version 1.2.3 of active support in the other + # repo and installs it. + build_repo4 do + build_gem "activesupport", "1.2.0" + build_gem "somegem", "1.0.0" do |s| + s.add_dependency "activesupport", "1.2.3" # This version exists only in repo1 + end + end + + gemfile <<-G + source "#{source_uri}" + source "#{source_uri}/extra" do + gem 'somegem', '1.0.0' + end + G + + bundle! :install, :artifice => "compact_index_extra_api" + + expect(the_bundle).to include_gems "somegem 1.0.0" + expect(the_bundle).to include_gems "activesupport 1.2.3" + end + it "prints API output properly with back deps" do build_repo2 do build_gem "back_deps" do |s| @@ -329,8 +373,9 @@ The checksum of /versions does not match the checksum provided by the server! So gemfile <<-G source "#{source_uri}" - source "#{source_uri}/extra" - gem "back_deps" + source "#{source_uri}/extra" do + gem "back_deps" + end G bundle! :install, :artifice => "compact_index_extra" @@ -355,8 +400,9 @@ The checksum of /versions does not match the checksum provided by the server! So gemfile <<-G source "#{source_uri}" - source "#{source_uri}/extra" - gem "back_deps" + source "#{source_uri}/extra" do + gem "back_deps" + end G bundle! :install, :artifice => "compact_index_extra_missing" @@ -398,7 +444,7 @@ The checksum of /versions does not match the checksum provided by the server! So expect(the_bundle).to include_gems "foo 1.0" end - it "fetches again when more dependencies are found in subsequent sources using --deployment" do + it "fetches again when more dependencies are found in subsequent sources using --deployment", :bundler => "< 2" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -418,6 +464,27 @@ The checksum of /versions does not match the checksum provided by the server! So expect(the_bundle).to include_gems "back_deps 1.0" end + it "fetches again when more dependencies are found in subsequent sources using --deployment with blocks" do + build_repo2 do + build_gem "back_deps" do |s| + s.add_dependency "foo" + end + FileUtils.rm_rf Dir[gem_repo2("gems/foo-*.gem")] + end + + gemfile <<-G + source "#{source_uri}" + source "#{source_uri}/extra" do + gem "back_deps" + end + G + + bundle! :install, :artifice => "compact_index_extra" + + bundle "install --deployment", :artifice => "compact_index_extra" + expect(the_bundle).to include_gems "back_deps 1.0" + end + it "does not refetch if the only unmet dependency is bundler" do gemfile <<-G source "#{source_uri}" diff --git a/spec/install/gems/dependency_api_spec.rb b/spec/install/gems/dependency_api_spec.rb index 60202d1658..14440652d6 100644 --- a/spec/install/gems/dependency_api_spec.rb +++ b/spec/install/gems/dependency_api_spec.rb @@ -244,7 +244,7 @@ RSpec.describe "gemcutter's dependency API" do end end - it "fetches again when more dependencies are found in subsequent sources" do + it "fetches again when more dependencies are found in subsequent sources", :bundler => "< 2" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -259,7 +259,26 @@ RSpec.describe "gemcutter's dependency API" do G bundle :install, :artifice => "endpoint_extra" - expect(the_bundle).to include_gems "back_deps 1.0" + expect(the_bundle).to include_gems "back_deps 1.0", "foo 1.0" + end + + it "fetches again when more dependencies are found in subsequent sources using blocks" do + build_repo2 do + build_gem "back_deps" do |s| + s.add_dependency "foo" + end + FileUtils.rm_rf Dir[gem_repo2("gems/foo-*.gem")] + end + + gemfile <<-G + source "#{source_uri}" + source "#{source_uri}/extra" do + gem "back_deps" + end + G + + bundle :install, :artifice => "endpoint_extra" + expect(the_bundle).to include_gems "back_deps 1.0", "foo 1.0" end it "fetches gem versions even when those gems are already installed" do @@ -284,7 +303,7 @@ RSpec.describe "gemcutter's dependency API" do expect(the_bundle).to include_gems "rack 1.2" end - it "considers all possible versions of dependencies from all api gem sources" do + it "considers all possible versions of dependencies from all api gem sources", :bundler => "< 2" do # In this scenario, the gem "somegem" only exists in repo4. It depends on specific version of activesupport that # exists only in repo1. There happens also be a version of activesupport in repo4, but not the one that version 1.0.0 # of somegem wants. This test makes sure that bundler actually finds version 1.2.3 of active support in the other @@ -308,6 +327,31 @@ RSpec.describe "gemcutter's dependency API" do expect(the_bundle).to include_gems "activesupport 1.2.3" end + it "considers all possible versions of dependencies from all api gem sources using blocks" do + # In this scenario, the gem "somegem" only exists in repo4. It depends on specific version of activesupport that + # exists only in repo1. There happens also be a version of activesupport in repo4, but not the one that version 1.0.0 + # of somegem wants. This test makes sure that bundler actually finds version 1.2.3 of active support in the other + # repo and installs it. + build_repo4 do + build_gem "activesupport", "1.2.0" + build_gem "somegem", "1.0.0" do |s| + s.add_dependency "activesupport", "1.2.3" # This version exists only in repo1 + end + end + + gemfile <<-G + source "#{source_uri}" + source "#{source_uri}/extra" do + gem 'somegem', '1.0.0' + end + G + + bundle :install, :artifice => "endpoint_extra_api" + + expect(the_bundle).to include_gems "somegem 1.0.0" + expect(the_bundle).to include_gems "activesupport 1.2.3" + end + it "prints API output properly with back deps" do build_repo2 do build_gem "back_deps" do |s| @@ -318,8 +362,9 @@ RSpec.describe "gemcutter's dependency API" do gemfile <<-G source "#{source_uri}" - source "#{source_uri}/extra" - gem "back_deps" + source "#{source_uri}/extra" do + gem "back_deps" + end G bundle :install, :artifice => "endpoint_extra" @@ -328,7 +373,7 @@ RSpec.describe "gemcutter's dependency API" do expect(out).to include("Fetching source index from http://localgemserver.test/extra") end - it "does not fetch every spec if the index of gems is large when doing back deps" do + it "does not fetch every spec if the index of gems is large when doing back deps", :bundler => "< 2" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -352,6 +397,31 @@ RSpec.describe "gemcutter's dependency API" do expect(the_bundle).to include_gems "back_deps 1.0" end + it "does not fetch every spec if the index of gems is large when doing back deps using blocks" do + build_repo2 do + build_gem "back_deps" do |s| + s.add_dependency "foo" + end + build_gem "missing" + # need to hit the limit + 1.upto(Bundler::Source::Rubygems::API_REQUEST_LIMIT) do |i| + build_gem "gem#{i}" + end + + FileUtils.rm_rf Dir[gem_repo2("gems/foo-*.gem")] + end + + gemfile <<-G + source "#{source_uri}" + source "#{source_uri}/extra" do + gem "back_deps" + end + G + + bundle :install, :artifice => "endpoint_extra_missing" + expect(the_bundle).to include_gems "back_deps 1.0" + end + it "uses the endpoint if all sources support it" do gemfile <<-G source "#{source_uri}" @@ -363,7 +433,7 @@ RSpec.describe "gemcutter's dependency API" do expect(the_bundle).to include_gems "foo 1.0" end - it "fetches again when more dependencies are found in subsequent sources using --deployment" do + it "fetches again when more dependencies are found in subsequent sources using --deployment", :bundler => "< 2" do build_repo2 do build_gem "back_deps" do |s| s.add_dependency "foo" @@ -383,6 +453,27 @@ RSpec.describe "gemcutter's dependency API" do expect(the_bundle).to include_gems "back_deps 1.0" end + it "fetches again when more dependencies are found in subsequent sources using --deployment with blocks" do + build_repo2 do + build_gem "back_deps" do |s| + s.add_dependency "foo" + end + FileUtils.rm_rf Dir[gem_repo2("gems/foo-*.gem")] + end + + gemfile <<-G + source "#{source_uri}" + source "#{source_uri}/extra" do + gem "back_deps" + end + G + + bundle :install, :artifice => "endpoint_extra" + + bundle "install --deployment", :artifice => "endpoint_extra" + expect(the_bundle).to include_gems "back_deps 1.0" + end + it "does not refetch if the only unmet dependency is bundler" do gemfile <<-G source "#{source_uri}" @@ -504,7 +595,7 @@ RSpec.describe "gemcutter's dependency API" do expect(out).not_to include("#{user}:#{password}") end - it "strips http basic auth creds when warning about ambiguous sources" do + it "strips http basic auth creds when warning about ambiguous sources", :bundler => "< 2" do gemfile <<-G source "#{basic_auth_source_uri}" source "file://#{gem_repo1}" diff --git a/spec/install/gems/flex_spec.rb b/spec/install/gems/flex_spec.rb index 30e1019cfa..d0f7c0af79 100644 --- a/spec/install/gems/flex_spec.rb +++ b/spec/install/gems/flex_spec.rb @@ -244,7 +244,7 @@ RSpec.describe "bundle flex_install" do end describe "when adding a new source" do - it "updates the lockfile" do + it "updates the lockfile", :bundler => "< 2" do build_repo2 install_gemfile! <<-G source "file://#{gem_repo1}" @@ -273,6 +273,41 @@ RSpec.describe "bundle flex_install" do #{Bundler::VERSION} L end + + it "updates the lockfile", :bundler => "2" do + build_repo2 + install_gemfile! <<-G + source "file://#{gem_repo1}" + gem "rack" + G + + install_gemfile! <<-G + source "file://#{gem_repo1}" + source "file://#{gem_repo2}" do + end + gem "rack" + G + + lockfile_should_be <<-L + GEM + remote: file:#{gem_repo1}/ + specs: + rack (1.0.0) + + GEM + remote: file:#{gem_repo2}/ + specs: + + PLATFORMS + ruby + + DEPENDENCIES + rack + + BUNDLED WITH + #{Bundler::VERSION} + L + end end # This was written to test github issue #636 diff --git a/spec/install/post_bundle_message_spec.rb b/spec/install/post_bundle_message_spec.rb index 77311a527f..bc700b5c4b 100644 --- a/spec/install/post_bundle_message_spec.rb +++ b/spec/install/post_bundle_message_spec.rb @@ -97,7 +97,7 @@ RSpec.describe "post bundle message" do end describe "with misspelled or non-existent gem name" do - it "should report a helpful error message" do + it "should report a helpful error message", :bundler => "< 2" do install_gemfile <<-G source "file://#{gem_repo1}" gem "rack" @@ -106,6 +106,18 @@ RSpec.describe "post bundle message" do expect(out).to include("Could not find gem 'not-a-gem' in any of the gem sources listed in your Gemfile.") end + it "should report a helpful error message", :bundler => "2" do + install_gemfile <<-G + source "file://#{gem_repo1}" + gem "rack" + gem "not-a-gem", :group => :development + G + expect(out).to include <<-EOS.strip +Could not find gem 'not-a-gem' in rubygems repository file:#{gem_repo1}/ or installed locally. +The source does not contain any versions of 'not-a-gem' + EOS + end + it "should report a helpful error message with reference to cache if available" do install_gemfile <<-G source "file://#{gem_repo1}" @@ -118,7 +130,8 @@ RSpec.describe "post bundle message" do gem "rack" gem "not-a-gem", :group => :development G - expect(out).to include("Could not find gem 'not-a-gem' in any of the gem sources listed in your Gemfile or in gems cached in vendor/cache.") + expect(out).to include("Could not find gem 'not-a-gem' in"). + and include("or in gems cached in vendor/cache.") end end end diff --git a/spec/install/yanked_spec.rb b/spec/install/yanked_spec.rb index 65783e294b..7c4b98bfdf 100644 --- a/spec/install/yanked_spec.rb +++ b/spec/install/yanked_spec.rb @@ -37,7 +37,7 @@ RSpec.context "when installing a bundle that includes yanked gems" do G expect(out).not_to include("Your bundle is locked to foo (10.0.0)") - expect(out).to include("Could not find gem 'foo (= 10.0.0)' in any of the gem sources") + expect(out).to include("Could not find gem 'foo (= 10.0.0)' in") end end diff --git a/spec/lock/lockfile_spec.rb b/spec/lock/lockfile_spec.rb index 2c4f2a6679..a502e4a282 100644 --- a/spec/lock/lockfile_spec.rb +++ b/spec/lock/lockfile_spec.rb @@ -426,7 +426,7 @@ RSpec.describe "the lockfile format", :bundler => "2" do expect(the_bundle).to include_gems "net-sftp 1.1.1", "net-ssh 1.0.0" end - it "generates a simple lockfile for a single pinned source, gem with a version requirement" do + it "generates a simple lockfile for a single pinned source, gem with a version requirement", :bundler => "< 2" do git = build_git "foo" install_gemfile <<-G @@ -454,6 +454,34 @@ RSpec.describe "the lockfile format", :bundler => "2" do G end + it "generates a simple lockfile for a single pinned source, gem with a version requirement" do + git = build_git "foo" + + install_gemfile <<-G + gem "foo", :git => "#{lib_path("foo-1.0")}" + G + + lockfile_should_be <<-G + GEM + specs: + + GIT + remote: #{lib_path("foo-1.0")} + revision: #{git.ref_for("master")} + specs: + foo (1.0) + + PLATFORMS + #{generic_local_platform} + + DEPENDENCIES + foo! + + BUNDLED WITH + #{Bundler::VERSION} + G + end + it "does not asplode when a platform specific dependency is present and the Gemfile has not been resolved on that platform" do build_lib "omg", :path => lib_path("omg") diff --git a/spec/plugins/source/example_spec.rb b/spec/plugins/source/example_spec.rb index 28fdd6c03f..748f083456 100644 --- a/spec/plugins/source/example_spec.rb +++ b/spec/plugins/source/example_spec.rb @@ -63,7 +63,7 @@ RSpec.describe "real source plugins" do expect(the_bundle).to include_gems("a-path-gem 1.0") end - it "writes to lock file" do + it "writes to lock file", :bundler => "< 2" do bundle "install" lockfile_should_be <<-G @@ -88,6 +88,31 @@ RSpec.describe "real source plugins" do G end + it "writes to lock file", :bundler => "2" do + bundle "install" + + lockfile_should_be <<-G + GEM + remote: file:#{gem_repo2}/ + specs: + + PLUGIN SOURCE + remote: #{lib_path("a-path-gem-1.0")} + type: mpath + specs: + a-path-gem (1.0) + + PLATFORMS + #{generic_local_platform} + + DEPENDENCIES + a-path-gem! + + BUNDLED WITH + #{Bundler::VERSION} + G + end + it "provides correct #full_gem_path" do bundle "install" run <<-RUBY |