Permalink
Browse files

Refactor the Guard configuration with respect to RSpec

  • Loading branch information...
1 parent f477906 commit 534c209ed28b084f7617596452840d84feab420c @njonsson committed Mar 6, 2013
Showing with 6 additions and 11 deletions.
  1. +6 −11 Guardfile
View
@@ -1,25 +1,20 @@
interactor :off
-guard :rspec, :cli => '--debugger' do
+guard :rspec, :cli => '--debug' do
# Run the corresponding spec (or all specs) when code changes.
- watch( %r{^lib/(.+)\.rb$} ) do |match|
- corresponding_spec = "spec/#{match[1]}_spec.rb"
- if File.file?( File.expand_path( "../#{corresponding_spec}", __FILE__ ))
- corresponding_spec
- else
- 'spec'
- end
+ watch(%r{^lib/(.+)\.rb$}) do |match|
+ Dir[File.join("**/#{match[1]}_spec.rb")].first || 'spec'
end
# Run a spec when it changes.
watch %r{^spec/.+_spec\.rb$}
# Run all specs when the RSpec configuration changes.
- watch( '.rspec' ) { 'spec' }
- watch( 'spec/spec_helper.rb' ) { 'spec' }
+ watch('.rspec' ) { 'spec' }
+ watch('spec/spec_helper.rb') { 'spec' }
# Run all specs when the bundle changes.
- watch( 'Gemfile.lock' ) { 'spec' }
+ watch('Gemfile.lock') { 'spec' }
end
guard :cucumber do

0 comments on commit 534c209

Please sign in to comment.