diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2016-07-06 22:07:47 -0300 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-07-10 12:07:57 -0300 |
commit | fcb33a24a846fddd3cd6e09c5b36bf31072f1efd (patch) | |
tree | ccff229b91a3159b57ed1b329d53af7674cfbaa4 | |
parent | d7db30cbfa96f506f4605c24f00cd2fbe3b40dd8 (diff) | |
download | bundler-fcb33a24a846fddd3cd6e09c5b36bf31072f1efd.tar.gz |
Disallow updating gem_repo1 in the specs
-rw-r--r-- | spec/commands/viz_spec.rb | 4 | ||||
-rw-r--r-- | spec/install/binstubs_spec.rb | 4 | ||||
-rw-r--r-- | spec/install/gems/resolving_spec.rb | 18 | ||||
-rw-r--r-- | spec/support/artifice/compact_index.rb | 2 | ||||
-rw-r--r-- | spec/support/artifice/endpoint.rb | 11 | ||||
-rw-r--r-- | spec/support/builders.rb | 3 |
6 files changed, 23 insertions, 19 deletions
diff --git a/spec/commands/viz_spec.rb b/spec/commands/viz_spec.rb index 20dc9175d9..ee5736c61d 100644 --- a/spec/commands/viz_spec.rb +++ b/spec/commands/viz_spec.rb @@ -19,12 +19,12 @@ describe "bundle viz", :ruby => "1.9.3", :if => Bundler.which("dot") do end it "graphs gems that are prereleases" do - update_repo(gem_repo1) do + build_repo2 do build_gem "rack", "1.3.pre" end install_gemfile <<-G - source "file://#{gem_repo1}" + source "file://#{gem_repo2}" gem "rack", "= 1.3.pre" gem "rack-obama" G diff --git a/spec/install/binstubs_spec.rb b/spec/install/binstubs_spec.rb index 0686b449bb..1d55d2e0c7 100644 --- a/spec/install/binstubs_spec.rb +++ b/spec/install/binstubs_spec.rb @@ -23,14 +23,14 @@ describe "bundle install" do describe "when multiple gems contain the same exe" do before do - update_repo gem_repo1 do + build_repo2 do build_gem "fake", "14" do |s| s.executables = "rackup" end end install_gemfile <<-G, :binstubs => true - source "file://#{gem_repo1}" + source "file://#{gem_repo2}" gem "fake" gem "rack" G diff --git a/spec/install/gems/resolving_spec.rb b/spec/install/gems/resolving_spec.rb index 9aaaedf28d..a000ca816d 100644 --- a/spec/install/gems/resolving_spec.rb +++ b/spec/install/gems/resolving_spec.rb @@ -105,15 +105,15 @@ describe "bundle install with install-time dependencies" do describe "when a required ruby version" do context "allows only an older version" do it "installs the older version" do - update_repo gem_repo1 do + build_repo2 do build_gem "rack", "9001.0.0" do |s| s.required_ruby_version = "> 9000" end end - install_gemfile <<-G, :artifice => "compact_index" + install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2 } ruby "#{RUBY_VERSION}" - source "file://#{gem_repo1}" + source "http://localgemserver.test/" gem 'rack' G @@ -124,14 +124,14 @@ describe "bundle install with install-time dependencies" do context "allows no gems" do it "does not try to install those gems" do - update_repo gem_repo1 do + build_repo2 do build_gem "require_ruby" do |s| s.required_ruby_version = "> 9000" end end - install_gemfile <<-G, :artifice => "compact_index" - source "file://#{gem_repo1}" + install_gemfile <<-G + source "file://#{gem_repo2}" gem 'require_ruby' G @@ -143,14 +143,14 @@ describe "bundle install with install-time dependencies" do describe "when a required rubygems version disallows a gem" do it "does not try to install those gems" do - update_repo gem_repo1 do + build_repo2 do build_gem "require_rubygems" do |s| s.required_rubygems_version = "> 9000" end end - install_gemfile <<-G, :artifice => "compact_index" - source "file://#{gem_repo1}" + install_gemfile <<-G + source "file://#{gem_repo2}" gem 'require_rubygems' G diff --git a/spec/support/artifice/compact_index.rb b/spec/support/artifice/compact_index.rb index a9fe7112b0..233c192a67 100644 --- a/spec/support/artifice/compact_index.rb +++ b/spec/support/artifice/compact_index.rb @@ -63,7 +63,7 @@ class CompactIndexAPI < Endpoint end end - def gems(gem_repo = gem_repo1) + def gems(gem_repo = GEM_REPO) @gems ||= {} @gems[gem_repo] ||= begin specs = Bundler::Deprecate.skip_during do diff --git a/spec/support/artifice/endpoint.rb b/spec/support/artifice/endpoint.rb index b0e9bd0f26..2955889a86 100644 --- a/spec/support/artifice/endpoint.rb +++ b/spec/support/artifice/endpoint.rb @@ -13,11 +13,12 @@ require "artifice" require "sinatra/base" class Endpoint < Sinatra::Base + GEM_REPO = Pathname.new(ENV["BUNDLER_SPEC_GEM_REPO"] || Spec::Path.gem_repo1) set :raise_errors, true set :show_exceptions, false helpers do - def dependencies_for(gem_names, gem_repo = gem_repo1) + def dependencies_for(gem_names, gem_repo = GEM_REPO) return [] if gem_names.nil? || gem_names.empty? require "rubygems" @@ -50,11 +51,11 @@ class Endpoint < Sinatra::Base end get "/fetch/actual/gem/:id" do - File.read("#{gem_repo1}/quick/Marshal.4.8/#{params[:id]}") + File.read("#{GEM_REPO}/quick/Marshal.4.8/#{params[:id]}") end get "/gems/:id" do - File.read("#{gem_repo1}/gems/#{params[:id]}") + File.read("#{GEM_REPO}/gems/#{params[:id]}") end get "/api/v1/dependencies" do @@ -62,11 +63,11 @@ class Endpoint < Sinatra::Base end get "/specs.4.8.gz" do - File.read("#{gem_repo1}/specs.4.8.gz") + File.read("#{GEM_REPO}/specs.4.8.gz") end get "/prerelease_specs.4.8.gz" do - File.read("#{gem_repo1}/prerelease_specs.4.8.gz") + File.read("#{GEM_REPO}/prerelease_specs.4.8.gz") end end diff --git a/spec/support/builders.rb b/spec/support/builders.rb index d091ff69a9..891c785253 100644 --- a/spec/support/builders.rb +++ b/spec/support/builders.rb @@ -368,6 +368,9 @@ module Spec end def update_repo(path) + if path == gem_repo1 && caller_locations.first.label != "build_repo" + raise "Updating gem_repo1 is unsupported -- use gem_repo2 instead" + end return unless block_given? @_build_path = "#{path}/gems" yield |