RSpec in depth [2d]
Work through the following chapters from the Rails 5 edition of Everyday Rails Testing with RSpec (in our library => backoffice), if you haven't read them yet.
- 3 - Model specs
- 4 - Creating meaningful test data
- 5 - Controller specs (we don't often write them, but sometimes they are useful)
- 7 - Testing the API with request specs
- 8 - Keeping specs DRY
- 9 - Writing tests faster, and writing faster tests
- 10 - Testing the rest
- In the Rails 4 edition of the book: "Testing the time" in chapter 10
Get an overview of all the matchers that are build into RSpec:
Play with every other matcher in your MovieDB tests.
Write two custom matchers and use them in your MovieDB tests.
More RSpec features
Understand the following RSpec features. Try to use them in MovieDB where possible.
- Nested example groups
- Shared examples
- Shared examples with parameters
- Stubbing of existing methods
- Expectations: Setting constraints and Configuring responses
- Any instance
- Message chains
- Mock objects (or “doubles”)
- Verifying doubles
Many of our projects use Shoulda Matchers.
Find out what it does.
Add specs for some validations in your MovieDB.