Class: Guard::PHPSpec
- Inherits:
-
Guard
- Object
- Guard
- Guard::PHPSpec
- Defined in:
- lib/guard/phpspec/runner.rb,
lib/guard/phpspec/version.rb,
lib/guard/phpspec/watcher.rb,
lib/guard/phpspec/notifier.rb,
lib/guard/phpspec/inspector.rb,
lib/guard/phpspec/formatter.rb
Defined Under Namespace
Modules: Formatter, Inspector, Notifier, Runner
Constant Summary
- VERSION =
'0.0.1'
- DEFAULT_OPTIONS =
{ :all_on_start => true, :all_after_pass => true, :keep_failed => true, :cli => nil, :tests_path => "#{Dir.pwd}/spec" }
Instance Method Summary (collapse)
-
- (PHPSpec) initialize(watchers = [], options = {})
constructor
Initialize Guard::PHPSpec.
-
- (Object) run_all(runner = nil)
Gets called when all tests should be run.
-
- (Object) run_on_changes(paths, runner = nil, inspector = nil)
Gets called when the watched tests have changes.
-
- (Object) start
Gets called once when Guard starts.
Constructor Details
- (PHPSpec) initialize(watchers = [], options = {})
Initialize Guard::PHPSpec
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/guard/phpspec/watcher.rb', line 29 def initialize(watchers = [], = {}) defaults = DEFAULT_OPTIONS.clone @options = defaults.merge() super(watchers, @options) @failed_paths = [] @previous_failed = false Inspector.tests_path = @options[:tests_path] end |
Instance Method Details
- (Object) run_all(runner = nil)
Gets called when all tests should be run.
49 50 51 52 53 54 55 56 57 |
# File 'lib/guard/phpspec/watcher.rb', line 49 def run_all(runner = nil) runner ||= Runner success = runner.run([:tests_path], .merge( :message => 'Running all tests' )) @previous_failed = !success throw :task_has_failed unless success end |
- (Object) run_on_changes(paths, runner = nil, inspector = nil)
Gets called when the watched tests have changes.
63 64 65 66 67 68 69 70 71 |
# File 'lib/guard/phpspec/watcher.rb', line 63 def run_on_changes(paths, runner = nil, inspector = nil) runner ||= Runner inspector ||= Inspector paths = inspector.clean(paths + @failed_paths) success = runner.run(paths, ) update_failed_paths(success, paths) run_all_after_pass(success) throw :task_has_failed unless success end |
- (Object) start
Gets called once when Guard starts.
42 43 44 |
# File 'lib/guard/phpspec/watcher.rb', line 42 def start run_all if [:all_on_start] end |