Class: Browser

Inherits:
Object
  • Object
show all
Defined in:
lib/newjs/jstest.rb,
lib/newjs/autotest/javascript_test_ext.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Browser

Returns a new instance of Browser.



2
3
4
5
6
7
# File 'lib/newjs/autotest/javascript_test_ext.rb', line 2

def initialize(path)
  unless path == :ignore
    @path = path
    puts "WARNING: #{self} does not exist at #{@path}" unless File.exists?(@path)
  end
end

Instance Method Details

#applescript(script) ⇒ Object



30
31
32
33
# File 'lib/newjs/jstest.rb', line 30

def applescript(script)
  raise "Can't run AppleScript on #{host}" unless macos?
  system "osascript -e '#{script}' 2>&1 >/dev/null"
end

#hostObject



13
14
15
16
# File 'lib/newjs/jstest.rb', line 13

def host
  require 'rbconfig'
  Config::CONFIG['host']
end

#linux?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/newjs/jstest.rb', line 26

def linux?
  host.include?('linux')
end

#macos?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/newjs/jstest.rb', line 18

def macos?
  host.include?('darwin')
end

#open(url) ⇒ Object



10
# File 'lib/newjs/jstest.rb', line 10

def open(url) ; end

#setupObject



9
# File 'lib/newjs/jstest.rb', line 9

def setup ; end

#supported?Boolean

Returns:

  • (Boolean)


8
# File 'lib/newjs/jstest.rb', line 8

def supported?; true; end

#teardownObject



11
# File 'lib/newjs/jstest.rb', line 11

def teardown ; end

#windows?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/newjs/jstest.rb', line 22

def windows?
  host.include?('mswin')
end