diff --git a/Gemfile b/Gemfile index 632a4018..05747e11 100644 --- a/Gemfile +++ b/Gemfile @@ -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 diff --git a/Gemfile.lock b/Gemfile.lock index a2f8b0bc..75690828 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -164,6 +172,8 @@ DEPENDENCIES client_side_validations cucumber-rails database_cleaner + guard-cucumber + guard-rspec highline newrelic_rpm nokogiri diff --git a/Guardfile b/Guardfile new file mode 100644 index 00000000..1ab2143f --- /dev/null +++ b/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