Skip to content

Commit 22ebbb0

Browse files
committed
Satisfy rubocop on the forward-ported Windows specs
These specs were authored directly in ruby/ruby, where this rubocop config does not lint them, so they reached for `/mswin/.match?` and a `%r{}` literal that Performance/StringInclude and Style/RegexpLiteral flag here. Align them with the equivalent `include?`/`//` forms.
1 parent 639af0c commit 22ebbb0

7 files changed

Lines changed: 12 additions & 12 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 /mswin/.match?(RUBY_PLATFORM)
89+
skip "The make jobserver is not available on Windows (nmake)" if RUBY_PLATFORM.include?("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 /mswin/.match?(RUBY_PLATFORM)
211+
skip "the legacy windows platform gem is not cached for the current mswin platform" if RUBY_PLATFORM.include?("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 /mswin/.match?(RUBY_PLATFORM)
75+
skip "https://github.com/ruby/rubygems/issues/3351" if RUBY_PLATFORM.include?("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 /mswin/.match?(RUBY_PLATFORM)
208+
skip "https://github.com/ruby/rubygems/issues/3351" if RUBY_PLATFORM.include?("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 /mswin/.match?(RUBY_PLATFORM)
637+
skip "https://github.com/ruby/rubygems/issues/3351" if RUBY_PLATFORM.include?("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 /mswin/.match?(RUBY_PLATFORM)
698+
skip "https://github.com/ruby/rubygems/issues/3351" if RUBY_PLATFORM.include?("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 /mswin/.match?(RUBY_PLATFORM)
720+
skip "https://github.com/ruby/rubygems/issues/3351" if RUBY_PLATFORM.include?("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 /mswin/.match?(RUBY_PLATFORM)
1355+
skip "The make jobserver is not available on Windows (nmake)" if RUBY_PLATFORM.include?("mswin")
13561356

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

spec/commands/lock_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1286,7 +1286,7 @@
12861286
end
12871287

12881288
it "does not conflict on ruby requirements when adding new platforms" do
1289-
skip "the raygun-apm fixture has no x64-mswin64 variant for the current platform" if /mswin/.match?(RUBY_PLATFORM)
1289+
skip "the raygun-apm fixture has no x64-mswin64 variant for the current platform" if RUBY_PLATFORM.include?("mswin")
12901290
build_repo4 do
12911291
build_gem "raygun-apm", "1.0.78" do |s|
12921292
s.platform = "x86_64-linux"

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 /mswin/.match?(RUBY_PLATFORM)
235+
skip "the generated Makefile uses MSVC `-libpath:` syntax instead of `-L` on Windows" if RUBY_PLATFORM.include?("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 /mswin/.match?(RUBY_PLATFORM)
253+
skip "the generated Makefile uses MSVC `-libpath:` syntax instead of `-L` on Windows" if RUBY_PLATFORM.include?("mswin")
254254
bundle "pristine"
255255

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

spec/support/path.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def tmp_root
133133
# that compare or look up paths across the two cannot be set up correctly.
134134
def tmp_and_source_on_different_drives?
135135
return false unless Gem.win_platform?
136-
drive = ->(path) { path.to_s[%r{\A[a-zA-Z]:}]&.upcase }
136+
drive = ->(path) { path.to_s[/\A[a-zA-Z]:/]&.upcase }
137137
drive[tmp_root] != drive[source_root]
138138
end
139139

0 commit comments

Comments
 (0)