guard/guard-rspec — pull request #234 by yujinakayama (2013-12-26 14:58:36+00:00)
Title: Don't fail when there are no spec files to run

Currently `guard-rspec` throws `:task_has_failed` when there are no spec files to run.
This change makes `guard-rspec` abort without failing in that case.

## Example

Here's an `Guardfile` with a group with `halt_on_fail ` option:

```ruby
# This group allows to skip running RuboCop when RSpec failed.
group :red_green_refactor, halt_on_fail: true do
guard :rspec, cmd: 'bundle exec rspec' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
end

guard :rubocop do
watch(%r{.+\.rb$})
end
end
```

When I modified a library file that has no corresponding spec file (i.e. `lib/foo.rb` exists but `spec/foo_spec.rb` doesn't exist), `guard-rspec` fails and `guard-rubocop` won't run.

```
$ bundle exec guard --debug
23:33:15 - DEBUG - Command execution: emacsclient --eval '1' 2> /dev/null || echo 'N/A'
23:33:15 - INFO - Guard is using GNTP to send notifications.
23:33:15 - INFO - Guard is using TerminalTitle to send notifications.
23:33:15 - DEBUG - Command execution: hash stty
23:33:15 - DEBUG - Guard starts all plugins
23:33:15 - DEBUG - Hook :start_begin executed for Guard::RSpec
23:33:15 - INFO - Guard::RSpec is running
23:33:15 - DEBUG - Hook :start_end executed for Guard::RSpec
23:33:15 - DEBUG - Hook :start_begin executed for Guard::Rubocop
23:33:15 - DEBUG - Hook :start_end executed for Guard::Rubocop
23:33:15 - DEBUG - Hook :start_begin executed for Guard::Shell
23:33:15 - DEBUG - Hook :start_end executed for Guard::Shell
23:33:15 - INFO - Guard is now watching at '/tmp/transpec'
23:33:15 - DEBUG - Command execution: stty -g 2>/dev/null
23:33:15 - DEBUG - Start interactor
23:33:32 - DEBUG - Stop interactor
23:33:32 - DEBUG - Command execution: stty gfmt1:cflag=4b00:iflag=6b02:lflag=200005cb:oflag=3:discard=f:dsusp=19:eof=4:eol=ff:eol2=ff:erase=7f:intr=3:kill=15:lnext=16:min=1:quit=1c:reprint=12:start=11:status=14:stop=13:susp=1a:time=0:werase=17:ispeed=9600:ospeed=9600 2>/dev/null
23:33:32 - DEBUG - Hook :run_on_modifications_begin executed for Guard::RSpec
23:33:32 - INFO - Guard::RSpec has failed, other group's plugins execution has been halted.
23:33:32 - DEBUG - Command execution: stty -g 2>/dev/null
23:33:32 - DEBUG - Start interactor
```

Actually I'm still not sure whether this is a specification or a bug, though I feel this is strange and inconvenient.
How do you think?

## Environment

* ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin13.0.0]
* `guard` 2.2.5
* `guard-rspec` 4.2.0

Gemfile:

```ruby
source 'https://rubygems.org'

gem 'guard-rspec', '~> 4.0'
gem 'guard-rubocop', '~> 1.0'
```