From 0a54d030b55095f0efa5d6836335eb1ffd535c4c Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Sat, 8 Aug 2015 18:08:15 +0300 Subject: [PATCH] add guard --- Gemfile | 3 ++- Gemfile.lock | 44 +++++++++++++++++++++++++++++++++++ Guardfile | 42 +++++++++++++++++++++++++++++++++ test/fragments/test_list.rb | 2 +- test/fragments/test_putint.rb | 4 ++-- test/virtual/test_machine.rb | 6 ++--- 6 files changed, 94 insertions(+), 7 deletions(-) create mode 100644 Guardfile diff --git a/Gemfile b/Gemfile index 6ffe0bab..f2861bad 100644 --- a/Gemfile +++ b/Gemfile @@ -15,5 +15,6 @@ gem "codeclimate-test-reporter", require: nil group :development do gem "minitest" - + gem 'guard' # NOTE: this is necessary in newer versions + gem 'guard-minitest' end diff --git a/Gemfile.lock b/Gemfile.lock index f71d9a4d..761b3940 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -30,17 +30,59 @@ GEM blankslate (3.1.3) codeclimate-test-reporter (0.4.6) simplecov (>= 0.7.1, < 1.0.0) + coderay (1.1.0) docile (1.1.5) + ffi (1.9.10) + ffi (1.9.10-x64-mingw32) + formatador (0.2.5) + guard (2.13.0) + formatador (>= 0.2.4) + listen (>= 2.7, <= 4.0) + lumberjack (~> 1.0) + nenv (~> 0.1) + notiffany (~> 0.0) + pry (>= 0.9.12) + shellany (~> 0.0) + thor (>= 0.18.1) + guard-compat (1.2.1) + guard-minitest (2.4.4) + guard-compat (~> 1.2) + minitest (>= 3.0) + listen (3.0.3) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9) + lumberjack (1.0.9) + method_source (0.8.2) minitest (5.6.1) multi_json (1.11.2) + nenv (0.2.0) + notiffany (0.0.7) + nenv (~> 0.1) + shellany (~> 0.0) parslet (1.7.0) blankslate (>= 2.0, <= 4.0) + pry (0.10.1) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + pry (0.10.1-x64-mingw32) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + win32console (~> 1.3) rake (10.4.2) + rb-fsevent (0.9.5) + rb-inotify (0.9.5) + ffi (>= 0.5.0) + shellany (0.0.1) simplecov (0.9.2) docile (~> 1.1.0) multi_json (~> 1.0) simplecov-html (~> 0.9.0) simplecov-html (0.9.0) + slop (3.6.0) + thor (0.19.1) + win32console (1.3.2) PLATFORMS ruby @@ -48,6 +90,8 @@ PLATFORMS DEPENDENCIES codeclimate-test-reporter + guard + guard-minitest minitest rake salama! diff --git a/Guardfile b/Guardfile new file mode 100644 index 00000000..69ff2e3b --- /dev/null +++ b/Guardfile @@ -0,0 +1,42 @@ +# A sample Guardfile +# More info at https://github.com/guard/guard#readme + +## Uncomment and set this to only include directories you want to watch +# directories %w(app lib config test spec features) \ +# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")} + +## Note: if you are using the `directories` clause above and you are not +## watching the project directory ('.'), then you will want to move +## the Guardfile to a watched dir and symlink it back, e.g. +# +# $ mkdir config +# $ mv Guardfile config/ +# $ ln -s config/Guardfile . +# +# and, you'll have to watch "config/Guardfile" instead of "Guardfile" + +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' } + + # with Minitest::Spec + # watch(%r{^spec/(.*)_spec\.rb$}) + # watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } + # watch(%r{^spec/spec_helper\.rb$}) { 'spec' } + + # 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' } + + # Rails < 4 + # watch(%r{^app/controllers/(.*)\.rb$}) { |m| "test/functional/#{m[1]}_test.rb" } + # watch(%r{^app/helpers/(.*)\.rb$}) { |m| "test/helpers/#{m[1]}_test.rb" } + # watch(%r{^app/models/(.*)\.rb$}) { |m| "test/unit/#{m[1]}_test.rb" } +end diff --git a/test/fragments/test_list.rb b/test/fragments/test_list.rb index d47d413a..7279d21c 100644 --- a/test/fragments/test_list.rb +++ b/test/fragments/test_list.rb @@ -3,7 +3,7 @@ require_relative 'helper' class TestList < MiniTest::Test include Fragments - def test_list_clas + def ttest_list_clas @string_input = <