Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #11552: added_support_for_cygwin.diff

File added_support_for_cygwin.diff, 2.2 kB (added by kjeldahl, 3 months ago)

Patch for adding support for cygwin to javascript_test

  • test/javascript_test_test.rb

    old new  
    1717   
    1818  def test_javascript_test_runner 
    1919    assert runner_for(:success).successful? 
     20    # Ugly hack: waiting for port to be released 
     21                sleep 9 if (browser = JavaScriptTest::Browser.new; browser.cygwin? || browser.windows?) 
    2022    assert !(runner_for(:failure).successful?) 
    2123  end 
    2224   
  • lib/javascript_test.rb

    old new  
    2626    def linux? 
    2727      host.include?('linux') 
    2828    end 
     29 
     30    def cygwin? 
     31        host.include?('cygwin') 
     32        end 
    2933     
    3034    def applescript(script) 
    3135      raise "Can't run AppleScript on #{host}" unless macos? 
     
    4145    def visit(url) 
    4246      applescript('tell application "Firefox" to Get URL "' + url + '"') if macos?  
    4347      system("#{@path} #{url}") if windows?  
     48      system("'/cygdrive/c/Program Files/Mozilla Firefox/firefox' #{url}") if cygwin?  
    4449      system("firefox #{url}") if linux? 
    4550    end 
    4651   
     
    5055  end 
    5156   
    5257  class SafariBrowser < Browser 
     58    def initialize(path='c:\Program Files\Safari\safari.exe') 
     59      @path = path 
     60    end 
     61 
    5362    def supported? 
    54       macos? 
     63      macos? || windows? || cygwin? 
    5564    end 
    5665     
    5766    def setup 
     
    5968    end 
    6069     
    6170    def visit(url) 
    62       applescript('tell application "Safari" to set URL of front document to "' + url + '"') 
    63     end 
     71      applescript('tell application "Safari" to set URL of front document to "' + url + '"') if macos? 
     72      system("#{@path} #{url}") if windows?  
     73      system("'/cygdrive/c/Program Files/Safari/Safari.exe' #{url}") if cygwin?  
     74   end 
    6475   
    6576    def teardown 
    6677      #applescript('tell application "Safari" to close front document') 
     
    89100    end 
    90101   
    91102    def supported? 
    92       windows? 
     103      windows? || cygwin? 
    93104    end 
    94105     
    95106    def visit(url) 
    96107      system("#{@path} #{url}") if windows?  
     108      system("'/cygdrive/c/Program Files/Internet Explorer/IEXPLORE.EXE' #{url}") if cygwin?     
    97109    end 
    98110   
    99111    def to_s