Class: JasmineNodeRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/tasks/jasmine_node/jasmine_node_runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(node, spec_dir, dir, filter) ⇒ JasmineNodeRunner

Returns a new instance of JasmineNodeRunner.


3
4
5
6
7
8
# File 'lib/tasks/jasmine_node/jasmine_node_runner.rb', line 3

def initialize(node, spec_dir, dir, filter)
  @node = node
  @spec_dir = spec_dir
  @dir = dir
  @filter = filter
end

Instance Method Details

#executeObject


14
15
16
# File 'lib/tasks/jasmine_node/jasmine_node_runner.rb', line 14

def execute
  return `#{@node} #{@spec_dir}/specs.js --noColor #{@dir}  2>&1`
end

#is_configured?(all_files) ⇒ Boolean

TODO: Only return true if we can find the node binary

Returns:

  • (Boolean)

19
20
21
22
# File 'lib/tasks/jasmine_node/jasmine_node_runner.rb', line 19

def is_configured?(all_files)
  spec_filter = StartsWithFilter.new(@dir)
  return !(all_files.detect { |file| spec_filter.filter(file) }).nil?
end

#nameObject


10
11
12
# File 'lib/tasks/jasmine_node/jasmine_node_runner.rb', line 10

def name
  return 'Jasmine'
end

#should_run?(modified_files) ⇒ Boolean

Returns:

  • (Boolean)

24
25
26
# File 'lib/tasks/jasmine_node/jasmine_node_runner.rb', line 24

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