Sha256: d9ff99deea9b0de644afacdd60cad4910ab9163e7c3c7f4ac976e933bd19b433

Contents?: true

Size: 984 Bytes

Versions: 12

Compression:

Stored size: 984 Bytes

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(duration, example_count, failure_count, pending_count)
    dump_summary_original(duration, example_count, failure_count, 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

12 entries across 12 versions & 1 rubygems

Version Path
test_notifier-2.0.3 lib/test_notifier/runner/rspec2.rb
test_notifier-2.0.2 lib/test_notifier/runner/rspec2.rb
test_notifier-2.0.1 lib/test_notifier/runner/rspec2.rb
test_notifier-2.0.0 lib/test_notifier/runner/rspec2.rb
test_notifier-1.0.1 lib/test_notifier/runner/rspec.rb
test_notifier-1.0.0 lib/test_notifier/runner/rspec.rb
test_notifier-0.4.0 lib/test_notifier/runner/rspec.rb
test_notifier-0.3.6 lib/test_notifier/runner/rspec.rb
test_notifier-0.3.5 lib/test_notifier/runner/rspec.rb
test_notifier-0.3.5.rc.4 lib/test_notifier/runner/rspec.rb
test_notifier-0.3.4 lib/test_notifier/runner/rspec.rb
test_notifier-0.3.3 lib/test_notifier/runner/rspec.rb