summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBundlerbot <bot@bundler.io>2019-11-23 09:33:40 +0000
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-12-13 20:07:18 +0100
commitd2a122de2fbde44cc3e7774535c3bc641aaffdf7 (patch)
tree559e79a487e0d964089caee05856f4d6bef902d2
parentfdc0c230541883270d0c842222f802c478f32707 (diff)
downloadbundler-d2a122de2fbde44cc3e7774535c3bc641aaffdf7.tar.gz
Merge #7451
7451: Windows spec fixes r=deivid-rodriguez a=deivid-rodriguez ### What was the end-user problem that led to this PR? The problem was that we have a bunch of spec failures on Windows (~315). ### What is your fix for the problem, implemented in this PR? My fix is to improve some stuff to be more OS-independent. This should bring the failures down to ~305. Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net> (cherry picked from commit 0a866d013fcd1b81917d2c353fef1186d7aff153)
-rw-r--r--azure-pipelines.yml9
-rw-r--r--spec/bundler/env_spec.rb4
-rw-r--r--spec/install/gems/resolving_spec.rb2
-rw-r--r--spec/install/redownload_spec.rb2
-rw-r--r--spec/runtime/setup_spec.rb8
-rw-r--r--spec/support/artifice/compact_index.rb2
-rw-r--r--spec/support/artifice/compact_index_api_missing.rb2
-rw-r--r--spec/support/artifice/compact_index_extra_api_missing.rb2
-rw-r--r--spec/support/artifice/compact_index_extra_missing.rb2
-rw-r--r--spec/support/artifice/endpoint.rb2
-rw-r--r--spec/support/artifice/endpoint_api_missing.rb2
-rw-r--r--spec/support/artifice/endpoint_extra_missing.rb2
-rw-r--r--spec/support/artifice/windows.rb2
-rw-r--r--spec/support/builders.rb2
-rw-r--r--spec/support/rubygems_ext.rb2
15 files changed, 30 insertions, 15 deletions
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index d954482840..309e644487 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -1,3 +1,12 @@
+trigger:
+ branches:
+ include:
+ - master
+ - staging
+ - trying
+ - /.+-dev$/
+ - /.+-stable$/
+
jobs:
- job: Windows
pool:
diff --git a/spec/bundler/env_spec.rb b/spec/bundler/env_spec.rb
index f0ab5d5f35..7686fe386a 100644
--- a/spec/bundler/env_spec.rb
+++ b/spec/bundler/env_spec.rb
@@ -27,9 +27,9 @@ RSpec.describe Bundler::Env do
end
it "prints gem path" do
- with_clear_paths("GEM_PATH", "/a/b/c:/d/e/f") do
+ with_clear_paths("GEM_PATH", "/a/b/c#{File::PATH_SEPARATOR}d/e/f") do
out = described_class.report
- expect(out).to include("Gem Path /a/b/c:/d/e/f")
+ expect(out).to include("Gem Path /a/b/c#{File::PATH_SEPARATOR}d/e/f")
end
end
diff --git a/spec/install/gems/resolving_spec.rb b/spec/install/gems/resolving_spec.rb
index 26ff40f7aa..f7c72d7e31 100644
--- a/spec/install/gems/resolving_spec.rb
+++ b/spec/install/gems/resolving_spec.rb
@@ -22,7 +22,7 @@ RSpec.describe "bundle install with install-time dependencies" do
build_repo2
path = "#{gem_repo2}/#{Gem::MARSHAL_SPEC_DIR}/actionpack-2.3.2.gemspec.rz"
- spec = Marshal.load(Bundler.rubygems.inflate(File.read(path)))
+ spec = Marshal.load(Bundler.rubygems.inflate(File.binread(path)))
spec.dependencies.each do |d|
d.instance_variable_set(:@type, :fail)
end
diff --git a/spec/install/redownload_spec.rb b/spec/install/redownload_spec.rb
index 818c33bd61..c880b8bb15 100644
--- a/spec/install/redownload_spec.rb
+++ b/spec/install/redownload_spec.rb
@@ -17,7 +17,7 @@ RSpec.describe "bundle install" do
bundle! :install, flag => true
expect(out).to include "Installing rack 1.0.0"
- expect(rack_lib.open(&:read)).to eq("RACK = '1.0.0'\n")
+ expect(rack_lib.binread).to eq("RACK = '1.0.0'\n")
expect(the_bundle).to include_gems "rack 1.0.0"
end
diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb
index d86d1320ea..e247feb804 100644
--- a/spec/runtime/setup_spec.rb
+++ b/spec/runtime/setup_spec.rb
@@ -845,6 +845,12 @@ end
end
describe "when a vendored gem specification uses the :path option" do
+ let(:filesystem_root) do
+ current = Pathname.new(Dir.pwd)
+ current = current.parent until current == current.parent
+ current
+ end
+
it "should resolve paths relative to the Gemfile" do
path = bundled_app(File.join("vendor", "foo"))
build_lib "foo", :path => path
@@ -866,7 +872,7 @@ end
end
it "should make sure the Bundler.root is really included in the path relative to the Gemfile" do
- relative_path = File.join("vendor", Dir.pwd[1..-1], "foo")
+ relative_path = File.join("vendor", Dir.pwd.gsub(/^#{filesystem_root}/, ""))
absolute_path = bundled_app(relative_path)
FileUtils.mkdir_p(absolute_path)
build_lib "foo", :path => absolute_path
diff --git a/spec/support/artifice/compact_index.rb b/spec/support/artifice/compact_index.rb
index 89362c4dbc..72abf26224 100644
--- a/spec/support/artifice/compact_index.rb
+++ b/spec/support/artifice/compact_index.rb
@@ -10,7 +10,7 @@ class CompactIndexAPI < Endpoint
def load_spec(name, version, platform, gem_repo)
full_name = "#{name}-#{version}"
full_name += "-#{platform}" if platform != "ruby"
- Marshal.load(Bundler.rubygems.inflate(File.open(gem_repo.join("quick/Marshal.4.8/#{full_name}.gemspec.rz")).read))
+ Marshal.load(Bundler.rubygems.inflate(File.binread(gem_repo.join("quick/Marshal.4.8/#{full_name}.gemspec.rz"))))
end
def etag_response
diff --git a/spec/support/artifice/compact_index_api_missing.rb b/spec/support/artifice/compact_index_api_missing.rb
index fdd342bc08..6514fde01e 100644
--- a/spec/support/artifice/compact_index_api_missing.rb
+++ b/spec/support/artifice/compact_index_api_missing.rb
@@ -10,7 +10,7 @@ class CompactIndexApiMissing < CompactIndexAPI
if params[:id] == "rack-1.0.gemspec.rz"
halt 404
else
- File.read("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
+ File.binread("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
end
end
end
diff --git a/spec/support/artifice/compact_index_extra_api_missing.rb b/spec/support/artifice/compact_index_extra_api_missing.rb
index 6bd24ddbb4..b9d757c266 100644
--- a/spec/support/artifice/compact_index_extra_api_missing.rb
+++ b/spec/support/artifice/compact_index_extra_api_missing.rb
@@ -9,7 +9,7 @@ class CompactIndexExtraAPIMissing < CompactIndexExtraApi
if params[:id] == "missing-1.0.gemspec.rz"
halt 404
else
- File.read("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
+ File.binread("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
end
end
end
diff --git a/spec/support/artifice/compact_index_extra_missing.rb b/spec/support/artifice/compact_index_extra_missing.rb
index 4758b785ac..ff1e47a1bb 100644
--- a/spec/support/artifice/compact_index_extra_missing.rb
+++ b/spec/support/artifice/compact_index_extra_missing.rb
@@ -9,7 +9,7 @@ class CompactIndexExtraMissing < CompactIndexExtra
if params[:id] == "missing-1.0.gemspec.rz"
halt 404
else
- File.read("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
+ File.binread("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
end
end
end
diff --git a/spec/support/artifice/endpoint.rb b/spec/support/artifice/endpoint.rb
index bf26c56503..7bca681e70 100644
--- a/spec/support/artifice/endpoint.rb
+++ b/spec/support/artifice/endpoint.rb
@@ -68,7 +68,7 @@ class Endpoint < Sinatra::Base
def load_spec(name, version, platform, gem_repo)
full_name = "#{name}-#{version}"
full_name += "-#{platform}" if platform != "ruby"
- Marshal.load(Bundler.rubygems.inflate(File.open(gem_repo.join("quick/Marshal.4.8/#{full_name}.gemspec.rz")).read))
+ Marshal.load(Bundler.rubygems.inflate(File.binread(gem_repo.join("quick/Marshal.4.8/#{full_name}.gemspec.rz"))))
end
end
diff --git a/spec/support/artifice/endpoint_api_missing.rb b/spec/support/artifice/endpoint_api_missing.rb
index 8dafde7362..755c42e836 100644
--- a/spec/support/artifice/endpoint_api_missing.rb
+++ b/spec/support/artifice/endpoint_api_missing.rb
@@ -10,7 +10,7 @@ class EndpointApiMissing < Endpoint
if params[:id] == "rack-1.0.gemspec.rz"
halt 404
else
- File.read("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
+ File.binread("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
end
end
end
diff --git a/spec/support/artifice/endpoint_extra_missing.rb b/spec/support/artifice/endpoint_extra_missing.rb
index ee129025ff..5fd9238207 100644
--- a/spec/support/artifice/endpoint_extra_missing.rb
+++ b/spec/support/artifice/endpoint_extra_missing.rb
@@ -9,7 +9,7 @@ class EndpointExtraMissing < EndpointExtra
if params[:id] == "missing-1.0.gemspec.rz"
halt 404
else
- File.read("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
+ File.binread("#{gem_repo2}/quick/Marshal.4.8/#{params[:id]}")
end
end
end
diff --git a/spec/support/artifice/windows.rb b/spec/support/artifice/windows.rb
index ce7455b86c..21170c81d9 100644
--- a/spec/support/artifice/windows.rb
+++ b/spec/support/artifice/windows.rb
@@ -27,7 +27,7 @@ class Windows < Sinatra::Base
files.each do |file|
get "/#{file}" do
- File.read gem_repo.join(file)
+ File.binread gem_repo.join(file)
end
end
diff --git a/spec/support/builders.rb b/spec/support/builders.rb
index c7f299487c..331c0d11d2 100644
--- a/spec/support/builders.rb
+++ b/spec/support/builders.rb
@@ -620,7 +620,7 @@ module Spec
@files.each do |file, source|
file = Pathname.new(path).join(file)
FileUtils.mkdir_p(file.dirname)
- File.open(file, "w") {|f| f.puts source }
+ File.open(file, "wb") {|f| f.puts source }
end
@spec.files = @files.keys
path
diff --git a/spec/support/rubygems_ext.rb b/spec/support/rubygems_ext.rb
index 1d41807cc8..74ac7f50c5 100644
--- a/spec/support/rubygems_ext.rb
+++ b/spec/support/rubygems_ext.rb
@@ -65,7 +65,7 @@ module Spec
FileUtils.mkdir_p(Path.base_system_gems)
puts "installing gems for the tests to use..."
install_gems(DEPS)
- manifest_path.open("w") {|f| f << manifest.join }
+ manifest_path.open("wb") {|f| f << manifest.join }
end
FileUtils.mkdir_p(Path.home)