Gems every Rails and Ruby project should use

Photo by Don Agnello from Unsplash


rspec (or rspec-rails for Rails)
rubocop (or rubocop-rails for Rails)


In the past few years, I’ve built a handful of Ruby based repos from scratch including Gusto’s Partner Directory as well as our OmniAuth strategy gem. While these projects have ranged from being Rails apps, to Rails engines, to Ruby gems, I’ve consistently used these three gems to lay the groundwork for development. Here’s a short explanation of each gem and how they’ve been essential to each project’s success.


👉 For consistency and linting

These are the primary commands I use to with RuboCop:

# Show files that are violating rules
> bundle exec rubocop --color --force-exclusion --format simple
# Show files that are violating rules and auto-correct
> bundle exec rubocop --color --force-exclusion --format simple --auto-correct
# Generate "TODO" list of files that break rules
> bundle exec rubocop --auto-gen-config
Does anybody else feel weirdly satisfied after auto-correcting their projects with RuboCop?

RuboCop HQ also provides a RuboCop Rails gem which includes RuboCop’s functionality plus more in the context of Rails. It is useful to setup RuboCop as a build check in CI as well as a pre-commit hook so that you are enforced to have linted code.

Install with: $ gem install rubocop or $ gem install rubocop-rails


👉 For testing

Example RSpec test

Install with: $ gem install rspec or $ gem install rspec-rails


👉 For debugging


within any block of code in order to stop your program and investigate local variables and method calls.

Sample debugging session

Note: I would recommend the pry-byebug gem over the pry gem since it includes more functionality such as stack navigation.

Install with: $ gem install pry-byebug

Other 👌 gems

factory_bot_rails ⟶ Generating model records in Rails
faker ⟶ Creating fake data (ex. Faker::Hacker.say_something_smart)
httparty ⟶ Make HTTP requests

✌🏻 Software engineer @ Loom • (she / her)

✌🏻 Software engineer @ Loom • (she / her)