-
Notifications
You must be signed in to change notification settings - Fork 2
Testing
This section will show you how to run all the system tests, as well as how to add new tests. See the table of contents, for setting up your development environment first.
Navigate into the project's root folder.
cd share-the-food/
Run the unit tests.
rails test
Run the system, i.e. feature, tests.
rails test:system
Navigate to the project's root folder.
cd share-the-food/
Run Rubocop, the analyzer.
rubocop
Rubocop can automatically fix many of the issues it detects.
rubocop -a
A sonarqube analysis is automatically performed by Travis CI. Visit the dashboard.
Each commit and pull request has all tests and a style check automatically run by Travis CI. The master branch is protected, you cannot commit directly into it. Instead, create another branch, make your changes, then create a pull request into master. Only once all tests have passed (and someone else has reviewed the code) can the pull request be merged.
Tests are located in share-the-food/test.
Test data are stored in fixtures at test/fixtures. Each file is split per model.
Unit tests are located in /test/models/*. Each file is split per model.
Feature tests are located in /test/system/*. Each file is a different page of the website. Multiple features are stored per file.
Tests for controllers, helpers, mailers, and integration tests can also be added (they currently don't have any tests written) in test/controllers/, test/helpers/, test/mailers/, and test/integration/.