Class: RSpec::Core::Reporter
- Inherits:
-
Object
- Object
- RSpec::Core::Reporter
- Defined in:
- lib/rspec/core/reporter.rb
Overview
A reporter will send notifications to listeners, usually formatters for the spec suite run.
Instance Method Summary (collapse)
-
- (Reporter) initialize(configuration)
constructor
A new instance of Reporter.
-
- (void) register_listener(listener, *notifications)
Registers a listener to a list of notifications.
-
- (void) report(expected_example_count) {|Block| ... }
Initializes the report run and yields itself for further reporting.
Constructor Details
- (Reporter) initialize(configuration)
Returns a new instance of Reporter
5 6 7 8 9 10 11 12 |
# File 'lib/rspec/core/reporter.rb', line 5 def initialize(configuration) @configuration = configuration @listeners = Hash.new { |h, k| h[k] = Set.new } @examples = [] @failed_examples = [] @pending_examples = [] @duration = @start = @load_time = nil end |
Instance Method Details
- (void) register_listener(listener, *notifications)
Registers a listener to a list of notifications. The reporter will send notification of events to all registered listeners
22 23 24 25 26 27 |
# File 'lib/rspec/core/reporter.rb', line 22 def register_listener(listener, *notifications) notifications.each do |notification| @listeners[notification.to_sym] << listener end true end |
- (void) report(count, &block) - (void) report(count, &block)
Initializes the report run and yields itself for further reporting. The block is required, so that the reporter can manage cleaning up after the run.
50 51 52 53 54 55 56 57 |
# File 'lib/rspec/core/reporter.rb', line 50 def report(expected_example_count) start(expected_example_count) begin yield self ensure finish end end |