diff --git a/Gemfile b/Gemfile index 0646f64..c3b7b04 100644 --- a/Gemfile +++ b/Gemfile @@ -32,13 +32,14 @@ group :development, :test do gem "bootsnap", require: false gem "debug", platforms: %i[ mri mingw x64_mingw ] gem "mina" + gem 'guard-minitest' + gem 'guard' # NOTE: this is necessary in newer versions + gem "puma", "~> 5.0" end group :development do # Use console on exceptions pages [https://github.com/rails/web-console] gem "web-console" - gem "puma", "~> 5.0" - gem 'guard-rspec', require: false end group :test do diff --git a/Gemfile.lock b/Gemfile.lock index 03cd91a..0fb0e2c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -117,7 +117,6 @@ GEM railties (>= 4.1.0) responders warden (~> 1.2.3) - diff-lcs (1.5.0) erubi (1.11.0) erubis (2.7.0) ffi (1.15.5) @@ -137,10 +136,9 @@ GEM shellany (~> 0.0) thor (>= 0.18.1) guard-compat (1.2.1) - guard-rspec (4.7.3) - guard (~> 2.1) - guard-compat (~> 1.1) - rspec (>= 2.99.0, < 4.0) + guard-minitest (2.4.6) + guard-compat (~> 1.2) + minitest (>= 3.0) haml (6.1.1) temple (>= 0.8.2) thor @@ -258,19 +256,6 @@ GEM actionpack (>= 5.0) railties (>= 5.0) rexml (3.2.5) - rspec (3.12.0) - rspec-core (~> 3.12.0) - rspec-expectations (~> 3.12.0) - rspec-mocks (~> 3.12.0) - rspec-core (3.12.0) - rspec-support (~> 3.12.0) - rspec-expectations (3.12.1) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-mocks (3.12.1) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-support (3.12.0) ruby_parser (3.19.2) sexp_processor (~> 4.16) rubyzip (2.3.2) @@ -330,7 +315,8 @@ DEPENDENCIES capybara debug devise - guard-rspec + guard + guard-minitest haml-rails html2haml importmap-rails diff --git a/Guardfile b/Guardfile index 23074cd..c632fbb 100644 --- a/Guardfile +++ b/Guardfile @@ -1,70 +1,8 @@ -# 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.exist?(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" - -# Note: The cmd option is now required due to the increasing number of ways -# rspec may be run, below are examples of the most common uses. -# * bundler: 'bundle exec rspec' -# * bundler binstubs: 'bin/rspec' -# * spring: 'bin/rspec' (This will use spring if running and you have -# installed the spring binstubs per the docs) -# * zeus: 'zeus rspec' (requires the server to be started separately) -# * 'just' rspec: 'rspec' - -guard :rspec, cmd: "bundle exec rspec" do - require "guard/rspec/dsl" - dsl = Guard::RSpec::Dsl.new(self) - - # Feel free to open issues for suggestions and improvements - - # RSpec files - rspec = dsl.rspec - watch(rspec.spec_helper) { rspec.spec_dir } - watch(rspec.spec_support) { rspec.spec_dir } - watch(rspec.spec_files) - - # Ruby files - ruby = dsl.ruby - dsl.watch_spec_files_for(ruby.lib_files) - - # Rails files - rails = dsl.rails(view_extensions: %w(erb haml slim)) - dsl.watch_spec_files_for(rails.app_files) - dsl.watch_spec_files_for(rails.views) - - watch(rails.controllers) do |m| - [ - rspec.spec.call("routing/#{m[1]}_routing"), - rspec.spec.call("controllers/#{m[1]}_controller"), - rspec.spec.call("acceptance/#{m[1]}") - ] - end - - # Rails config changes - watch(rails.spec_helper) { rspec.spec_dir } - watch(rails.routes) { "#{rspec.spec_dir}/routing" } - watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" } - - # Capybara features specs - watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") } - watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") } - - # Turnip features and steps - watch(%r{^spec/acceptance/(.+)\.feature$}) - watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m| - Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance" - end +guard :minitest do + # with Minitest::Unit + watch(%r{^test/(.*)\/?(.*)_test\.rb$}) + watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}#{m[2]}_test.rb" } + watch(%r{^test/test_helper\.rb$}) { 'test' } end