Skip to content

Commit

Permalink
DEV: autospec chrome check was failing on macOS (#7649)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjaffeux committed May 30, 2019
1 parent 11ab3c6 commit 2548d5b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/autospec/qunit_runner.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require "demon/rails_autospec"
require 'rbconfig'

module Autospec

Expand Down Expand Up @@ -116,13 +117,16 @@ def stop
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
Expand Down

0 comments on commit 2548d5b

Please sign in to comment.