summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-01-24 13:28:02 -0300
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-08-21 08:10:48 +0900
commitace88852f2c2dae52118d80cbf5800ea99e409e6 (patch)
tree44533e0e6b6390da2dff771ab20330566dd4d707
parentede77d82e709956cd1d3c849840107c84cd2e911 (diff)
[bundler/bundler] Parallelize test suite
https://github.com/bundler/bundler/commit/23007cb107
-rw-r--r--spec/bundler/bundler/source_spec.rb15
-rw-r--r--spec/bundler/runtime/load_spec.rb2
-rw-r--r--spec/bundler/support/path.rb9
-rw-r--r--spec/bundler/support/rubygems_ext.rb1
4 files changed, 22 insertions, 5 deletions
diff --git a/spec/bundler/bundler/source_spec.rb b/spec/bundler/bundler/source_spec.rb
index 46d86937da..5b11503d23 100644
--- a/spec/bundler/bundler/source_spec.rb
+++ b/spec/bundler/bundler/source_spec.rb
@@ -57,7 +57,10 @@ RSpec.describe Bundler::Source do
let(:locked_gem) { double(:locked_gem, :name => "nokogiri", :version => "< 1.5") }
context "with color", :no_color_tty do
- before { Bundler.ui = Bundler::UI::Shell.new }
+ before do
+ allow($stdout).to receive(:tty?).and_return(true)
+ Bundler.ui = Bundler::UI::Shell.new
+ end
it "should return a string with the spec name and version and locked spec version" do
expect(subject.version_message(spec)).to eq("nokogiri >= 1.6\e[32m (was < 1.5)\e[0m")
@@ -78,7 +81,10 @@ RSpec.describe Bundler::Source do
let(:locked_gem) { double(:locked_gem, :name => "nokogiri", :version => "1.7.0") }
context "with color", :no_color_tty do
- before { Bundler.ui = Bundler::UI::Shell.new }
+ before do
+ allow($stdout).to receive(:tty?).and_return(true)
+ Bundler.ui = Bundler::UI::Shell.new
+ end
it "should return a string with the locked spec version in yellow" do
expect(subject.version_message(spec)).to eq("nokogiri 1.6.1\e[33m (was 1.7.0)\e[0m")
@@ -99,7 +105,10 @@ RSpec.describe Bundler::Source do
let(:locked_gem) { double(:locked_gem, :name => "nokogiri", :version => "1.7.0") }
context "with color", :no_color_tty do
- before { Bundler.ui = Bundler::UI::Shell.new }
+ before do
+ allow($stdout).to receive(:tty?).and_return(true)
+ Bundler.ui = Bundler::UI::Shell.new
+ end
it "should return a string with the locked spec version in green" do
expect(subject.version_message(spec)).to eq("nokogiri 1.7.1\e[32m (was 1.7.0)\e[0m")
diff --git a/spec/bundler/runtime/load_spec.rb b/spec/bundler/runtime/load_spec.rb
index b7dc509f6f..acefc1a583 100644
--- a/spec/bundler/runtime/load_spec.rb
+++ b/spec/bundler/runtime/load_spec.rb
@@ -58,7 +58,7 @@ RSpec.describe "Bundler.load" do
end
it "does not find a Gemfile above the testing directory" do
- bundler_gemfile = tmp.join("../Gemfile")
+ bundler_gemfile = Pathname.new(__dir__).join("../../Gemfile")
unless File.exist?(bundler_gemfile)
FileUtils.touch(bundler_gemfile)
@remove_bundler_gemfile = true
diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb
index 3cf9cdd875..a5f938eada 100644
--- a/spec/bundler/support/path.rb
+++ b/spec/bundler/support/path.rb
@@ -42,7 +42,14 @@ module Spec
end
def tmp(*path)
- root.join("tmp", *path)
+ root.join("tmp", scope, *path)
+ end
+
+ def scope
+ test_number = ENV["TEST_ENV_NUMBER"]
+ return "" if test_number.nil?
+
+ test_number.empty? ? "1" : test_number
end
def home(*path)
diff --git a/spec/bundler/support/rubygems_ext.rb b/spec/bundler/support/rubygems_ext.rb
index aa04c3d00e..faa474a917 100644
--- a/spec/bundler/support/rubygems_ext.rb
+++ b/spec/bundler/support/rubygems_ext.rb
@@ -8,6 +8,7 @@ module Spec
module Rubygems
DEV_DEPS = {
"automatiek" => "~> 0.2.0",
+ "parallel_tests" => "~> 2.29",
"rake" => "~> 12.0",
"ronn" => "~> 0.7.3",
"rspec" => "~> 3.8",