Skip to content

Commit 2b34d60

Browse files
author
Cuong Tran
committed
Add guard-rspec
1 parent 67fd10c commit 2b34d60

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ end
1212

1313
group :development, :test do
1414
gem 'rspec', :require => false
15+
gem 'guard-rspec', require: false
16+
1517
platforms :mri do
1618
gem 'pry', :require => false
1719
gem 'pry-coolline', :require => false

Guardfile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# A sample Guardfile
2+
# More info at https://github.com/guard/guard#readme
3+
4+
guard :rspec do
5+
watch(%r{^spec/.+_spec\.rb$})
6+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7+
watch('spec/spec_helper.rb') { "spec" }
8+
9+
# Rails example
10+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
11+
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
12+
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"] }
13+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
14+
watch('config/routes.rb') { "spec/routing" }
15+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
16+
17+
# Capybara features specs
18+
watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
19+
20+
# Turnip features and steps
21+
watch(%r{^spec/acceptance/(.+)\.feature$})
22+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
23+
end
24+
25+
26+
guard :rspec do
27+
watch(%r{^spec/.+_spec\.rb$})
28+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
29+
watch('spec/spec_helper.rb') { "spec" }
30+
31+
# Rails example
32+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
33+
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
34+
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"] }
35+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
36+
watch('config/routes.rb') { "spec/routing" }
37+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
38+
39+
# Capybara features specs
40+
watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
41+
42+
# Turnip features and steps
43+
watch(%r{^spec/acceptance/(.+)\.feature$})
44+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
45+
end
46+

0 commit comments

Comments
 (0)