Class: RSpec::Core::Notifications::ExamplesNotification
Relationships & Source Files | |
Inherits: | Object |
Defined in: | rspec-core/lib/rspec/core/notifications.rb |
Overview
The ExamplesNotification
represents notifications sent by the reporter which contain information about the suites examples.
Class Method Summary
- .new(reporter) ⇒ ExamplesNotification constructor
Instance Method Summary
- #examples ⇒ Array<RSpec::Core::Example>
- #failed_examples ⇒ Array<RSpec::Core::Example>
- #failure_notifications ⇒ Array<RSpec::Core::Notifications::FailedExampleNotification>
- #fully_formatted_failed_examples(colorizer = ::RSpec::Core::Formatters::ConsoleCodes) ⇒ String
- #fully_formatted_pending_examples(colorizer = ::RSpec::Core::Formatters::ConsoleCodes) ⇒ String
- #notifications ⇒ Array<RSpec::Core::Notifications::ExampleNotification>
- #pending_examples ⇒ Array<RSpec::Core::Example>
-
#pending_notifications ⇒ Array<RSpec::Core::Notifications::SkippedExampleNotification, RSpec::Core::Notifications::PendingExampleFailedAsExpectedNotification>
returns pending examples as notifications.
- #format_examples(examples) private
Constructor Details
.new(reporter) ⇒ ExamplesNotification
# File 'rspec-core/lib/rspec/core/notifications.rb', line 70
def initialize(reporter) @reporter = reporter end
Instance Method Details
#examples ⇒ Array
<RSpec::Core::Example>
# File 'rspec-core/lib/rspec/core/notifications.rb', line 75
def examples @reporter.examples end
#failed_examples ⇒ Array
<RSpec::Core::Example>
# File 'rspec-core/lib/rspec/core/notifications.rb', line 80
def failed_examples @reporter.failed_examples end
#failure_notifications ⇒ Array
<RSpec::Core::Notifications::FailedExampleNotification>
# File 'rspec-core/lib/rspec/core/notifications.rb', line 97
def failure_notifications @failed_notifications ||= format_examples(failed_examples) end
#format_examples(examples) (private)
[ GitHub ]# File 'rspec-core/lib/rspec/core/notifications.rb', line 136
def format_examples(examples) examples.map do |example| ExampleNotification.for(example) end end
#fully_formatted_failed_examples(colorizer = ::RSpec::Core::Formatters::ConsoleCodes) ⇒ String
# File 'rspec-core/lib/rspec/core/notifications.rb', line 110
def fully_formatted_failed_examples(colorizer=::RSpec::Core::Formatters::ConsoleCodes) formatted = "\nFailures:\n" failure_notifications.each_with_index do |failure, index| formatted += failure.fully_formatted(index.next, colorizer) end formatted end
#fully_formatted_pending_examples(colorizer = ::RSpec::Core::Formatters::ConsoleCodes) ⇒ String
# File 'rspec-core/lib/rspec/core/notifications.rb', line 122
def fully_formatted_pending_examples(colorizer=::RSpec::Core::Formatters::ConsoleCodes) return if RSpec.configuration.pending_failure_output == :skip formatted = "\nPending: (Failures listed here are expected and do not affect your suite's status)\n".dup pending_notifications.each_with_index do |notification, index| formatted << notification.fully_formatted(index.next, colorizer) end formatted end
#notifications ⇒ Array
<RSpec::Core::Notifications::ExampleNotification>
# File 'rspec-core/lib/rspec/core/notifications.rb', line 91
def notifications @notifications ||= format_examples(examples) end
#pending_examples ⇒ Array
<RSpec::Core::Example>
# File 'rspec-core/lib/rspec/core/notifications.rb', line 85
def pending_examples @reporter.pending_examples end
#pending_notifications ⇒ Array
<RSpec::Core::Notifications::SkippedExampleNotification,
RSpec::Core::Notifications::PendingExampleFailedAsExpectedNotification>
returns pending examples as notifications
# File 'rspec-core/lib/rspec/core/notifications.rb', line 104
def pending_notifications @pending_notifications ||= format_examples(pending_examples) end