Files
computer-playbook/scripts/tests/unit/ruby.sh
T
kevinveenbirkenbach 3222904232 fix(test): install php and ruby instead of skipping their suites
test-unit-php and test-unit-ruby exited 0 whenever the interpreter or the
vendor tree was missing, so both suites were silently absent from every
gate. They now provision their toolchain through install-php/install-ruby
and fail loudly when that is impossible.

The three ensure_*_present helpers collapse into ensure_command_present
in system_pkg, and the ruby runner rejects an empty suite because
minitest reports success when nothing was required.
2026-08-22 20:30:40 +02:00

23 lines
573 B
Bash
Executable File

#!/usr/bin/env bash
# shellcheck shell=bash
#
# Runs the Ruby unit suite through minitest, which ships with Ruby itself.
set -euo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd -- "${SCRIPT_DIR}/../../.." && pwd)"
cd "${REPO_ROOT}"
suite="tests/unit/ruby"
mapfile -t tests < <(find "${suite}" -name '*_test.rb' | sort)
if ((${#tests[@]} == 0)); then
printf 'ERROR test-unit-ruby: no Ruby unit tests in %s\n' "${suite}" >&2
exit 1
fi
exec ruby -I"${suite}" -e 'ARGV.each { |f| require File.expand_path(f) }' "${tests[@]}"