Hide the list of files when running rspec?

柔情痞子 提交于 2019-11-28 03:39:20

问题


When running rake spec on the command line for a large Rails project, I get a giant list of every rspec file that will be run.

Is there a way to hide that by default?

ruby-1.9.3-p448/bin/ruby -S rspec ./spec/acceptance/replicators/activity_replicator_spec.rb ./spec/acceptance/replicators/template_replicator_spec.rb ./spec/authorization_rules/admin_authorization_rules_spec.rb ...

When I run just rspec (no rake call) I don't get this console output.


EDIT 1

Working from phoet's answer, I tried

RSpec::Core::RakeTask.new(:spec) do |t|
  t.verbose = false
  t.warning = false
  t.rcov = false
end

task :default => :spec

This did not solve the issue.


回答1:


The last time I did this, I had to clear the rake task first.

if defined? RSpec
  task(:spec).clear
  RSpec::Core::RakeTask.new(:spec) do |t|
    t.verbose = false
  end
end

http://singlebrook.com/blog/disable-rspec-verbosity-to-hide-spec-list




回答2:


You don't get such an output when calling rspec because the output comes from the RSpec::Core::RakeTask.

It's possible to configure this class and set the verbose flag:

RSpec::Core::RakeTask.new do |t|
  t.verbose = false
end


来源:https://stackoverflow.com/questions/19935915/hide-the-list-of-files-when-running-rspec

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!