Sha256: 37f0cef7ec4bb2e58660cd1227060017bdac31e87699b83629e043bb55497d0f

Contents?: true

Size: 627 Bytes

Versions: 6

Compression:

Stored size: 627 Bytes

Contents

require 'nc'

class NcFirstFail < Nc
  if rspec_3?
    RSpec::Core::Formatters.register self, :example_failed
  end

  def example_failed(example)
    # For rspec3
    example = example.example if example.respond_to?(:example)
    @failed_examples ||= []
    if @failed_examples.size == 0
      name = File.basename(File.expand_path '.')
      say "\u26D4 #{name}: Failure", "#{example.metadata[:full_description]}\n#{example.exception}"
    end
    @failed_examples << example
  end

  def dump_summary(*args)
    failure_count = self.class.rspec_3? ? args[0].failure_count : args[2]
    super if failure_count == 0
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
rspec-nc-0.2.1 lib/nc_first_fail.rb
mastermind_adeybee-0.1.4 vendor/bundle/ruby/2.2.0/gems/rspec-nc-0.2.0/lib/nc_first_fail.rb
mastermind_adeybee-0.1.3 vendor/bundle/ruby/2.2.0/gems/rspec-nc-0.2.0/lib/nc_first_fail.rb
mastermind_adeybee-0.1.2 vendor/bundle/ruby/2.2.0/gems/rspec-nc-0.2.0/lib/nc_first_fail.rb
mastermind_adeybee-0.1.1 vendor/bundle/ruby/2.2.0/gems/rspec-nc-0.2.0/lib/nc_first_fail.rb
rspec-nc-0.2.0 lib/nc_first_fail.rb