class Guard::Jaspec

Public Class Methods

new(options = {}) click to toggle source
Calls superclass method
# File lib/guard/jaspec.rb, line 7
def initialize(options = {})
  @safe_options = {
    all_on_start: true
  }.merge(options)
  super
end

Public Instance Methods

run_all() click to toggle source
# 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) click to toggle source
# 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
start() click to toggle source
# File lib/guard/jaspec.rb, line 14
def start
  run_all if @safe_options[:all_on_start]
end

Private Instance Methods

throw_on_failed_tests() { || ... } click to toggle source
# File lib/guard/jaspec.rb, line 35
def throw_on_failed_tests
  throw :task_has_failed unless yield
end