Posted about 6 years ago. Visible to the public.

RSpec in depth [2d]


Work through the following chapters from the Rails 5 edition of Everyday Rails Testing with RSpec Archive , 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)
    Note: in spec/rails_helper.rb uncomment
    Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
  • 7 - Testing the API with request specs
  • 8 - Keeping specs DRY
  • 9 - Writing tests faster, and writing faster tests
    Use "gem 'shoulda-matchers', '~>3.1.3'"
  • 10 - Testing the rest
  • In the Rails 4 edition of the book: "Testing the time" in chapter 10

Also read through the documentation of both factory_bot Archive (formerly known as factory_girl) and Machinist 1 Archive . These are the gems you will encounter for test data generation in our projects.

RSpec matchers

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.

Shoulda matchers

Many of our projects use Shoulda Matchers Archive .

Find out what it does.

Add specs for some validations in your MovieDB.

Owner of this card:

Henning Koch
Last edit:
6 months ago
by Henning Koch
Posted by Henning Koch to makandra Curriculum
This website uses short-lived cookies to improve usability.
Accept or learn more