From e32e58a58a07820e0b8baec28469ea09792c33dc Mon Sep 17 00:00:00 2001
From: echarp <emmanuel.charpentier@free.fr>
Date: Mon, 25 Nov 2013 18:26:50 +0100
Subject: [PATCH] Utilisation de minitest avec guard

---
 Gemfile      |  2 +-
 Gemfile.lock |  9 ++++-----
 Guardfile    | 28 ++++++++++++++++------------
 3 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/Gemfile b/Gemfile
index 6c380503f..d07eb08c1 100644
--- a/Gemfile
+++ b/Gemfile
@@ -54,5 +54,5 @@ gem 'compass-rails', "~> 2.0.alpha.0"
 group :development do
   gem 'guard-livereload'
   gem 'guard-bundler'
-  gem 'guard-test'
+  gem 'guard-minitest'
 end
diff --git a/Gemfile.lock b/Gemfile.lock
index 268aaf1a2..fc49dc44c 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -102,9 +102,9 @@ GEM
       em-websocket (~> 0.5)
       guard (~> 2.0)
       multi_json (~> 1.8)
-    guard-test (2.0.3)
+    guard-minitest (2.1.2)
       guard (~> 2.0)
-      test-unit (~> 2.2)
+      minitest (>= 3.0)
     haml (4.0.4)
       tilt
     haml-rails (0.4)
@@ -145,7 +145,7 @@ GEM
       mime-types (~> 1.16)
       treetop (~> 1.4.8)
     method_source (0.8.2)
-    mime-types (1.25)
+    mime-types (1.25.1)
     minitest (4.7.5)
     multi_json (1.8.2)
     mysql2 (0.3.14)
@@ -206,7 +206,6 @@ GEM
       actionpack (>= 3.0)
       activesupport (>= 3.0)
       sprockets (~> 2.8)
-    test-unit (2.5.5)
     thor (0.18.1)
     thread_safe (0.1.3)
       atomic
@@ -235,7 +234,7 @@ DEPENDENCIES
   font-awesome-rails
   guard-bundler
   guard-livereload
-  guard-test
+  guard-minitest
   haml-rails
   jbuilder
   jquery-rails
diff --git a/Guardfile b/Guardfile
index 3e51d19c3..b0eb7e6ac 100644
--- a/Guardfile
+++ b/Guardfile
@@ -1,18 +1,6 @@
 # A sample Guardfile
 # More info at https://github.com/guard/guard#readme
 
-guard :test do
-  watch(%r{^test/.+_test\.rb$})
-  watch('test/test_helper.rb')  { 'test' }
-
-  # Rails 4
-  watch(%r{^app/(.+)\.rb})                               { |m| "test/#{m[1]}_test.rb" }
-  watch(%r{^app/controllers/application_controller\.rb}) { 'test/controllers' }
-  watch(%r{^app/controllers/(.+)_controller\.rb})        { |m| "test/integration/#{m[1]}_test.rb" }
-  watch(%r{^app/views/(.+)_mailer/.+})                   { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
-  watch(%r{^lib/(.+)\.rb})                               { |m| "test/lib/#{m[1]}_test.rb" }
-end
-
 guard :livereload do
   watch(%r{app/views/.+\.(erb|haml|slim)$})
   watch(%r{app/helpers/.+\.rb})
@@ -21,3 +9,19 @@ guard :livereload do
   # Rails Assets Pipeline
   watch(%r{(app|vendor)(/assets/\w+/(.+\.(css|js|html))).*}) { |m| "/assets/#{m[3]}" }
 end
+
+guard :minitest do
+  # with Minitest::Unit
+  watch(%r{^test/(.*)\/?test_(.*)\.rb})
+  watch(%r{^lib/(.*/)?([^/]+)\.rb})     { |m| "test/#{m[1]}test_#{m[2]}.rb" }
+  watch(%r{^test/test_helper\.rb})      { 'test' }
+
+  # Rails 4
+  watch(%r{^app/(.+)\.rb})                               { |m| "test/#{m[1]}_test.rb" }
+  watch(%r{^app/controllers/application_controller\.rb}) { 'test/controllers' }
+  watch(%r{^app/controllers/(.+)_controller\.rb})        { |m| "test/integration/#{m[1]}_test.rb" }
+  watch(%r{^app/views/(.+)_mailer/.+})                   { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
+  watch(%r{^lib/(.+)\.rb})                               { |m| "test/lib/#{m[1]}_test.rb" }
+  watch(%r{^test/.+_test\.rb})
+  watch(%r{^test/test_helper\.rb}) { 'test' }
+end
-- 
GitLab