-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
run-tests
executable file
·43 lines (34 loc) · 806 Bytes
/
run-tests
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
die() {
echo "Error: $*" >&2
exit 1
}
ensure() {
"$@" \
|| die "Failed to run '$*'. Aborting."
}
# Make sure we're in the repository root.
ensure cd "${0%/*}"
# Check that Bundler is available.
which bundle > /dev/null 2>&1 \
|| die "Failed to find 'bundle' executable in PATH."
# Setup required Gems for testing.
echo ">> Checking if required Gems are installed and installing missing Gems."
if ! bundle check ; then
ensure bundle install --path vendor/bundle
fi
echo
# Run rubocop.
echo ">> Running style enforcement."
bundle exec rubocop -DES lib/
result="$?"
echo
echo ">> Done: ${result}."
# Run the test suite.
echo ">> Running test suite."
bundle exec rake test
result="$?"
echo
# Be done and return result of test suite.
echo ">> Done: ${result}."
exit "${result}"