Skip to content

Commit e236007

Browse files
committed
test: allow bin/test-in-docker to accept the test file(s) to run on command line
1 parent f4747e1 commit e236007

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

bin/test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#!/usr/bin/env ruby
22
# frozen_string_literal: true
33

4+
# This script is used to run the tests for this project.
5+
#
6+
# bundle exec bin/test [test_file_name ...]
7+
#
8+
# If no test file names are provided, all tests in the `tests/units` directory will be run.
9+
410
require 'bundler/setup'
511

612
`git config --global user.email "git@example.com"` if `git config --global user.email`.empty?

bin/test-in-docker

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/bin/bash -e
2-
test "$#" -ne 0 && echo "Unsupported args: $@" >&2 && exit 145
2+
3+
# This script is used to run the tests for this project in a Docker container.
4+
#
5+
# bin/test-in-docker [test_file_name ...]
6+
#
7+
# If no test file names are provided, all tests in the `tests/units` directory will be run.
8+
39
cd "$( dirname "${BASH_SOURCE[0]}" )"/..
410

511
export COMPOSE_FILE=tests/docker-compose.yml
@@ -8,4 +14,4 @@ export COMPOSE_PROJECT_NAME=ruby-git_dev
814
docker-compose rm -svf
915
docker-compose build --force-rm
1016

11-
docker-compose run --rm tester && docker-compose rm -svf || ( docker-compose logs && exit 1 )
17+
docker-compose run --rm tester "$@" && docker-compose rm -svf || ( docker-compose logs && exit 1 )

tests/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ RUN bundle install
99

1010
ADD . .
1111

12-
ENTRYPOINT ["bundle", "exec"]
13-
CMD ["bin/test"]
12+
ENTRYPOINT ["bundle", "exec", "bin/test"]

0 commit comments

Comments
 (0)