Class: QUnited::Driver::Rhino

Inherits:
Base
  • Object
show all
Defined in:
lib/qunited/driver/rhino/rhino.rb

Constant Summary collapse

JS_JAR =
File.expand_path('../support/js.jar', __FILE__)
ENV_JS =
File.expand_path('../support/env.rhino.js', __FILE__)
RUNNER_JS =
File.expand_path('../support/runner.js', __FILE__)

Constants inherited from Base

Base::COFFEESCRIPT_EXTENSIONS, Base::SUPPORT_DIR, Base::TEST_RESULT_END_TOKEN, Base::TEST_RESULT_REGEX, Base::TEST_RESULT_START_TOKEN

Instance Attribute Summary

Attributes inherited from Base

#fixture_files, #formatter, #results, #source_files, #test_files

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize, #name, #run, #support_file_contents, #support_file_path, which

Constructor Details

This class inherits a constructor from QUnited::Driver::Base

Class Method Details

.available?Boolean

Determines whether this driver available to use. Checks whether java is on the PATH and whether Java is version 1.1 or greater.

Returns:

  • (Boolean)


14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/qunited/driver/rhino/rhino.rb', line 14

def self.available?
  java_exe = which('java')
  if java_exe
    stdin, stdout, stderr = Open3.popen3('java -version')
    begin
      version = Float(stderr.read.split("\n").first[/(\d+\.\d+)/, 1])
      version >= 1.1
    rescue
      false
    end
  end
end

Instance Method Details

#commandObject



27
28
29
# File 'lib/qunited/driver/rhino/rhino.rb', line 27

def command
  %|java -jar "#{JS_JAR}" -opt -1 #{RUNNER_JS} #{ENV_JS} #{@tests_file.path}|
end