Skip to content

Commit b384022

Browse files
committed
Add an mswin? spec helper for the Windows skips
The forward-ported specs repeated RUBY_PLATFORM.include?("mswin") to gate limitations specific to the nmake/MSVC build. Extract it into a Spec::Platforms predicate so the make jobserver skip and the other Windows skips share one definition.
1 parent 22ebbb0 commit b384022

6 files changed

Lines changed: 17 additions & 10 deletions

File tree

spec/bundler/installer/parallel_installer_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
# The make jobserver is a GNU make feature. On Windows extensions are built
8787
# with nmake, which has no `-j` jobserver, so the per-gem slot count never
8888
# appears in the build output.
89-
skip "The make jobserver is not available on Windows (nmake)" if RUBY_PLATFORM.include?("mswin")
89+
skip "The make jobserver is not available on Windows (nmake)" if mswin?
9090

9191
# When run under a parent make that already passes `-j` (e.g. ruby/ruby's
9292
# `make test-bundler-parallel`), RubyGems' extension builder sees the

spec/commands/cache_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@
208208
end
209209

210210
it "prints a warn when using legacy windows rubies" do
211-
skip "the legacy windows platform gem is not cached for the current mswin platform" if RUBY_PLATFORM.include?("mswin")
211+
skip "the legacy windows platform gem is not cached for the current mswin platform" if mswin?
212212
gemfile <<-D
213213
source "https://gem.repo1"
214214
gem 'myrack', :platforms => [:ruby_20, :x64_mingw_20]

spec/commands/exec_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
end
7373

7474
it "works when exec'ing to rubygems" do
75-
skip "https://github.com/ruby/rubygems/issues/3351" if RUBY_PLATFORM.include?("mswin")
75+
skip "https://github.com/ruby/rubygems/issues/3351" if mswin?
7676
install_gemfile "source \"https://gem.repo1\"; gem \"myrack\""
7777
bundle "exec #{gem_cmd} --version"
7878
expect(out).to eq(Gem::VERSION)
@@ -205,7 +205,7 @@
205205
end
206206

207207
it "uses version provided by ruby" do
208-
skip "https://github.com/ruby/rubygems/issues/3351" if RUBY_PLATFORM.include?("mswin")
208+
skip "https://github.com/ruby/rubygems/issues/3351" if mswin?
209209
bundle "exec erb --version"
210210

211211
expect(stdboth).to eq(default_erb_version)
@@ -634,7 +634,7 @@
634634

635635
describe "with gems bundled via :path with invalid gemspecs" do
636636
it "outputs the gemspec validation errors" do
637-
skip "https://github.com/ruby/rubygems/issues/3351" if RUBY_PLATFORM.include?("mswin")
637+
skip "https://github.com/ruby/rubygems/issues/3351" if mswin?
638638
build_lib "foo"
639639

640640
gemspec = lib_path("foo-1.0").join("foo.gemspec").to_s
@@ -695,7 +695,7 @@ def bin_path(a,b,c)
695695
end
696696

697697
it "works" do
698-
skip "https://github.com/ruby/rubygems/issues/3351" if RUBY_PLATFORM.include?("mswin")
698+
skip "https://github.com/ruby/rubygems/issues/3351" if mswin?
699699
bundle "exec #{gem_cmd} uninstall foo"
700700
expect(out).to eq("Successfully uninstalled foo-1.0")
701701
end
@@ -717,7 +717,7 @@ def bin_path(a,b,c)
717717
end
718718

719719
it "does not load plugins outside of the bundle" do
720-
skip "https://github.com/ruby/rubygems/issues/3351" if RUBY_PLATFORM.include?("mswin")
720+
skip "https://github.com/ruby/rubygems/issues/3351" if mswin?
721721
bundle "exec #{gem_cmd} -v"
722722
expect(out).not_to include("FAIL")
723723
end

spec/commands/install_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1352,7 +1352,7 @@ def run
13521352
# The make jobserver is a GNU make feature. On Windows extensions are built
13531353
# with nmake, which has no `-j` jobserver (and an inherited `-j` MAKEFLAGS
13541354
# even breaks nmake), so the slot count these examples assert never appears.
1355-
skip "The make jobserver is not available on Windows (nmake)" if RUBY_PLATFORM.include?("mswin")
1355+
skip "The make jobserver is not available on Windows (nmake)" if mswin?
13561356

13571357
@old_makeflags = ENV["MAKEFLAGS"]
13581358
@gemspec = nil

spec/commands/pristine_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@
232232
# This just verifies that the generated Makefile from the c_ext gem makes
233233
# use of the build_args from the bundle config
234234
it "applies the config when installing the gem" do
235-
skip "the generated Makefile uses MSVC `-libpath:` syntax instead of `-L` on Windows" if RUBY_PLATFORM.include?("mswin")
235+
skip "the generated Makefile uses MSVC `-libpath:` syntax instead of `-L` on Windows" if mswin?
236236
bundle "pristine"
237237

238238
makefile_contents = File.read(c_ext_dir.join("Makefile").to_s)
@@ -250,7 +250,7 @@
250250
# This just verifies that the generated Makefile from the c_ext gem makes
251251
# use of the build_args from the bundle config
252252
it "applies the config when installing the gem" do
253-
skip "the generated Makefile uses MSVC `-libpath:` syntax instead of `-L` on Windows" if RUBY_PLATFORM.include?("mswin")
253+
skip "the generated Makefile uses MSVC `-libpath:` syntax instead of `-L` on Windows" if mswin?
254254
bundle "pristine"
255255

256256
makefile_contents = File.read(c_ext_dir.join("Makefile").to_s)

spec/support/platforms.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ def not_local_tag
2828
[:jruby, :windows, :ruby].find {|tag| tag != local_tag }
2929
end
3030

31+
# The mswin build uses nmake and MSVC, which differ from the mingw build in
32+
# ways several specs need to skip (no make jobserver, MSVC Makefile syntax,
33+
# extensionless executables, mswin-only fixtures).
34+
def mswin?
35+
RUBY_PLATFORM.include?("mswin")
36+
end
37+
3138
def local_ruby_engine
3239
RUBY_ENGINE
3340
end

0 commit comments

Comments
 (0)