Class: JsTestDriverRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/tasks/js_test_driver/js_test_driver_runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(dir, jar, filter, server) ⇒ JsTestDriverRunner

Returns a new instance of JsTestDriverRunner.



3
4
5
6
7
8
9
# File 'lib/tasks/js_test_driver/js_test_driver_runner.rb', line 3

def initialize(dir, jar, filter, server)
  @config = dir + '/jsTestDriver.conf'
  @dir = dir
  @jar = jar
  @filter = filter
  @server = server
end

Instance Method Details

#executeObject



15
16
17
18
# File 'lib/tasks/js_test_driver/js_test_driver_runner.rb', line 15

def execute
  @server.start_if_required
  return `java -jar "#{@jar}" --config "#{@config}" --captureConsole --reset --tests all 2>&1`
end

#is_configured?(all_files) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/tasks/js_test_driver/js_test_driver_runner.rb', line 20

def is_configured?(all_files)
  return all_files.include?(@dir + '/jsTestDriver.conf')
end

#nameObject



11
12
13
# File 'lib/tasks/js_test_driver/js_test_driver_runner.rb', line 11

def name
  return 'JS Test Driver'
end

#should_run?(modified_files) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/tasks/js_test_driver/js_test_driver_runner.rb', line 24

def should_run?(modified_files)
  return !(modified_files.detect { |file| @filter.filter(file)  }).nil? || modified_files.include?(@config)
end