diff --git a/Gemfile b/Gemfile index c1b10d7..f94c190 100644 --- a/Gemfile +++ b/Gemfile @@ -60,6 +60,10 @@ group :development do gem 'annotate', require: false gem 'letter_opener_web' + + gem "guard" + gem "guard-minitest" + gem 'capistrano-rails' gem "capistrano", "~> 3.10", require: false gem "capistrano-rbenv", require: false diff --git a/Gemfile.lock b/Gemfile.lock index a8385ca..03bbdcb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -106,8 +106,22 @@ GEM erubi (1.7.1) execjs (2.7.0) ffi (1.9.23) + formatador (0.2.5) globalid (0.4.1) activesupport (>= 4.2.0) + guard (2.14.2) + formatador (>= 0.2.4) + listen (>= 2.7, < 4.0) + lumberjack (>= 1.0.12, < 2.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.6) + guard-compat (~> 1.2) + minitest (>= 3.0) i18n (1.0.1) concurrent-ruby (~> 1.0) io-like (0.3.0) @@ -129,6 +143,7 @@ GEM loofah (2.2.2) crass (~> 1.0.2) nokogiri (>= 1.5.9) + lumberjack (1.0.13) mail (2.7.0) mini_mime (>= 0.1.1) marcel (0.3.2) @@ -142,12 +157,16 @@ GEM multi_json (1.13.1) mysql2 (0.5.1) naught (1.1.0) + nenv (0.3.0) net-scp (1.2.1) net-ssh (>= 2.6.5) net-ssh (4.2.0) nio4r (2.3.1) nokogiri (1.8.2) mini_portile2 (~> 2.3.0) + notiffany (0.1.1) + nenv (~> 0.1) + shellany (~> 0.0) orm_adapter (0.5.0) parallel (1.12.1) parser (2.5.1.0) @@ -229,6 +248,7 @@ GEM selenium-webdriver (3.12.0) childprocess (~> 0.5) rubyzip (~> 1.2) + shellany (0.0.1) simple_form (4.0.1) actionpack (>= 5.0) activemodel (>= 5.0) @@ -291,6 +311,8 @@ DEPENDENCIES chromedriver-helper devise (~> 4.4) devise-i18n (~> 1.6) + guard + guard-minitest jbuilder (~> 2.5) launchy letter_opener_web diff --git a/Guardfile b/Guardfile new file mode 100644 index 0000000..566e5dc --- /dev/null +++ b/Guardfile @@ -0,0 +1,29 @@ +# 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", spring: "bin/rails test" do + # Rails 5 + 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{^app/services/whois/.+\.rb}) { |_m| "test/services/whois" } + watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" } + watch(%r{^test/.+_test\.rb$}) + watch(%r{^test/test_helper\.rb$}) { "test" } + watch(%r{^test/fixtures/.+\.yml$}) { "test" } +end diff --git a/test/test_helper.rb b/test/test_helper.rb index 04f5f23..2c91312 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -2,6 +2,8 @@ ENV["RAILS_ENV"] ||= "test" require_relative "../config/environment" require "rails/test_help" +require "minitest/mock" + class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. fixtures :all