Class: Guard::FastSpec
- Defined in:
- lib/guard/fast_spec.rb,
lib/guard/fast_spec/runner.rb,
lib/guard/fast_spec/inspector.rb
Defined Under Namespace
Modules: Formatter Classes: Inspector, Runner
Instance Method Summary collapse
-
#initialize(watchers = [], options = {}) ⇒ FastSpec
constructor
A new instance of FastSpec.
- #reload ⇒ Object
- #run_all ⇒ Object
- #run_on_change(paths) ⇒ Object
-
#start ⇒ Object
Call once when guard starts.
Constructor Details
#initialize(watchers = [], options = {}) ⇒ FastSpec
Returns a new instance of FastSpec.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/guard/fast_spec.rb', line 9 def initialize(watchers = [], = {}) super @options = { :all_after_pass => true, :all_on_start => true, :keep_failed => true, :spec_paths => ["fast_spec"], :run_all => {} }.merge() @last_failed = false @failed_paths = [] @inspector = Inspector.new(@options) @runner = Runner.new(@options) end |
Instance Method Details
#reload ⇒ Object
41 42 43 |
# File 'lib/guard/fast_spec.rb', line 41 def reload @failed_paths = [] end |
#run_all ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/guard/fast_spec.rb', line 31 def run_all passed = @runner.run(@options[:spec_paths], @options[:run_all].merge(:message => 'Running all fast_specs')) unless @last_failed = !passed @failed_paths = [] else throw :task_has_failed end end |
#run_on_change(paths) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/guard/fast_spec.rb', line 45 def run_on_change(paths) paths += @failed_paths if @options[:keep_failed] paths = @inspector.clean(paths) if passed = @runner.run(paths) remove_failed(paths) # run all the specs if the run before this one failed if @last_failed && @options[:all_after_pass] @last_failed = false run_all end else @last_failed = true add_failed(paths) throw :task_has_failed end end |
#start ⇒ Object
Call once when guard starts
26 27 28 29 |
# File 'lib/guard/fast_spec.rb', line 26 def start UI.info "Guard::FastSpec is running, with RSpec #{@runner.fast_spec_version}!" run_all if @options[:all_on_start] end |