Skip to content

Commit

Permalink
Add guard support for cucumber and rspec
Browse files Browse the repository at this point in the history
While developing, type `guard` to startup the guard server and automatically run tests upon saving of relevant files.
  • Loading branch information
jnraine committed Dec 31, 2011
1 parent 06c026f commit b6b85df
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Expand Up @@ -21,6 +21,8 @@ group :test, :development do
gem "pry-rails"
gem "rspec-rails", "~> 2.6"
gem "capybara"
gem "guard-rspec"
gem "guard-cucumber"
end

group :test do
Expand Down
10 changes: 10 additions & 0 deletions Gemfile.lock
Expand Up @@ -61,6 +61,14 @@ GEM
ffi (1.0.11)
gherkin (2.7.1)
json (>= 1.4.6)
guard (0.9.4)
ffi (>= 0.5.0)
thor (~> 0.14.6)
guard-cucumber (0.7.4)
cucumber (>= 0.10)
guard (>= 0.8.3)
guard-rspec (0.5.10)
guard (>= 0.8.4)
highline (1.6.2)
i18n (0.5.0)
json (1.6.4)
Expand Down Expand Up @@ -164,6 +172,8 @@ DEPENDENCIES
client_side_validations
cucumber-rails
database_cleaner
guard-cucumber
guard-rspec
highline
newrelic_rpm
nokogiri
Expand Down
25 changes: 25 additions & 0 deletions Guardfile
@@ -0,0 +1,25 @@
# A sample Guardfile
# More info at https://github.com/guard/guard#readme

guard 'rspec', :version => 2 do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }

# Rails example
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
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"] }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
watch('config/routes.rb') { "spec/routing" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
# Capybara request specs
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
end


guard 'cucumber' do
watch(%r{^features/.+\.feature$})
watch(%r{^features/support/.+$}) { 'features' }
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
end

0 comments on commit b6b85df

Please sign in to comment.