Class: RSpec::Core::Notifications::ExamplesNotification
- Inherits:
-
Object
- Object
- RSpec::Core::Notifications::ExamplesNotification
- Defined in:
- lib/rspec/core/notifications.rb
Overview
The ExamplesNotification
represents notifications sent by the reporter
which contain information about the suites examples.
Instance Method Summary collapse
-
#examples ⇒ Array<RSpec::Core::Example>
List of examples.
-
#failed_examples ⇒ Array<RSpec::Core::Example>
List of failed examples.
-
#failure_notifications ⇒ Array<RSpec::Core::Notifications::FailedExampleNotification>
Returns failed examples as notifications.
-
#fully_formatted_failed_examples(colorizer = ::RSpec::Core::Formatters::ConsoleCodes) ⇒ String
The list of failed examples, fully formatted in the way that RSpec's built-in formatters emit.
-
#fully_formatted_pending_examples(colorizer = ::RSpec::Core::Formatters::ConsoleCodes) ⇒ String
The list of pending examples, fully formatted in the way that RSpec's built-in formatters emit.
-
#initialize(reporter) ⇒ ExamplesNotification
constructor
A new instance of ExamplesNotification.
-
#notifications ⇒ Array<RSpec::Core::Notifications::ExampleNotification>
Returns examples as notifications.
-
#pending_examples ⇒ Array<RSpec::Core::Example>
List of pending examples.
-
#pending_notifications ⇒ Array<RSpec::Core::Notifications::SkippedExampleNotification, RSpec::Core::Notifications::PendingExampleFailedAsExpectedNotification>
returns pending examples as notifications.
Constructor Details
#initialize(reporter) ⇒ ExamplesNotification
Returns a new instance of ExamplesNotification.
69 70 71 |
# File 'lib/rspec/core/notifications.rb', line 69 def initialize(reporter) @reporter = reporter end |
Instance Method Details
#examples ⇒ Array<RSpec::Core::Example>
Returns list of examples.
74 75 76 |
# File 'lib/rspec/core/notifications.rb', line 74 def examples @reporter.examples end |
#failed_examples ⇒ Array<RSpec::Core::Example>
Returns list of failed examples.
79 80 81 |
# File 'lib/rspec/core/notifications.rb', line 79 def failed_examples @reporter.failed_examples end |
#failure_notifications ⇒ Array<RSpec::Core::Notifications::FailedExampleNotification>
Returns failed examples as notifications
96 97 98 |
# File 'lib/rspec/core/notifications.rb', line 96 def failure_notifications @failed_notifications ||= format_examples(failed_examples) end |
#fully_formatted_failed_examples(colorizer = ::RSpec::Core::Formatters::ConsoleCodes) ⇒ String
Returns The list of failed examples, fully formatted in the way that RSpec's built-in formatters emit.
109 110 111 112 113 114 115 116 117 |
# File 'lib/rspec/core/notifications.rb', line 109 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
Returns The list of pending examples, fully formatted in the way that RSpec's built-in formatters emit.
121 122 123 124 125 126 127 128 129 |
# File 'lib/rspec/core/notifications.rb', line 121 def fully_formatted_pending_examples(colorizer=::RSpec::Core::Formatters::ConsoleCodes) formatted = "\nPending: (Failures listed here are expected and do not affect your suite's status)\n" pending_notifications.each_with_index do |notification, index| formatted << notification.fully_formatted(index.next, colorizer) end formatted end |
#notifications ⇒ Array<RSpec::Core::Notifications::ExampleNotification>
Returns examples as notifications
90 91 92 |
# File 'lib/rspec/core/notifications.rb', line 90 def notifications @notifications ||= format_examples(examples) end |
#pending_examples ⇒ Array<RSpec::Core::Example>
Returns list of pending examples.
84 85 86 |
# File 'lib/rspec/core/notifications.rb', line 84 def pending_examples @reporter.pending_examples end |
#pending_notifications ⇒ Array<RSpec::Core::Notifications::SkippedExampleNotification, RSpec::Core::Notifications::PendingExampleFailedAsExpectedNotification>
returns pending examples as notifications
103 104 105 |
# File 'lib/rspec/core/notifications.rb', line 103 def pending_notifications @pending_notifications ||= format_examples(pending_examples) end |