Set up RSpec to save you time
As developers, we have to resolve bugs in our software. And the sooner we find them out, the better our lives are.
Yes, I hear your voice. It’s testing. You are brilliant.
In this blog post, we will explore how we can set up testing for our Ruby on Rails projects with RSpec. Why RoR? Well, because I’m familiar with it.
1. The Gemfile
Enough long talk, let’s install the dependencies in your Gemfile.
Then just:
Let me have some words about the above libraries:
rspec-rails
is for, hmmm, RSpec itself.factory_bot_rails
is used to manage testing data which guys often call themfixtures
.
2. Initialize
3. Configuration
4. Profit
And that’s it. You are good to go now. Cheers!