lib/retest/options.rb in retest-1.6.2 vs lib/retest/options.rb in retest-1.7.0
- old
+ new
@@ -11,17 +11,22 @@
desc "Watch a file change and run it matching spec."
example <<~EOS
Runs a matching rails test after a file change
- $ retest 'bundle exec rails test <test>'
+ $ retest 'bin/rails test <test>'
$ retest --rails
EOS
example <<~EOS
+ Runs rubocop and matching rails test after a file change
+ $ retest 'rubocop <changed> && bin/rails test <test>'
+ EOS
+
+ example <<~EOS
Runs all rails tests after a file change
- $ retest 'bundle exec rails test'
+ $ retest 'bin/rails test'
$ retest --rails --all
EOS
example <<~EOS
Runs a hardcoded command after a file change
@@ -29,31 +34,29 @@
EOS
example <<~EOS
Let retest identify which command to run
$ retest
- $ retest --auto
EOS
example <<~EOS
Let retest identify which command to run for all tests
$ retest --all
- $ retest --auto --all
EOS
example <<~EOS
Run a sanity check on changed files from a branch
+ $ retest --diff main
$ retest --diff origin/main --rails
- $ retest --diff main --auto
EOS
end
argument :command do
optional
desc <<~EOS
The test command to rerun when a file changes.
- Use <test> placeholder to tell retest where to put the matching spec.
+ Use <test> or <changed> placeholders to tell retest where to reference the matching spec or the changed file in the command.
EOS
end
option :diff do
desc "Pipes all matching tests from diffed branch to test command"
@@ -69,15 +72,10 @@
flag :all do
long "--all"
desc "Run all the specs of a specificied ruby setup"
end
- flag :auto do
- long "--auto"
- desc "Indentify repository setup and runs appropriate command"
- end
-
flag :notify do
long "--notify"
desc "Play a sound when specs pass or fail (macOS only)"
end
@@ -128,25 +126,14 @@
def full_suite?
params[:all]
end
- def auto?
- return true if no_options_passed?
- params[:auto]
- end
-
def notify?
params[:notify]
end
def extension
Regexp.new(params[:ext])
- end
-
- private
-
- def no_options_passed?
- params.to_h.values.compact.uniq == ["\\.rb$", false]
end
end
end
\ No newline at end of file