Sha256: 2a657e6ca2cbb34d8c5725da6e9107b2f081c6aa66c2d7a2d193e5d67e2d144f

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

require "test_notifier"
require "rspec/core/formatters/base_text_formatter"

class RSpec::Core::Formatters::BaseTextFormatter
  alias dump_summary_original dump_summary

  def dump_summary(options)
    dump_summary_original(options)
    example_count = options[:example_count]
    failure_count = options[:failure_count]
    pending_count = options[:pending_count]

    return if example_count.zero?

    failure_filter = proc {|e|
      e.instance_variable_get("@exception").class.name == "RSpec::Expectations::ExpectationNotMetError"
    }

    error_filter = proc {|e|
      %w[RSpec::Expectations::ExpectationNotMetError NilClass].include?(e.instance_variable_get("@exception").class.name)
    }

    stats = TestNotifier::Stats.new(:rspec, {
      :count    => example_count,
      :failures => examples.select(&failure_filter).count,
      :pending  => pending_count,
      :errors   => examples.reject(&error_filter).count
    })

    TestNotifier.notify(:status => stats.status, :message => stats.message)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
test_notifier-2.0.0 lib/test_notifier/runner/rspec3.rb