guard-rspec 2.3.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/guard/rspec.rb CHANGED
@@ -47,8 +47,10 @@ module Guard
47
47
 
48
48
  def run_on_changes(paths)
49
49
 
50
+ original_paths = paths.dup
51
+
50
52
  focused = false
51
- if @last_failed && @options[:focus_on_failed]
53
+ if last_failed && @options[:focus_on_failed]
52
54
  path = './tmp/rspec_guard_result'
53
55
  if File.exist?(path)
54
56
  single_spec = paths && paths.length == 1 && paths[0].include?("_spec") ? paths[0] : nil
@@ -72,22 +74,31 @@ module Guard
72
74
  end
73
75
  end
74
76
 
75
- unless focused
77
+ if focused
78
+ add_failed(original_paths)
79
+ add_failed(paths.map{|p| p.split(":")[0]})
80
+ else
76
81
  paths += failed_paths if @options[:keep_failed]
77
- paths = @inspector.clean(paths)
82
+ paths = @inspector.clean(paths).uniq
78
83
  end
79
84
 
80
85
  if passed = @runner.run(paths)
81
- remove_failed(paths)
86
+ unless focused
87
+ remove_failed(paths)
88
+ end
82
89
 
90
+ if last_failed && focused
91
+ run_on_changes(failed_paths)
83
92
  # run all the specs if the run before this one failed
84
- if last_failed && @options[:all_after_pass]
93
+ elsif last_failed && @options[:all_after_pass]
85
94
  @last_failed = false
86
95
  run_all
87
96
  end
88
97
  else
89
98
  @last_failed = true
90
- add_failed(paths)
99
+ unless focused
100
+ add_failed(paths)
101
+ end
91
102
 
92
103
  throw :task_has_failed
93
104
  end
@@ -103,7 +114,10 @@ module Guard
103
114
  end
104
115
 
105
116
  def add_failed(paths)
106
- @failed_paths += paths if @options[:keep_failed]
117
+ if @options[:keep_failed]
118
+ @failed_paths += paths
119
+ @failed_paths.uniq!
120
+ end
107
121
  end
108
122
 
109
123
  end
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module RSpecVersion
3
- VERSION = "2.3.0"
3
+ VERSION = "2.3.1"
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.3.0
4
+ version: 2.3.1
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-29 00:00:00.000000000 Z
12
+ date: 2012-12-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard