RSpec 4 Challenges

It seems like every time I run my tests a new error comes up. My biggest problem with testing is a lack of complete dedication to testing. Testing is something I pick up and put down. Like one day I’ll write 50 tests, and then for a month I’ll write none. Then every time I need to write a test it’s like relearning the damn wheel.. So instead of dedicating myself to testing, I’ve decided to keep a log of all the problems I have with RSpec and hopes of creating a really nice reference document.

Controller Test Not Working, weird error

This has happened before. When I ran the test, it said oh snap, dawg, we can’t require ‘rails_helper’. And I was like oh shit, what’s wrong! Well I found all these articles that said to reinstall rspec by running the command rails g rspec:install. Turns out it wasn’t related to that at all, it was that my migrations in the test db weren’t up to date. So I ran

rake db:test:prepare

to fix that error!

Post Content