From a726aa9b41fd50a1f78b151d971c545d7ae7b929 Mon Sep 17 00:00:00 2001 From: Matijs van Zuijlen Date: Sun, 13 Jun 2021 22:22:16 +0200 Subject: [PATCH] Use Ruby's built-in windows platform detection --- lib/aruba/platforms/unix_platform.rb | 2 +- lib/aruba/platforms/windows_platform.rb | 4 +--- spec/aruba/api/commands_spec.rb | 4 ++-- spec/aruba/processes/spawn_process_spec.rb | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/aruba/platforms/unix_platform.rb b/lib/aruba/platforms/unix_platform.rb index 0f9c7bb58..2831bbb26 100644 --- a/lib/aruba/platforms/unix_platform.rb +++ b/lib/aruba/platforms/unix_platform.rb @@ -31,7 +31,7 @@ module Platforms # @private class UnixPlatform def self.match? - !Cucumber::WINDOWS + !Gem.win_platform? end def environment_variables diff --git a/lib/aruba/platforms/windows_platform.rb b/lib/aruba/platforms/windows_platform.rb index d0e24c7be..c6bb35a51 100644 --- a/lib/aruba/platforms/windows_platform.rb +++ b/lib/aruba/platforms/windows_platform.rb @@ -1,5 +1,3 @@ -require "cucumber/platform" - require "aruba/platforms/unix_platform" require "aruba/platforms/windows_command_string" require "aruba/platforms/windows_environment_variables" @@ -20,7 +18,7 @@ module Platforms # @private class WindowsPlatform < UnixPlatform def self.match? - Cucumber::WINDOWS + Gem.win_platform? end # @see UnixPlatform#command_string diff --git a/spec/aruba/api/commands_spec.rb b/spec/aruba/api/commands_spec.rb index 3ac7e708f..9a9f64fc7 100644 --- a/spec/aruba/api/commands_spec.rb +++ b/spec/aruba/api/commands_spec.rb @@ -46,10 +46,10 @@ end context "when running a relative command" do - let(:cmd) { Cucumber::WINDOWS ? "bin/testcmd.bat" : "bin/testcmd" } + let(:cmd) { Gem.win_platform? ? "bin/testcmd.bat" : "bin/testcmd" } before do - if Cucumber::WINDOWS + if Gem.win_platform? @aruba.write_file cmd, <<~BAT exit 0 BAT diff --git a/spec/aruba/processes/spawn_process_spec.rb b/spec/aruba/processes/spawn_process_spec.rb index a2895b447..920761369 100644 --- a/spec/aruba/processes/spawn_process_spec.rb +++ b/spec/aruba/processes/spawn_process_spec.rb @@ -194,7 +194,7 @@ end describe "#send_signal" do - let(:signal) { Cucumber::WINDOWS ? 9 : "KILL" } + let(:signal) { Gem.win_platform? ? 9 : "KILL" } context "with a command that is running" do let(:cmd) { "bin/test-cli" }