1月15日開催!現年収非公開で企業からスカウトをもらってみませんか?PR

転職ドラフトでリアルな市場価値を測る。レジュメをもとに、企業から年収とミッションが提示されます。

6
1

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 5 years have passed since last update.

simplecovでデフォルトのタブを消す方法

Posted at

結論

spec/rails_helper.rbにgroups.clearを記述して1つづつ再定義しよう

環境

Ruby 2.3.7
Rails 4.2.5
simplecov 0.16.1
rspec-rails 3.4.2

やりたい事

simplecovのデフォルトグルーピングを削除したい。
(うちはMailers、Jobsとか殆ど使ってないんで無くしたい。)

これを

image.png

こうしたい

image.png

やり方

以下のファイルを編集しよう

spec/rails_helper.rb

  SimpleCov.start :rails do
    groups.clear # 一旦全定義をclear
    # グルーピングしたい定義を1つづつ再定義
    add_group 'Controllers', 'app/controllers'
    add_group 'Models', 'app/models'
    add_group 'Helpers', 'app/helpers'
    add_group 'Libraries', 'lib/'
    # 集計除外したい場合はfilterにぶち込もう
    add_filter %w[app/services app/jobs]
  end

デフォルトのタブは以下で定義されている。(これは編集しない)

.bundle/ruby/2.3.0/gems/simplecov-0.16.1/lib/simplecov/profiles/rails.rb

# frozen_string_literal: true
[SimpleCov.profiles.define "rails" do
  load_profile "test_frameworks"

  add_filter %r{^/config/}
  add_filter %r{^/db/}

  add_group "Controllers", "app/controllers"
  add_group "Channels", "app/channels" if defined?(ActionCable)
  add_group "Models", "app/models"
  add_group "Mailers", "app/mailers"
  add_group "Helpers", "app/helpers"
  add_group "Jobs", %w[app/jobs app/workers]
  add_group "Libraries", "lib/"

  track_files "{app,lib}/**/*.rb"
end](url)
6
1
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

Qiita Advent Calendar is held!

Qiita Advent Calendar is an article posting event where you post articles by filling a calendar 🎅

Some calendars come with gifts and some gifts are drawn from all calendars 👀

Please tie the article to your calendar and let's enjoy Christmas together!

6
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Login to continue?

Login or Sign up with social account

Login or Sign up with your email address