Testing API Endpoints with RSpec on Rails

In my recent article, I went over the differences between two very popular types of testing- Mocha and Jest. This time around I wanted to touch on RSpec, a testing suite for Ruby. Ruby on Rails is also my preferred backend, so I was more than happy to take on the task of learning a bit about RSpec for a recent interview.

My challenge was to create an API with custom endpoints and then build RSpec tests for each one of those endpoints. Lucky for me, my recent dive into the world of testing certainly helped, as the flow of logic is similar to what I had…