LoginSignup
0
0

More than 5 years have passed since last update.

RSpecの実行時、pending exampleのリストをやめるには

Last updated at Posted at 2017-05-25

RSpecを実行したとき、pendingテストがあると、そのリストが出ます。pendingが少ないときはこれでもよいのですが、長くなるとじゃまな場合もあります。

pendingは件数だけで十分という場合の対応がここに書いてありました。
https://github.com/rspec/rspec-core/issues/2377

具体的には、以下の手順でできます。

  • ~/.no_pending.rb を作っておく
  • rspec実行時に -r ~/.no_pending をつける
    • 例: bundle exec rspec -r ~/.no_pending -fp

.no_pending.rb

# -*-ruby-*-

# Silence output from pending examples in documentation formatter
# https://github.com/rspec/rspec-core/issues/2377

module FormatterOverrides
  def example_pending(_)
  end

  def dump_pending(_)
  end
end

RSpec::Core::Formatters::DocumentationFormatter.prepend FormatterOverrides
RSpec::Core::Formatters::ProgressFormatter.prepend FormatterOverrides

実行例:

% bundle exec rspec -r ~/.no_pending -fp
..........................................

Finished in 1.59 seconds (files took 0.68398 seconds to load)
42 examples, 0 failures, 10 pending
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