类: RSpec::Core::Notifications::ExamplesNotification
- 继承
-
Object
- Object
- RSpec::Core::Notifications::ExamplesNotification
- 定义在
- lib/rspec/core/notifications.rb
概述
ExamplesNotification
代表由报告器发送的包含关于套件示例信息的通知。
实例方法概要 折叠
-
#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
失败示例列表,以 RSpec 内置格式化程序的输出方式完全格式化。
-
#fully_formatted_pending_examples(colorizer = ::RSpec::Core::Formatters::ConsoleCodes) ⇒ String
待定示例列表,以 RSpec 内置格式化程序的输出方式完全格式化。
-
#initialize(reporter) ⇒ ExamplesNotification 构造函数
ExamplesNotification 的新实例。
-
#notifications ⇒ Array<RSpec::Core::Notifications::ExampleNotification>
返回示例作为通知。
-
#pending_examples ⇒ Array<RSpec::Core::Example>
待定示例列表。
-
#pending_notifications ⇒ Array<RSpec::Core::Notifications::SkippedExampleNotification, RSpec::Core::Notifications::PendingExampleFailedAsExpectedNotification>
返回待定示例作为通知。
构造函数详细信息
#initialize(reporter) ⇒ExamplesNotification
返回 ExamplesNotification 的新实例。
70 71 72 |
# File 'lib/rspec/core/notifications.rb', line 70 def initialize(reporter) @reporter = reporter end |
实例方法详细信息
#examples ⇒Array<RSpec::Core::Example>
返回示例列表。
75 76 77 |
# File 'lib/rspec/core/notifications.rb', line 75 def examples @reporter.examples end |
#failed_examples ⇒Array<RSpec::Core::Example>
返回失败示例列表。
80 81 82 |
# File 'lib/rspec/core/notifications.rb', line 80 def failed_examples @reporter.failed_examples end |
#failure_notifications ⇒Array<RSpec::Core::Notifications::FailedExampleNotification>
返回失败示例作为通知
97 98 99 |
# File 'lib/rspec/core/notifications.rb', line 97 def failure_notifications @failed_notifications ||= format_examples(failed_examples) end |
#fully_formatted_failed_examples(colorizer = ::RSpec::Core::Formatters::ConsoleCodes) ⇒String
返回失败示例列表,以 RSpec 内置格式化程序的输出方式完全格式化。
110 111 112 113 114 115 116 117 118 |
# File '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
返回待定示例列表,以 RSpec 内置格式化程序的输出方式完全格式化。
122 123 124 125 126 127 128 129 130 131 132 |
# File '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>
返回示例作为通知
91 92 93 |
# File 'lib/rspec/core/notifications.rb', line 91 def notifications @notifications ||= format_examples(examples) end |
#pending_examples ⇒Array<RSpec::Core::Example>
返回待定示例列表。
85 86 87 |
# File '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>
返回待定示例作为通知
104 105 106 |
# File 'lib/rspec/core/notifications.rb', line 104 def pending_notifications @pending_notifications ||= format_examples(pending_examples) end |