Class: Guard::Jaspec
- Inherits:
-
Plugin
- Object
- Plugin
- Guard::Jaspec
- Defined in:
- lib/guard/jaspec.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Jaspec
constructor
A new instance of Jaspec.
- #run_all ⇒ Object
- #run_on_modifications(paths) ⇒ Object
- #start ⇒ Object
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( = {}) @safe_options = { all_on_start: true }.merge() super end |
Instance Method Details
#run_all ⇒ Object
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.(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.(p)) end end end |
#start ⇒ Object
14 15 16 |
# File 'lib/guard/jaspec.rb', line 14 def start run_all if @safe_options[:all_on_start] end |