Skip to content

Commit

Permalink
Merge pull request #813 from cucumber/easy-windows-detection
Browse files Browse the repository at this point in the history
Use Ruby's built-in windows platform detection
  • Loading branch information
mvz authored Jun 20, 2021
2 parents b402e74 + a726aa9 commit 01eefdf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/aruba/platforms/unix_platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module Platforms
# @private
class UnixPlatform
def self.match?
!Cucumber::WINDOWS
!Gem.win_platform?
end

def environment_variables
Expand Down
4 changes: 1 addition & 3 deletions lib/aruba/platforms/windows_platform.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require "cucumber/platform"

require "aruba/platforms/unix_platform"
require "aruba/platforms/windows_command_string"
require "aruba/platforms/windows_environment_variables"
Expand All @@ -20,7 +18,7 @@ module Platforms
# @private
class WindowsPlatform < UnixPlatform
def self.match?
Cucumber::WINDOWS
Gem.win_platform?
end

# @see UnixPlatform#command_string
Expand Down
4 changes: 2 additions & 2 deletions spec/aruba/api/commands_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/aruba/processes/spawn_process_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down

0 comments on commit 01eefdf

Please sign in to comment.