diff options
author | Bundlerbot <bot@bundler.io> | 2019-03-13 12:26:45 +0000 |
---|---|---|
committer | Bundlerbot <bot@bundler.io> | 2019-03-13 12:26:45 +0000 |
commit | b65b0753de844f33a03ebfcc7ef490856f5a72e3 (patch) | |
tree | 73eba48ecb219e8a3636c8b6c52e4847f69c40fc | |
parent | daac5198330e960ea8f4747f00ba9be00fcff71d (diff) | |
parent | f1b756db99d44e5ce148069881215bfb62db6243 (diff) | |
download | bundler-b65b0753de844f33a03ebfcc7ef490856f5a72e3.tar.gz |
Merge #7027
7027: Spec simplifications r=deivid-rodriguez a=deivid-rodriguez
### What was the end-user problem that led to this PR?
The problem was that the current specs don't pass under docker.
### What was your diagnosis of the problem?
My diagnosis was that we should use 0.0.0.0 instead of 127.0.0.1 for mirror specs, since docker likes it better and the change doesn't affect the intention of the specs.
### What is your fix for the problem, implemented in this PR?
My fix is to do that change, but also add a few extra simplifications that I created while setting up the specs to run inside a docker image.
### Why did you choose this fix out of the possible options?
I chose this fix because it works and makes the test setup simpler.
Co-authored-by: David RodrÃguez <deivid.rodriguez@riseup.net>
-rw-r--r-- | spec/bundler/gem_helper_spec.rb | 7 | ||||
-rw-r--r-- | spec/bundler/mirror_spec.rb | 4 | ||||
-rw-r--r-- | spec/bundler/vendored_persistent_spec.rb | 1 | ||||
-rw-r--r-- | spec/commands/info_spec.rb | 2 | ||||
-rw-r--r-- | spec/commands/install_spec.rb | 4 | ||||
-rw-r--r-- | spec/spec_helper.rb | 8 | ||||
-rw-r--r-- | spec/support/helpers.rb | 2 | ||||
-rw-r--r-- | spec/support/rubygems_ext.rb | 2 |
8 files changed, 11 insertions, 19 deletions
diff --git a/spec/bundler/gem_helper_spec.rb b/spec/bundler/gem_helper_spec.rb index e2cd7e8bc6..dc982c6ee7 100644 --- a/spec/bundler/gem_helper_spec.rb +++ b/spec/bundler/gem_helper_spec.rb @@ -209,11 +209,12 @@ RSpec.describe Bundler::GemHelper do end context "succeeds" do + let(:repo) { build_git("foo", :bare => true) } + before do - Dir.chdir(gem_repo1) { `git init --bare` } Dir.chdir(app_path) do - `git remote add origin file://#{gem_repo1}` - `git commit -a -m "initial commit"` + sys_exec("git remote add origin file://#{repo.path}") + sys_exec('git commit -a -m "initial commit"') end end diff --git a/spec/bundler/mirror_spec.rb b/spec/bundler/mirror_spec.rb index acd0895f2f..fb476b8465 100644 --- a/spec/bundler/mirror_spec.rb +++ b/spec/bundler/mirror_spec.rb @@ -298,8 +298,8 @@ RSpec.describe Bundler::Settings::TCPSocketProbe do context "with a listening TCP Server" do def with_server_and_mirror - server = TCPServer.new("127.0.0.1", 0) - mirror = Bundler::Settings::Mirror.new("http://localhost:#{server.addr[1]}", 1) + server = TCPServer.new("0.0.0.0", 0) + mirror = Bundler::Settings::Mirror.new("http://0.0.0.0:#{server.addr[1]}", 1) yield server, mirror server.close unless server.closed? end diff --git a/spec/bundler/vendored_persistent_spec.rb b/spec/bundler/vendored_persistent_spec.rb index d62279447d..c760c067e0 100644 --- a/spec/bundler/vendored_persistent_spec.rb +++ b/spec/bundler/vendored_persistent_spec.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -require "spec_helper" require "bundler/vendored_persistent" RSpec.describe Bundler::PersistentHTTP do diff --git a/spec/commands/info_spec.rb b/spec/commands/info_spec.rb index 39e97a05f3..70a304823a 100644 --- a/spec/commands/info_spec.rb +++ b/spec/commands/info_spec.rb @@ -34,7 +34,7 @@ RSpec.describe "bundle info" do context "when gem does not have homepage" do before do - build_repo1 do + build_repo2 do build_gem "rails", "2.3.2" do |s| s.executables = "rails" s.summary = "Just another test gem" diff --git a/spec/commands/install_spec.rb b/spec/commands/install_spec.rb index f4cb114623..c198797862 100644 --- a/spec/commands/install_spec.rb +++ b/spec/commands/install_spec.rb @@ -374,13 +374,13 @@ RSpec.describe "bundle install with gem sources" do it "gracefully handles error when rubygems server is unavailable" do install_gemfile <<-G, :artifice => nil source "file://#{gem_repo1}" - source "http://localhost:9384" do + source "http://0.0.0.0:9384" do gem 'foo' end G bundle :install, :artifice => nil - expect(err).to include("Could not fetch specs from http://localhost:9384/") + expect(err).to include("Could not fetch specs from http://0.0.0.0:9384/") expect(err).not_to include("file://") end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 7cc363087c..dbfeb30db7 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,13 +4,6 @@ $:.unshift File.expand_path("..", __FILE__) $:.unshift File.expand_path("../../lib", __FILE__) require "rubygems" -module Gem - if defined?(@path_to_default_spec_map) - @path_to_default_spec_map.delete_if do |_path, spec| - spec.name == "bundler" - end - end -end begin require File.expand_path("../support/path.rb", __FILE__) @@ -43,7 +36,6 @@ $debug = false Spec::Manpages.setup unless Gem.win_platform? Spec::Rubygems.setup -FileUtils.rm_rf(Spec::Path.gem_repo1) ENV["RUBYOPT"] = "#{ENV["RUBYOPT"]} -r#{Spec::Path.spec_dir}/support/hax.rb" ENV["BUNDLE_SPEC_RUN"] = "true" diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index a222957c10..a5ff292f01 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -429,7 +429,7 @@ module Spec ENV["GEM_PATH"] = system_gem_path.to_s gems.each do |gem| - gem_command :install, "--no-rdoc --no-ri #{gem}" + gem_command :install, "--no-document #{gem}" end return unless block_given? begin diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb index f031570e33..edd66278ad 100644 --- a/spec/support/rubygems_ext.rb +++ b/spec/support/rubygems_ext.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require "rubygems/user_interaction" -require "support/path" unless defined?(Spec::Path) +require "support/path" module Spec module Rubygems |