diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2017-06-23 17:13:11 -0500 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2017-06-23 23:29:07 -0500 |
commit | 6b40a8a22bfb3f04e677a3de4d5b9329c689d2c2 (patch) | |
tree | 446a39339e9616e0f000cb1fbc9ac4f1003d7efb /spec/bundler | |
parent | f1ffdf65a07f5764c42dfd6bbb044d6afeda0b86 (diff) | |
download | bundler-6b40a8a22bfb3f04e677a3de4d5b9329c689d2c2.tar.gz |
Get the Bundler 2 specs passing with transitive source pinning
Diffstat (limited to 'spec/bundler')
-rw-r--r-- | spec/bundler/definition_spec.rb | 40 | ||||
-rw-r--r-- | spec/bundler/plugin/installer_spec.rb | 1 | ||||
-rw-r--r-- | spec/bundler/source_list_spec.rb | 39 |
3 files changed, 70 insertions, 10 deletions
diff --git a/spec/bundler/definition_spec.rb b/spec/bundler/definition_spec.rb index cb642da9f7..ca280c70a1 100644 --- a/spec/bundler/definition_spec.rb +++ b/spec/bundler/definition_spec.rb @@ -31,7 +31,7 @@ RSpec.describe Bundler::Definition do end describe "detects changes" do - it "for a path gem with changes" do + it "for a path gem with changes", :bundler => "< 2" do build_lib "foo", "1.0", :path => lib_path("foo") install_gemfile <<-G @@ -69,6 +69,44 @@ RSpec.describe Bundler::Definition do G end + it "for a path gem with changes", :bundler => "2" do + build_lib "foo", "1.0", :path => lib_path("foo") + + install_gemfile <<-G + source "file://#{gem_repo1}" + gem "foo", :path => "#{lib_path("foo")}" + G + + build_lib "foo", "1.0", :path => lib_path("foo") do |s| + s.add_dependency "rack", "1.0" + end + + bundle :install, :env => { "DEBUG" => 1 } + + expect(out).to match(/re-resolving dependencies/) + 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 path gem with deps and no changes" do build_lib "foo", "1.0", :path => lib_path("foo") do |s| s.add_dependency "rack", "1.0" diff --git a/spec/bundler/plugin/installer_spec.rb b/spec/bundler/plugin/installer_spec.rb index 8ede96ffea..f8bf8450c9 100644 --- a/spec/bundler/plugin/installer_spec.rb +++ b/spec/bundler/plugin/installer_spec.rb @@ -10,6 +10,7 @@ RSpec.describe Bundler::Plugin::Installer do describe "cli install" do it "uses Gem.sources when non of the source is provided" do sources = double(:sources) + Bundler.settings # initialize it before we have to touch rubygems.ext_lock allow(Bundler).to receive_message_chain("rubygems.sources") { sources } allow(installer).to receive(:install_rubygems). diff --git a/spec/bundler/source_list_spec.rb b/spec/bundler/source_list_spec.rb index 5489b367ec..915b638a46 100644 --- a/spec/bundler/source_list_spec.rb +++ b/spec/bundler/source_list_spec.rb @@ -115,18 +115,19 @@ RSpec.describe Bundler::SourceList do end end - describe "#add_rubygems_remote" do - before do - @returned_source = source_list.add_rubygems_remote("https://rubygems.org/") - end + describe "#add_rubygems_remote", :bundler => "< 2" do + let!(:returned_source) { source_list.add_rubygems_remote("https://rubygems.org/") } it "returns the aggregate rubygems source" do - expect(@returned_source).to be_instance_of(Bundler::Source::Rubygems) + expect(returned_source).to be_instance_of(Bundler::Source::Rubygems) end it "adds the provided remote to the beginning of the aggregate source" do source_list.add_rubygems_remote("https://othersource.org") - expect(@returned_source.remotes.first).to eq(URI("https://othersource.org/")) + expect(returned_source.remotes).to eq [ + URI("https://othersource.org/"), + URI("https://rubygems.org/"), + ] end end @@ -355,7 +356,7 @@ RSpec.describe Bundler::SourceList do end describe "#lock_sources" do - it "combines the rubygems sources into a single instance, removing duplicate remotes from the end" do + before do source_list.add_git_source("uri" => "git://third-git.org/path.git") source_list.add_rubygems_source("remotes" => ["https://duplicate-rubygems.org"]) source_list.add_plugin_source("new_source", "uri" => "https://third-bar.org/foo") @@ -369,7 +370,9 @@ RSpec.describe Bundler::SourceList do source_list.add_path_source("path" => "/first/path/to/gem") source_list.add_rubygems_source("remotes" => ["https://duplicate-rubygems.org"]) source_list.add_git_source("uri" => "git://first-git.org/path.git") + end + it "combines the rubygems sources into a single instance, removing duplicate remotes from the end", :bundler => "< 2" do expect(source_list.lock_sources).to eq [ Bundler::Source::Git.new("uri" => "git://first-git.org/path.git"), Bundler::Source::Git.new("uri" => "git://second-git.org/path.git"), @@ -387,6 +390,24 @@ RSpec.describe Bundler::SourceList do ]), ] end + + it "returns all sources, without combining rubygems sources", :bundler => "2" do + expect(source_list.lock_sources).to eq [ + Bundler::Source::Rubygems.new, + Bundler::Source::Rubygems.new("remotes" => ["https://duplicate-rubygems.org"]), + Bundler::Source::Rubygems.new("remotes" => ["https://first-rubygems.org"]), + Bundler::Source::Rubygems.new("remotes" => ["https://second-rubygems.org"]), + Bundler::Source::Rubygems.new("remotes" => ["https://third-rubygems.org"]), + Bundler::Source::Git.new("uri" => "git://first-git.org/path.git"), + Bundler::Source::Git.new("uri" => "git://second-git.org/path.git"), + Bundler::Source::Git.new("uri" => "git://third-git.org/path.git"), + Bundler::Source::Path.new("path" => "/first/path/to/gem"), + Bundler::Source::Path.new("path" => "/second/path/to/gem"), + Bundler::Source::Path.new("path" => "/third/path/to/gem"), + ASourcePlugin.new("uri" => "https://second-plugin.org/random"), + ASourcePlugin.new("uri" => "https://third-bar.org/foo"), + ] + end end describe "replace_sources!" do @@ -415,7 +436,7 @@ RSpec.describe Bundler::SourceList do end describe "#cached!" do - let(:rubygems_source) { source_list.add_rubygems_remote("https://rubygems.org") } + let(:rubygems_source) { source_list.add_rubygems_source("remotes" => ["https://rubygems.org"]) } let(:git_source) { source_list.add_git_source("uri" => "git://host/path.git") } let(:path_source) { source_list.add_path_source("path" => "/path/to/gem") } @@ -428,7 +449,7 @@ RSpec.describe Bundler::SourceList do end describe "#remote!" do - let(:rubygems_source) { source_list.add_rubygems_remote("https://rubygems.org") } + let(:rubygems_source) { source_list.add_rubygems_source("remotes" => ["https://rubygems.org"]) } let(:git_source) { source_list.add_git_source("uri" => "git://host/path.git") } let(:path_source) { source_list.add_path_source("path" => "/path/to/gem") } |