0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Rails】Railsでカバレッジを計測する

Last updated at Posted at 2022-05-23

初めに

Rails6のプロジェクトにカバレッジを導入したので、そのやり方を記事にしておきます。

環境

  • Rails 6.1.4
  • Ruby 2.7.4
  • simplecov 0.21.2

simplecov を導入する

カバレッジを測定するためのジェムであるsimplecovを追加します。

Gemfile
group :test do
  gem 'simplecov', require: false
end

simplecovの設定を追加する。

spec/rails_helper.rb
require 'spec_helper'
require 'simplecov'
SimpleCov.start 'rails'


RSpec.configure do |config|
# 省略
end

これでRspec実行後に、coverage/index.htmlに実行結果が出力されます。

参考

simplecov - Github

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?