-
Notifications
You must be signed in to change notification settings - Fork 253
Testing and Developing Blacklight
- Ruby
- Docker
- Docker Compose
If you want to start off clean, make sure you have removed artifacts from prior runs, such as Gemfile.lock and the .internal_test_app/ directory. Also, you may also want to pull the latest Blacklight commits.
To update the docker containers, run docker-compose pull. This will provide you the latest Solr image as specified by SOLR_VERSION in the .env file, which you are free to customize for your needs.
Decide what versions of Ruby and Rails you will test with locally. Make sure the RAILS_VERSION environment variable is set appropriately before running bundle install.
Run rake. This runs the default rake task which:
- Validates that the Blacklight codebase satisfies Rubocop
- Spins up Solr via
docker-compose - Builds a test application (with the version of Rails specified in
RAILS_VERSION) - Indexes seed data in the test application and Solr
- Runs the Blacklight test suite
The default rake task will re-index test data in solr and re-build the test application (if needed). Running the full test suite can be time-consuming. You may prefer to set up the environment and run tests as separate steps.
To spin up Solr in the background:
$ docker-compose up -d solr
To create the dummy test app (in the .internal_test_app directory):
$ rake engine_cart:generate
To index the test data, from inside the .internal_test_app directory run:
$ RAILS_ENV=test rake blacklight:index:seed
Then back in the blacklight directory, run all the specs with:
$ rspec
Or run just one spec:
$ rspec just/one_spec.rb