diff --git a/lib/phantomjs/platform.rb b/lib/phantomjs/platform.rb index c35f281..bb5a11e 100644 --- a/lib/phantomjs/platform.rb +++ b/lib/phantomjs/platform.rb @@ -138,7 +138,7 @@ def package_url class Win32 < Platform class << self def useable? - host_os.include?('mingw32') and architecture.include?('i686') + !!(host_os =~ /mingw|mswin|cygwin/) end def platform @@ -156,6 +156,12 @@ def phantomjs_path def package_url 'https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-windows.zip' end + + def system_phantomjs_path + `where phantomjs`.delete("\n")[0] + rescue + end + end end end diff --git a/spec/platform_spec.rb b/spec/platform_spec.rb index ac3fd44..11399fc 100644 --- a/spec/platform_spec.rb +++ b/spec/platform_spec.rb @@ -170,7 +170,7 @@ describe "with system install" do before(:each) do Phantomjs::Platform.stub(:system_phantomjs_version).and_return(Phantomjs.version) - Phantomjs::Platform.stub(:system_phantomjs_path).and_return("#{ENV['TEMP']}/path") + Phantomjs::Platform::Win32.stub(:system_phantomjs_path).and_return("#{ENV['TEMP']}/path") end it "returns the correct phantom js executable path for the platform" do