Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactor the Guard configuration with respect to RSpec

  • Loading branch information...
commit 534c209ed28b084f7617596452840d84feab420c 1 parent f477906
@njonsson authored
Showing with 6 additions and 11 deletions.
  1. +6 −11 Guardfile
View
17 Guardfile
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.