Rails Adventure du Jour: Testing!
So I’ve started testing my code now, and delved a bit into the world of RSpec, Capybara and BDD.
This will take a while to figure out but here are two things I learned that aren’t really described anywhere in the most popular tutorials on Rails testing:
- All your spec files should end in _spec.rb
- It’s good to know what matchers and helpers to include – config.include Devise::TestHelpers, type: :controller inside the block of RSpec.config and require ‘cancan/matchers’ are two good ones to add, if you have authentication and authorization going on with your app.