From e8cafcd4e62d47d2278812c3d0498fad6ed25eca Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Mon, 28 Jul 2014 13:37:25 +0300 Subject: [PATCH] Add Guard::RSpec for continuous testing --- Gemfile | 1 + Gemfile.lock | 34 ++++++++++++++++++++++++++++++++++ Guardfile | 18 ++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 Guardfile diff --git a/Gemfile b/Gemfile index 58c0d32..3fef04f 100644 --- a/Gemfile +++ b/Gemfile @@ -19,6 +19,7 @@ gem 'rails-i18n' group :development do gem 'spring' gem 'spring-commands-rspec' + gem 'guard-rspec' # Continuous testing with Guard end group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index 0fe9b39..3f72c10 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -35,6 +35,9 @@ GEM rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) + celluloid (0.15.2) + timers (~> 1.1.0) + coderay (1.1.0) coffee-rails (4.0.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.0) @@ -52,6 +55,17 @@ GEM railties (>= 3.0.0) faker (1.4.2) i18n (~> 0.5) + ffi (1.9.3) + formatador (0.2.5) + guard (2.6.1) + formatador (>= 0.2.4) + listen (~> 2.7) + lumberjack (~> 1.0) + pry (>= 0.9.12) + thor (>= 0.18.1) + guard-rspec (4.2.10) + guard (~> 2.1) + rspec (>= 2.14, < 4.0) hike (1.2.3) i18n (0.6.11) jquery-rails (3.1.1) @@ -59,9 +73,15 @@ GEM thor (>= 0.14, < 2.0) json (1.8.1) libv8 (3.16.14.3) + listen (2.7.9) + celluloid (>= 0.15.2) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9) + lumberjack (1.0.9) mail (2.5.4) mime-types (~> 1.16) treetop (~> 1.4.8) + method_source (0.8.2) mime-types (1.25.1) mini_portile (0.6.0) minitest (5.4.0) @@ -70,6 +90,10 @@ GEM mini_portile (= 0.6.0) pg (0.17.1) polyglot (0.3.5) + pry (0.10.0) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) rack (1.5.2) rack-test (0.6.2) rack (>= 1.0) @@ -92,7 +116,14 @@ GEM rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (10.3.2) + rb-fsevent (0.9.4) + rb-inotify (0.9.5) + ffi (>= 0.5.0) ref (1.0.5) + rspec (3.0.0) + rspec-core (~> 3.0.0) + rspec-expectations (~> 3.0.0) + rspec-mocks (~> 3.0.0) rspec-core (3.0.3) rspec-support (~> 3.0.0) rspec-expectations (3.0.3) @@ -123,6 +154,7 @@ GEM activesupport (>= 3.0, < 4.2) railties (>= 3.0, < 4.2) slim (~> 2.0) + slop (3.6.0) spring (1.1.3) spring-commands-rspec (1.0.2) spring (>= 0.9.1) @@ -143,6 +175,7 @@ GEM thor (0.19.1) thread_safe (0.3.4) tilt (1.4.1) + timers (1.1.0) treetop (1.4.15) polyglot polyglot (>= 0.3.1) @@ -162,6 +195,7 @@ DEPENDENCIES coffee-rails factory_girl_rails faker + guard-rspec jquery-rails pg rails (= 4.1.4) diff --git a/Guardfile b/Guardfile new file mode 100644 index 0000000..278ad0e --- /dev/null +++ b/Guardfile @@ -0,0 +1,18 @@ +# More info at https://github.com/guard/guard#readme + +guard :rspec, cmd: 'spring rspec' do + watch(%r{^spec/.+_spec\.rb$}) + watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } + watch('spec/spec_helper.rb') { 'spec' } + watch('spec/rails_helper.rb') { 'spec' } + + watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } + watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |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 features specs + watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" } +end