Printing Specification Name

I have a problem running my specifications for a rails application with rake, it hangs on a specific specification. I would like to see which specification works.

+3
source share
1 answer

I have a pretty funny answer for you.

The problem, as I see it, is that the specification name is written after success or failure. And in your case it will never happen.

, ! , . , , , , , (http://github.com/rspec/rspec-core/tree/master/lib/rspec/core/formatters/) example_started, , .

- spec/support/formatters/fearious_formatter.rb

class AnxiousFormatter < RSpec::Core::Formatters::DocumentationFormatter
  def example_started(example)
    message = "- #{example.description}"
    output.puts message
    output.flush
  end
end

:

spec -r spec/support/formatters/anxious_formatter.rb -f AnxiousFormatter spec/models/...

Rails 3 RSpec 2.0 - . ( Rails 2 RSpec 1.x) : https://github.com/dchelimsky/rspec/wiki/custom-formatters

, ?

+4

Source: https://habr.com/ru/post/1766859/


All Articles