diff --git a/Gemfile b/Gemfile index ff735e42f4c..648c4e198af 100644 --- a/Gemfile +++ b/Gemfile @@ -11,6 +11,8 @@ group :assets do end group :test do + gem 'guard' + gem 'guard-rspec', '~> 0.5.0' gem 'rspec-rails', '~> 2.7.0' gem 'factory_girl_rails', '~> 1.4.0' gem 'rcov' diff --git a/Gemfile.lock b/Gemfile.lock index 30466b36edf..035ddf42b08 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -132,6 +132,10 @@ GEM ffi (1.0.11) gherkin (2.4.21) json (>= 1.4.6) + guard (0.8.8) + thor (~> 0.14.6) + guard-rspec (0.5.4) + guard (>= 0.8.4) highline (1.6.2) hike (1.2.1) i18n (0.6.0) @@ -262,6 +266,8 @@ DEPENDENCIES database_cleaner (= 0.6.7) factory_girl_rails (~> 1.4.0) faker + guard + guard-rspec (~> 0.5.0) json launchy mysql2 (~> 0.3.6) diff --git a/api/Guardfile b/api/Guardfile new file mode 100644 index 00000000000..4f2814fecbb --- /dev/null +++ b/api/Guardfile @@ -0,0 +1,13 @@ +guard 'rspec', :version => 2, :spec_paths => %w(spec), + :cli => (File.read('.rspec').split("\n").join(' ') if File.exists?('.rspec')) do + watch(%r{^spec/.+_spec\.rb$}) + watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } + watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } + watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/requests/#{m[1]}_spec.rb"] } + watch(%r{^spec/support/(.+)\.rb$}) { "spec" } + watch("spec/spec_helper.rb") { "spec" } + watch("config/routes.rb") + 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 diff --git a/auth/Guardfile b/auth/Guardfile new file mode 100644 index 00000000000..4f2814fecbb --- /dev/null +++ b/auth/Guardfile @@ -0,0 +1,13 @@ +guard 'rspec', :version => 2, :spec_paths => %w(spec), + :cli => (File.read('.rspec').split("\n").join(' ') if File.exists?('.rspec')) do + watch(%r{^spec/.+_spec\.rb$}) + watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } + watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } + watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/requests/#{m[1]}_spec.rb"] } + watch(%r{^spec/support/(.+)\.rb$}) { "spec" } + watch("spec/spec_helper.rb") { "spec" } + watch("config/routes.rb") + 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 diff --git a/core/Guardfile b/core/Guardfile new file mode 100644 index 00000000000..4f2814fecbb --- /dev/null +++ b/core/Guardfile @@ -0,0 +1,13 @@ +guard 'rspec', :version => 2, :spec_paths => %w(spec), + :cli => (File.read('.rspec').split("\n").join(' ') if File.exists?('.rspec')) do + watch(%r{^spec/.+_spec\.rb$}) + watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } + watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } + watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/requests/#{m[1]}_spec.rb"] } + watch(%r{^spec/support/(.+)\.rb$}) { "spec" } + watch("spec/spec_helper.rb") { "spec" } + watch("config/routes.rb") + 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 diff --git a/dash/Guardfile b/dash/Guardfile new file mode 100644 index 00000000000..4f2814fecbb --- /dev/null +++ b/dash/Guardfile @@ -0,0 +1,13 @@ +guard 'rspec', :version => 2, :spec_paths => %w(spec), + :cli => (File.read('.rspec').split("\n").join(' ') if File.exists?('.rspec')) do + watch(%r{^spec/.+_spec\.rb$}) + watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } + watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } + watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/requests/#{m[1]}_spec.rb"] } + watch(%r{^spec/support/(.+)\.rb$}) { "spec" } + watch("spec/spec_helper.rb") { "spec" } + watch("config/routes.rb") + 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 diff --git a/promo/Guardfile b/promo/Guardfile new file mode 100644 index 00000000000..4f2814fecbb --- /dev/null +++ b/promo/Guardfile @@ -0,0 +1,13 @@ +guard 'rspec', :version => 2, :spec_paths => %w(spec), + :cli => (File.read('.rspec').split("\n").join(' ') if File.exists?('.rspec')) do + watch(%r{^spec/.+_spec\.rb$}) + watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } + watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } + watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/requests/#{m[1]}_spec.rb"] } + watch(%r{^spec/support/(.+)\.rb$}) { "spec" } + watch("spec/spec_helper.rb") { "spec" } + watch("config/routes.rb") + 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