summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBundlerbot <bot@bundler.io>2019-07-06 14:27:30 +0000
committerBundlerbot <bot@bundler.io>2019-07-06 14:27:30 +0000
commit6ea383f8e2de364e72c3ac2c8be5cf688880e070 (patch)
tree45fad9dbbb12a8d4cd68207433b0f6ba93a4dea4
parentadf0e25fa23cbf1f62f40328a5f205f632dd6293 (diff)
parent1bd96607802d9b78cc6a9443dc73bb336a82ba54 (diff)
downloadbundler-6ea383f8e2de364e72c3ac2c8be5cf688880e070.tar.gz
Merge #7235
7235: Spec improvements r=deivid-rodriguez a=deivid-rodriguez This is a bunch of miscelaneous commits that fix and improve some stuff in our test suite. I could open separate PRs for them but they are so small that I figured I could compile them all on a single PR. Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
-rw-r--r--Rakefile12
-rw-r--r--spec/bundler/plugin/installer_spec.rb8
-rw-r--r--spec/commands/clean_spec.rb4
-rw-r--r--spec/commands/config_spec.rb10
-rw-r--r--spec/commands/exec_spec.rb5
-rw-r--r--spec/install/gemfile/git_spec.rb6
-rw-r--r--spec/runtime/setup_spec.rb4
-rw-r--r--spec/spec_helper.rb1
8 files changed, 21 insertions, 29 deletions
diff --git a/Rakefile b/Rakefile
index ffd59872d0..170dec5e4e 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 65f6b4ab6b..c7e0d06746 100644
--- a/spec/bundler/plugin/installer_spec.rb
+++ b/spec/bundler/plugin/installer_spec.rb
@@ -66,7 +66,7 @@ RSpec.describe Bundler::Plugin::Installer do
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 @@ RSpec.describe Bundler::Plugin::Installer do
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 @@ RSpec.describe Bundler::Plugin::Installer do
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 @@ RSpec.describe Bundler::Plugin::Installer do
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 17a533ef19..2243a72b3d 100644
--- a/spec/commands/clean_spec.rb
+++ b/spec/commands/clean_spec.rb
@@ -568,9 +568,7 @@ RSpec.describe "bundle clean" do
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 a087eeb206..c0ef3bb70c 100644
--- a/spec/commands/config_spec.rb
+++ b/spec/commands/config_spec.rb
@@ -478,12 +478,10 @@ end
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 8167aee3ae..b9be5d7c02 100644
--- a/spec/commands/exec_spec.rb
+++ b/spec/commands/exec_spec.rb
@@ -40,7 +40,7 @@ RSpec.describe "bundle exec" do
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 @@ RSpec.describe "bundle exec" do
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 fe51650f76..f2dcd33d7d 100644
--- a/spec/install/gemfile/git_spec.rb
+++ b/spec/install/gemfile/git_spec.rb
@@ -1003,10 +1003,8 @@ RSpec.describe "bundle install with git sources" do
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 51de4eb38a..3866bebb44 100644
--- a/spec/runtime/setup_spec.rb
+++ b/spec/runtime/setup_spec.rb
@@ -833,7 +833,9 @@ end
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 444f3a3cf3..a90d8e9885 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -71,7 +71,6 @@ RSpec.configure do |config|
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?