Class: RSpec::Core::Formatters::BaseTextFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/test_notifier/runner/rspec3.rb,
lib/test_notifier/runner/rspec2.rb

Instance Method Summary collapse

Instance Method Details

#dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/test_notifier/runner/rspec3.rb', line 8

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

#dump_summary_originalObject


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/test_notifier/runner/rspec3.rb', line 6

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