Class: Guard::Jaspec

Inherits:
Plugin
  • Object
show all
Defined in:
lib/guard/jaspec.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Jaspec

Returns a new instance of Jaspec.



7
8
9
10
11
12
# File 'lib/guard/jaspec.rb', line 7

def initialize(options = {})
  @safe_options = {
    all_on_start: true
  }.merge(options)
  super
end

Instance Method Details

#run_allObject



18
19
20
21
22
23
# File 'lib/guard/jaspec.rb', line 18

def run_all
  files = Guard::Watcher.match_files(self, Dir.glob('**{,/*/**}/*Spec.{js,coffee}'))
  throw_on_failed_tests do
    ::Jaspec::Runner.run_all(files.compact.uniq.map{|f| File.expand_path(f)})
  end
end

#run_on_modifications(paths) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/guard/jaspec.rb', line 25

def run_on_modifications(paths)
  throw_on_failed_tests do
    paths.compact.uniq.each do |p|
      ::Jaspec::Runner.run(File.expand_path(p))
    end
  end
end

#startObject



14
15
16
# File 'lib/guard/jaspec.rb', line 14

def start
  run_all if @safe_options[:all_on_start]
end