Class: Guard::Cucumber
- Defined in:
- lib/guard/cucumber.rb,
lib/guard/cucumber/runner.rb,
lib/guard/cucumber/focuser.rb,
lib/guard/cucumber/inspector.rb,
lib/guard/cucumber/notification_formatter.rb
Overview
The Cucumber guard that gets notifications about the following Guard events: ‘start`, `stop`, `reload`, `run_all` and `run_on_change`.
Defined Under Namespace
Modules: Focuser, Inspector, Runner Classes: NotificationFormatter
Instance Attribute Summary collapse
-
#failed_path ⇒ Object
Returns the value of attribute failed_path.
-
#last_failed ⇒ Object
Returns the value of attribute last_failed.
Instance Method Summary collapse
-
#initialize(watchers = [], options = { }) ⇒ Cucumber
constructor
Initialize Guard::Cucumber.
-
#reload ⇒ Object
Gets called when the Guard should reload itself.
-
#run_all ⇒ Object
Gets called when all specs should be run.
-
#run_on_modifications(paths) ⇒ Object
Gets called when watched paths and files have changes.
-
#start ⇒ Object
Gets called once when Guard starts.
Constructor Details
#initialize(watchers = [], options = { }) ⇒ Cucumber
Initialize Guard::Cucumber.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/guard/cucumber.rb', line 34 def initialize(watchers = [], = { }) super @options = { :all_after_pass => true, :all_on_start => true, :keep_failed => true, :cli => '--no-profile --color --format progress --strict', :feature_sets => ['features'] }.update() @last_failed = false @failed_paths = [] end |
Instance Attribute Details
#failed_path ⇒ Object
Returns the value of attribute failed_path.
17 18 19 |
# File 'lib/guard/cucumber.rb', line 17 def failed_path @failed_path end |
#last_failed ⇒ Object
Returns the value of attribute last_failed.
17 18 19 |
# File 'lib/guard/cucumber.rb', line 17 def last_failed @last_failed end |
Instance Method Details
#reload ⇒ Object
Gets called when the Guard should reload itself.
79 80 81 |
# File 'lib/guard/cucumber.rb', line 79 def reload @failed_paths = [] end |
#run_all ⇒ Object
Gets called when all specs should be run.
61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/guard/cucumber.rb', line 61 def run_all passed = Runner.run([:feature_sets], .merge([:run_all] || { }).merge(:message => 'Running all features')) if passed @failed_paths = [] else @failed_paths = read_failed_features if @options[:keep_failed] end @last_failed = !passed throw :task_has_failed unless passed end |
#run_on_modifications(paths) ⇒ Object
Gets called when watched paths and files have changes.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/guard/cucumber.rb', line 88 def run_on_modifications(paths) paths += @failed_paths if @options[:keep_failed] paths = Inspector.clean(paths, [:feature_sets]) = @options[:change_format] ? change_format(@options[:change_format]) : @options passed = Runner.run(paths, paths.include?('features') ? .merge({ :message => 'Running all features' }) : ) if passed # clean failed paths memory @failed_paths -= paths if @options[:keep_failed] # run all the specs if the changed specs failed, like autotest run_all if @last_failed && @options[:all_after_pass] else # remember failed paths for the next change @failed_paths += read_failed_features if @options[:keep_failed] # track whether the changed feature failed for the next change @last_failed = true end throw :task_has_failed unless passed end |
#start ⇒ Object
Gets called once when Guard starts.
53 54 55 |
# File 'lib/guard/cucumber.rb', line 53 def start run_all if @options[:all_on_start] end |