Skip to content

Commit

Permalink
Add support for jasmine tests
Browse files Browse the repository at this point in the history
  • Loading branch information
CSammy committed May 6, 2018
1 parent f4108ad commit 3de9086
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Dockerfile.diaspora
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ ENV DIASPORA_HOME /home/diaspora/diaspora
RUN mkdir $DIASPORA_HOME
WORKDIR $DIASPORA_HOME

RUN curl -L -O \
https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 \
&& tar -xjf phantomjs-2.1.1-linux-x86_64.tar.bz2 \
&& mkdir -p ~/.phantomjs/2.1.1 \
&& mv phantomjs-2.1.1-linux-x86_64 ~/.phantomjs/2.1.1/x86_64-linux \
&& rm phantomjs-2.1.1-linux-x86_64.tar.bz2

ENV GEM_HOME $DIASPORA_HOME/vendor/bundle
ENV BUNDLE_PATH="$GEM_HOME" \
BUNDLE_BIN="$GEM_HOME/bin" \
Expand Down
20 changes: 19 additions & 1 deletion wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ print_usage() {
echo " cucumber Run all cucumber tests, or only ARGS if given"
echo " exec Execute ARGS in the project folder inside the running"
echo " diaspora* container, or, if none is running, use a new one"
echo " jasmine Run all jasmine tests"
echo " migrate Execute pending migrations (incl. database setup)"
echo " restart Fast restart using bin/eye"
echo " rspec Run all rspec tests, or only ARGS if given"
echo " setup Alias for, in that order: build, config, bundle, migrate"
echo " setup Alias for, in that order:"
echo " build, config, bundle, migrate, setup-tests"
echo " setup-tests Creates files and database structures for tests"
echo " start Start diaspora* incl. database"
echo " status Show currently running containers and related images"
echo " stop Stop all diaspora*-related containers"
Expand Down Expand Up @@ -97,6 +100,10 @@ dia_exec() {
fi
}

dia_jasmine() {
docker-compose run --rm $option diaspora /bin/bash -c 'RAILS_ENV=test bin/rake tests:generate_fixtures && RAILS_ENV=test bin/rake jasmine:ci'
}

dia_migrate() {
# TODO maybe if db was not running before, stop it again
! dia_is_configured && exit_unconfigured
Expand Down Expand Up @@ -134,6 +141,11 @@ dia_setup() {
dia_config
dia_bundle
dia_migrate
dia_setup_tests
}

dia_setup_tests() {
docker-compose run --rm diaspora /bin/sh -c "RAILS_ENV=test bin/rake db:create db:migrate tests:generate_fixtures assets:generate_error_pages"
}

dia_start() {
Expand Down Expand Up @@ -202,6 +214,9 @@ case $dia_command in
exec)
dia_exec "$@"
;;
jasmine)
dia_jasmine
;;
migrate)
dia_migrate
;;
Expand All @@ -217,6 +232,9 @@ case $dia_command in
setup)
dia_setup
;;
setup-tests)
dia_setup_tests
;;
start)
dia_start
;;
Expand Down

0 comments on commit 3de9086

Please sign in to comment.