Class: JSpecRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/tasks/jspec/jspec_runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(dir, filter) ⇒ JSpecRunner

Returns a new instance of JSpecRunner.



3
4
5
6
7
# File 'lib/tasks/jspec/jspec_runner.rb', line 3

def initialize(dir, filter)
  @config = dir + '/spec/spec.rhino.js'
  @dir = dir
  @filter = filter
end

Instance Method Details

#executeObject



13
14
15
# File 'lib/tasks/jspec/jspec_runner.rb', line 13

def execute
  return `jspec run --rhino --trace 2>&1`
end

#is_configured?(all_files) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/tasks/jspec/jspec_runner.rb', line 17

def is_configured?(all_files)
  return all_files.include?(@config)
end

#nameObject



9
10
11
# File 'lib/tasks/jspec/jspec_runner.rb', line 9

def name
  return 'JSpec'
end

#should_run?(modified_files) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/tasks/jspec/jspec_runner.rb', line 21

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