Skip to content
This repository has been archived by the owner on May 2, 2020. It is now read-only.

Testing

Addison Martin edited this page May 3, 2019 · 35 revisions

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.

Running the Tests

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

Continuous Integration

Each commit and pull request has all tests 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.

Adding New Tests

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/.