From e11deb18fd65a56454f287d1b9ac7e539f2c7950 Mon Sep 17 00:00:00 2001 From: Ade Attwood Date: Mon, 12 Feb 2024 16:17:42 +0000 Subject: [PATCH] feat(bin): add script to run rspec when files have changed --- site-modules/core/files/bin/rspec-watch | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 site-modules/core/files/bin/rspec-watch diff --git a/site-modules/core/files/bin/rspec-watch b/site-modules/core/files/bin/rspec-watch new file mode 100755 index 0000000..7f1866d --- /dev/null +++ b/site-modules/core/files/bin/rspec-watch @@ -0,0 +1,17 @@ +#!/bin/bash +# +# Run rspec tests when files are modified in the spec or app directory. +# +# Example usage: +# +# # Run the two tests whenever a file is changed. +# rspec-watch spec/models/user_spec.rb spec/controllers/users_controller_spec.rb + +while inotifywait -r -e modify spec app; do + clear + + echo "Running tests..." + echo "" + + RSPEC_COVERAGE=0 bundle exec rspec -fd $@ +done