Class: Guard::Cucumber
- Inherits:
-
Plugin
- Object
- Plugin
- 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
Constant Summary collapse
- KNOWN_OPTIONS =
%w( cmd cmd_additional_args all_after_pass all_on_start keep_failed feature_sets run_all focus_on notification ).map(&:to_sym)
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(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(options = {}) ⇒ Cucumber
Initialize Guard::Cucumber.
feature directory/ies features pass pass all specs
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/guard/cucumber.rb', line 45 def initialize( = {}) super() @options = { all_after_pass: true, all_on_start: true, keep_failed: true, cmd: "cucumber", cmd_additional_args: "--no-profile --color --format progress --strict", feature_sets: ["features"] }.update() = @options.keys - KNOWN_OPTIONS .each do |unknown| msg = "Unknown guard-cucumber option: #{unknown.inspect}" Guard::Compat::UI.warning(msg) end @last_failed = false @failed_paths = [] end |
Instance Attribute Details
#failed_path ⇒ Object
Returns the value of attribute failed_path.
12 13 14 |
# File 'lib/guard/cucumber.rb', line 12 def failed_path @failed_path end |
#last_failed ⇒ Object
Returns the value of attribute last_failed.
12 13 14 |
# File 'lib/guard/cucumber.rb', line 12 def last_failed @last_failed end |
Instance Method Details
#reload ⇒ Object
Gets called when the Guard should reload itself.
99 100 101 |
# File 'lib/guard/cucumber.rb', line 99 def reload @failed_paths = [] end |
#run_all ⇒ Object
Gets called when all specs should be run.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/guard/cucumber.rb', line 79 def run_all opts = .merge([:run_all] || {}) opts[:message] = "Running all features" passed = Runner.run([:feature_sets], opts) if passed @failed_paths = [] elsif @options[:keep_failed] @failed_paths = read_failed_features 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.
108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/guard/cucumber.rb', line 108 def run_on_modifications(paths) paths += @failed_paths if @options[:keep_failed] paths = Inspector.clean(paths, [:feature_sets]) = @options msg = "Running all features" [:message] = msg if paths.include?("features") _run(paths, ) end |
#start ⇒ Object
Gets called once when Guard starts.
71 72 73 |
# File 'lib/guard/cucumber.rb', line 71 def start run_all if @options[:all_on_start] end |