2 # More info at https://github.com/guard/guard#readme
4 guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do
5 watch('config/application.rb')
6 watch('config/environment.rb')
7 watch('config/environments/test.rb')
8 watch(%r{^config/initializers/.+\.rb$})
10 watch('spec/spec_helper.rb') { :rspec }
11 watch('test/test_helper.rb') { :test_unit }
12 watch(%r{features/support/}) { :cucumber }
15 # Note: The cmd option is now required due to the increasing number of ways
16 # rspec may be run, below are examples of the most common uses.
17 # * bundler: 'bundle exec rspec'
18 # * bundler binstubs: 'bin/rspec'
19 # * spring: 'bin/rsspec' (This will use spring if running and you have
20 # installed the spring binstubs per the docs)
21 # * zeus: 'zeus rspec' (requires the server to be started separetly)
22 # * 'just' rspec: 'rspec'
23 guard :rspec, cmd: 'bundle exec rspec' do
24 watch(%r{^spec/.+_spec\.rb$})
25 watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
26 watch('spec/spec_helper.rb') { "spec" }
29 watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
30 watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
31 watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
32 watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
33 watch('config/routes.rb') { "spec/routing" }
34 watch('app/controllers/application_controller.rb') { "spec/controllers" }
35 watch('spec/rails_helper.rb') { "spec" }
37 # Capybara features specs
38 watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
40 # Turnip features and steps
41 watch(%r{^spec/acceptance/(.+)\.feature$})
42 watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }