guard-rspec 2.1.2 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -120,6 +120,7 @@ Former `:color`, `:drb`, `:fail_fast` and `:formatter` options are deprecated an
120
120
  :spec_paths => ["spec"] # specify an array of paths that contain spec files
121
121
  :turnip => true # enable turnip support; default: false
122
122
  :zeus => true # enable zeus support; default: false
123
+ :focus_on_failed => false # focus on the first 10 failed specs first, rerun till they pass
123
124
  ```
124
125
 
125
126
  You can also use a custom binstubs directory using `:binstubs => 'some-dir'`.
@@ -11,6 +11,7 @@ module Guard
11
11
  def initialize(watchers = [], options = {})
12
12
  super
13
13
  @options = {
14
+ :focus_on_failed => false,
14
15
  :all_after_pass => true,
15
16
  :all_on_start => true,
16
17
  :keep_failed => true,
@@ -45,8 +46,20 @@ module Guard
45
46
  end
46
47
 
47
48
  def run_on_changes(paths)
48
- paths += failed_paths if @options[:keep_failed]
49
- paths = @inspector.clean(paths)
49
+
50
+ if @last_failed && @options[:focus_on_failed]
51
+ path = './tmp/rspec_guard_result'
52
+ if File.exist?(path)
53
+ paths = File.open(path) { |file| file.read.split("\n") }
54
+ File.delete(path)
55
+
56
+ # some sane limit, stuff will explode if all tests fail ... cap at 10
57
+ paths = paths[0..10]
58
+ end
59
+ else
60
+ paths += failed_paths if @options[:keep_failed]
61
+ paths = @inspector.clean(paths)
62
+ end
50
63
 
51
64
  if passed = @runner.run(paths)
52
65
  remove_failed(paths)
@@ -5,6 +5,18 @@ require "rspec/core/formatters/base_formatter"
5
5
  class Guard::RSpec::Formatter < RSpec::Core::Formatters::BaseFormatter
6
6
 
7
7
  def dump_summary(duration, total, failures, pending)
8
+ failed_specs = examples.keep_if{|e| e.execution_result[:status] == "failed"}.map{|s| s.metadata[:location]}
9
+
10
+ # if this fails don't kill everything
11
+ begin
12
+ FileUtils.mkdir_p('tmp')
13
+ File.open("./tmp/rspec_guard_result","w") do |f|
14
+ f.puts failed_specs.join("\n")
15
+ end
16
+ rescue
17
+ # nothing really we can do, at least don't kill the test runner
18
+ end
19
+
8
20
  message = guard_message(total, failures, pending, duration)
9
21
  image = guard_image(failures, pending)
10
22
  notify(message, image)
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module RSpecVersion
3
- VERSION = "2.1.2"
3
+ VERSION = "2.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-16 00:00:00.000000000 Z
12
+ date: 2012-11-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard
@@ -86,9 +86,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
86
86
  - - ! '>='
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
- segments:
90
- - 0
91
- hash: 3851016056491779654
92
89
  required_rubygems_version: !ruby/object:Gem::Requirement
93
90
  none: false
94
91
  requirements: