From 2548d5b0e3aae6204274a9ab791cf485c898e230 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Thu, 30 May 2019 12:09:01 +0200 Subject: [PATCH] DEV: autospec chrome check was failing on macOS (#7649) --- lib/autospec/qunit_runner.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/autospec/qunit_runner.rb b/lib/autospec/qunit_runner.rb index 4f335a302d9..37bc6d76e03 100644 --- a/lib/autospec/qunit_runner.rb +++ b/lib/autospec/qunit_runner.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require "demon/rails_autospec" +require 'rbconfig' module Autospec @@ -116,13 +117,16 @@ module Autospec private def ensure_chrome_is_installed - - binary = "google-chrome-stable" if system("command -v google-chrome-stable >/dev/null;") + if RbConfig::CONFIG['host_os'][/darwin|mac os/] + binary = "/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome" + elsif system("command -v google-chrome-stable >/dev/null;") + binary = "google-chrome-stable" + end binary ||= "google-chrome" if system("command -v google-chrome >/dev/null;") raise ChromeNotInstalled.new if !binary - if Gem::Version.new(`#{binary} --version`.match(/[\d\.]+/)[0]) < Gem::Version.new("59") + if Gem::Version.new(`\"#{binary}\" --version`.match(/[\d\.]+/)[0]) < Gem::Version.new("59") raise "Chrome 59 or higher is required" end end