From ff21667caf08b93249397eea9fa5f8561d4b13aa Mon Sep 17 00:00:00 2001 From: Martin Linkhorst Date: Wed, 24 Oct 2012 16:01:39 +0200 Subject: [PATCH] added guard for rspec --- Gemfile | 1 + Gemfile.lock | 11 +++++++++++ Guardfile | 20 ++++++++++++++++++++ spec/spec_helper.rb | 4 ++++ 4 files changed, 36 insertions(+) create mode 100644 Guardfile diff --git a/Gemfile b/Gemfile index 25f8ee84be7..ad539b770ed 100644 --- a/Gemfile +++ b/Gemfile @@ -67,6 +67,7 @@ group :development do gem 'bullet' gem 'letter_opener', '~> 1.0.0' gem 'rails-dev-tweaks', '~> 0.6.1' + gem 'guard-rspec' end group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index fe3b7eff38c..7b072230084 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -106,6 +106,14 @@ GEM ffi (1.1.5) gherkin (2.11.5) json (>= 1.4.6) + guard (1.5.0) + listen (>= 0.4.2) + lumberjack (>= 1.0.2) + pry (>= 0.9.10) + thor (>= 0.14.6) + guard-rspec (2.1.0) + guard (>= 1.1) + rspec (~> 2.11) hike (1.2.1) htmldiff (0.0.1) i18n (0.6.1) @@ -122,8 +130,10 @@ GEM addressable linecache (0.46) rbx-require-relative (> 0.0.4) + listen (0.5.3) loofah (1.2.1) nokogiri (>= 1.4.4) + lumberjack (1.0.2) mail (2.3.3) i18n (>= 0.4.0) mime-types (~> 1.16) @@ -286,6 +296,7 @@ DEPENDENCIES factory_girl_rails (~> 4.0) fastercsv (~> 1.5.0) globalize3! + guard-rspec htmldiff jquery-rails jruby-openssl diff --git a/Guardfile b/Guardfile new file mode 100644 index 00000000000..b9a900d5368 --- /dev/null +++ b/Guardfile @@ -0,0 +1,20 @@ +guard :rspec 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" } + + # Turnip features and steps + watch(%r{^spec/acceptance/(.+)\.feature$}) + watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' } +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c0838323f04..809b5a9146e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -36,4 +36,8 @@ RSpec.configure do |config| # the seed, which is printed after each run. # --seed 1234 config.order = "random" + + config.treat_symbols_as_metadata_keys_with_true_values = true + config.filter_run :focus => true + config.run_all_when_everything_filtered = true end