#!/usr/bin/env bash # Check if a directory/file argument is provided if [ -n "$1" ]; then # Get the test directory/file from the first argument TEST_PATH="$1" # Check if the provided argument is a directory or file if [ -d "$TEST_PATH" ] || [ -f "$TEST_PATH" ]; then # Run Rails tests in the specified directory/file bundle exec rails test "$TEST_PATH" else echo "Error: $TEST_PATH is not a valid directory or file" exit 1 fi else # Run Rails tests in the current directory bundle exec rails test fi