Hide the list of files when running rspec?
Asked Answered
F

2

7

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.

Faggot answered 12/11, 2013 at 17:28 Comment(0)
S
9

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

Subshrub answered 30/12, 2013 at 20:6 Comment(1)
I also think rake is too noisy but haven't found a solution to that yet.Subshrub
I
0

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
Ideomotor answered 12/11, 2013 at 19:38 Comment(2)
I tried this and it did not work. I still get the giant list of files being run after ruby -S rspec. I tried a couple of other options as well: RSpec::Core::RakeTask.new(:spec) do |t| t.verbose = false t.warning = false t.rcov = false end task :default => :specFaggot
i guess you will have to write your own rake task for that. the rspec-rails task does not take any options: github.com/rspec/rspec-rails/blob/master/lib/rspec/rails/tasks/…Ideomotor

© 2022 - 2024 — McMap. All rights reserved.