DEV Community

n350071🇯🇵
n350071🇯🇵

Posted on

metrics your test code coverage in Rails

🔗 Parent Note

What is it?

simplecov

SimpleCov is a code coverage analysis tool for Ruby.

How to use

Install

#Gemfile
group :test do
  gem 'simplecov'
end

Setting

#spec/rails_helper.rb
require `simplecov`
SimpleCov.start do
  add_filter %r{/spec/}
  add_group "Service", "app/services/"
end

Result

Simplecov will make a file at coverage/index.html.

You can see it on your browser.

My use case

Simplecov is also good to check Authorization gems work.

My project was a mess, and there are many wholes of pundit(it's like banken) settings.

Top comments (0)