Testing
After having cloned the nobrainer repository, you can run the Rspec test suite using the following.
Prerequisites
You can use a Ruby version manager and install all on your local machine, or you can use Docker (recommended way).
So you need to install Docker first.
This project is compatible with Docker Compose which is best while developing since you can very quickly run the desired tests.
Running the suite with Compose
The first step is to build the Docker image with the command:
docker-compose build gem
After this is done, you can run the suite with:
docker-compose run --rm gem rspec
On the first run, Docker Compose will download the Docker image of RethinkDB and then it will start the database and finally run the entire test suite.
Now change the code as you need and then when you need to run some tests:
docker-compose run --rm gem rspec <path to your spec file(s)>
Cleanup
When you’re done and want to cleanup your system, you can stop the stack using
CTRL
+ C
and then run the following command:
docker-compose down
WARNING: All the data will be lost.
What about the CI?
Nobrainer uses the awesome Earthly tool in order to build and run the tests. It’s a build automation tool that allow you to execute all your builds in containers, which makes builds self-contained, repeatable, portable and parallel.
In other words: If tests are passing in Earthly locally, it will pass on the CI too!
You can install Earthly locally and run the test suite with:
earthly +rspec