Sha256: a0d291228d25448f6fc837ddd5eb194dd12cff2e7de30855581e43da33c4588a
Contents?: true
Size: 1.66 KB
Versions: 3
Compression:
Stored size: 1.66 KB
Contents
require 'guard' require 'guard/guard' module Guard class RSpec < Guard autoload :Runner, 'guard/rspec/runner' autoload :Inspector, 'guard/rspec/inspector' def initialize(watchers=[], options={}) super @options = { :all_after_pass => true, :all_on_start => true, :keep_failed => true, :spec_paths => ["spec/"] }.update(options) @last_failed = false @failed_paths = [] Runner.set_rspec_version(options) Inspector.excluded = @options[:exclude] Inspector.spec_paths = @options[:spec_paths] end # Call once when guard starts def start UI.info "Guard::RSpec is running, with RSpec #{Runner.rspec_version}!" run_all if @options[:all_on_start] end def run_all passed = Runner.run(options[:spec_paths], options.merge(options[:run_all] || {}).merge(:message => "Running all specs")) @failed_paths = [] if passed @last_failed = !passed end def reload @failed_paths = [] end def run_on_change(paths) paths += @failed_paths if @options[:keep_failed] paths = Inspector.clean(paths) passed = Runner.run(paths, options) 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 += paths if @options[:keep_failed] # track whether the changed specs failed for the next change @last_failed = true end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
guard-rspec-0.4.4 | lib/guard/rspec.rb |
guard-rspec-0.4.3 | lib/guard/rspec.rb |
guard-rspec-0.4.2 | lib/guard/rspec.rb |