diff --git a/Rakefile b/Rakefile index ffd59872d07..170dec5e4ec 100644 --- a/Rakefile +++ b/Rakefile @@ -3,12 +3,6 @@ $:.unshift File.expand_path("../lib", __FILE__) require "benchmark" -RUBYGEMS_REPO = if `git -C "#{File.expand_path("..")}" remote --verbose 2> #{IO::NULL}` =~ /rubygems/i - File.expand_path("..") -else - File.expand_path("tmp/rubygems") -end - def development_dependencies @development_dependencies ||= Gem::Specification.load("bundler.gemspec").development_dependencies end @@ -139,7 +133,11 @@ namespace :spec do end task "setup_co" do - ENV["RGV"] = RUBYGEMS_REPO + ENV["RGV"] = if `git -C "#{File.expand_path("..")}" remote --verbose 2> #{IO::NULL}` =~ /rubygems/i + File.expand_path("..") + else + File.expand_path("tmp/rubygems") + end end task "co" => "setup_co" diff --git a/spec/bundler/plugin/installer_spec.rb b/spec/bundler/plugin/installer_spec.rb index 65f6b4ab6b8..c7e0d067462 100644 --- a/spec/bundler/plugin/installer_spec.rb +++ b/spec/bundler/plugin/installer_spec.rb @@ -66,7 +66,7 @@ expect(spec.full_name).to eq "ga-plugin-1.0" end - it "has expected full gem path" do + it "has expected full_gem_path" do rev = revision_for(lib_path("ga-plugin")) expect(result["ga-plugin"].full_gem_path). to eq(Bundler::Plugin.root.join("bundler", "gems", "ga-plugin-#{rev[0..11]}").to_s) @@ -89,7 +89,7 @@ expect(spec.full_name).to eq "ga-plugin-1.0" end - it "has expected full gem path" do + it "has expected full_gem_path" do rev = revision_for(lib_path("ga-plugin")) expect(result["ga-plugin"].full_gem_path). to eq(Bundler::Plugin.root.join("bundler", "gems", "ga-plugin-#{rev[0..11]}").to_s) @@ -105,7 +105,7 @@ expect(result["re-plugin"]).to be_kind_of(Bundler::RemoteSpecification) end - it "has expected full_gem)path" do + it "has expected full_gem_path" do expect(result["re-plugin"].full_gem_path). to eq(global_plugin_gem("re-plugin-1.0").to_s) end @@ -121,7 +121,7 @@ expect(result["ma-plugin"]).to be_kind_of(Bundler::RemoteSpecification) end - it "has expected full_gem)path" do + it "has expected full_gem_path" do expect(result["re-plugin"].full_gem_path).to eq(global_plugin_gem("re-plugin-1.0").to_s) expect(result["ma-plugin"].full_gem_path).to eq(global_plugin_gem("ma-plugin-1.0").to_s) end diff --git a/spec/commands/clean_spec.rb b/spec/commands/clean_spec.rb index 17a533ef19e..2243a72b3d8 100644 --- a/spec/commands/clean_spec.rb +++ b/spec/commands/clean_spec.rb @@ -568,9 +568,7 @@ def should_not_have_gems(*gems) gemfile_lock.each_with_index do |line, index| gemfile_lock[index] = line[0..(11 + 7)] if line.include?(" revision:") end - File.open(bundled_app("Gemfile.lock"), "w") do |file| - file.print gemfile_lock.join("\n") - end + lockfile(bundled_app("Gemfile.lock"), gemfile_lock.join("\n")) bundle "install", forgotten_command_line_options(:path => "vendor/bundle") diff --git a/spec/commands/config_spec.rb b/spec/commands/config_spec.rb index a087eeb206f..c0ef3bb70c5 100644 --- a/spec/commands/config_spec.rb +++ b/spec/commands/config_spec.rb @@ -478,12 +478,10 @@ RSpec.describe "setting gemfile via config" do context "when only the non-default Gemfile exists" do it "persists the gemfile location to .bundle/config" do - File.open(bundled_app("NotGemfile"), "w") do |f| - f.write <<-G - source "#{file_uri_for(gem_repo1)}" - gem 'rack' - G - end + gemfile bundled_app("NotGemfile"), <<-G + source "#{file_uri_for(gem_repo1)}" + gem 'rack' + G bundle "config set --local gemfile #{bundled_app("NotGemfile")}" expect(File.exist?(".bundle/config")).to eq(true) diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb index 8167aee3ae7..b9be5d7c023 100644 --- a/spec/commands/exec_spec.rb +++ b/spec/commands/exec_spec.rb @@ -40,7 +40,7 @@ bundle "exec 'cd #{tmp("gems")} && rackup'" - expect(out).to include("1.0.0") + expect(out).to eq("1.0.0") end it "works when exec'ing something else" do @@ -453,13 +453,12 @@ it "works when unlocked" do bundle "exec 'cd #{tmp("gems")} && rackup'" expect(out).to eq("1.0.0") - expect(out).to include("1.0.0") end it "works when locked" do expect(the_bundle).to be_locked bundle "exec 'cd #{tmp("gems")} && rackup'" - expect(out).to include("1.0.0") + expect(out).to eq("1.0.0") end end diff --git a/spec/install/gemfile/git_spec.rb b/spec/install/gemfile/git_spec.rb index fe51650f763..f2dcd33d7df 100644 --- a/spec/install/gemfile/git_spec.rb +++ b/spec/install/gemfile/git_spec.rb @@ -1003,10 +1003,8 @@ update_git "valim" new_revision = revision_for(lib_path("valim-1.0")) - lockfile = File.read(bundled_app("Gemfile.lock")) - File.open(bundled_app("Gemfile.lock"), "w") do |file| - file.puts lockfile.gsub(/revision: #{old_revision}/, "revision: #{new_revision}") - end + old_lockfile = File.read(bundled_app("Gemfile.lock")) + lockfile(bundled_app("Gemfile.lock"), old_lockfile.gsub(/revision: #{old_revision}/, "revision: #{new_revision}")) bundle "install" diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb index 51de4eb38a0..3866bebb445 100644 --- a/spec/runtime/setup_spec.rb +++ b/spec/runtime/setup_spec.rb @@ -833,7 +833,9 @@ def clean_load_path(lp) ruby <<-R, :env => { "GEM_PATH" => symlinked_gem_home }, :no_lib => true TracePoint.trace(:class) do |tp| - puts "OMG" if tp.path.include?("bundler") && !tp.path.start_with?("#{File.expand_path("../..", __dir__)}") + if tp.path.include?("bundler") && !tp.path.start_with?("#{File.expand_path("../..", __dir__)}") + puts "OMG. Defining a class from another bundler at \#{tp.path}:\#{tp.lineno}" + end end gem 'bundler', '#{Bundler::VERSION}' require 'bundler/setup' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 444f3a3cf3a..a90d8e98857 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -71,7 +71,6 @@ def self.ruby=(ruby) config.filter_run_excluding :ruby => RequirementChecker.against(RUBY_VERSION) config.filter_run_excluding :rubygems => RequirementChecker.against(Gem::VERSION) config.filter_run_excluding :git => RequirementChecker.against(git_version) - config.filter_run_excluding :rubygems_master => (ENV["RGV"] != "master") config.filter_run_excluding :bundler => RequirementChecker.against(Bundler::VERSION.split(".")[0]) config.filter_run_excluding :ruby_repo => !(ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"]).nil? config.filter_run_excluding :non_windows => Gem.win_platform?