Skip to content

Commit

Permalink
[ci] Add shared examples best practices docu
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisBr committed Jun 9, 2016
1 parent 6d5aff8 commit 6f9c3a1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/api/spec/README.md
Expand Up @@ -172,6 +172,12 @@ Before you finally commit your test, you should remove the generated cassettes a
This ensures that only by the test needed responses are included in the cassette and nothing more.
You can also review the cassette manually (but **NEVER** edit them manually)!

### Shared examples
To DRY our tests we use in rare situations [shared examples](https://www.relishapp.com/rspec/rspec-core/docs/example-groups/shared-examples).
You should only use shared examples where you have the exact same functionality (e.g. package/project or user/group tab).
Otherwise these tests get fast hard to refactor and review.
In our experience, shared examples are used mainly for controllers. Since models are pretty different from each other, they (usually) do not share much logic.

### Migrating tests
When migrating tests from the old minitest based suite to rspec, please add the
file path of the new one to every test covered.
Expand Down

0 comments on commit 6f9c3a1

Please sign in to comment.