Class: RSpec::Core::Reporter

Inherits:
Object
  • Object
show all
Defined in:
opal/opal/rspec/fixes/rspec/core/reporter.rb,
opal/opal/rspec/async/reporter.rb

Instance Method Summary collapse

Instance Method Details

#register_listener(listener, *notifications) ⇒ Object

https://github.com/opal/opal/issues/858, fixed in Opal 0.9 The problem is not directly related to the Reporter class (it has more to do with Formatter's call in add using a splat in the args list and right now, Opal does not run a to_a on a set that can be an array in the splat before the callee method takes over)



5
6
7
8
9
10
11
12
# File 'opal/opal/rspec/fixes/rspec/core/reporter.rb', line 5

def register_listener(listener, *notifications)
  # Without this, we won't flatten out each notification properly (e.g. example_started, finished, etc.)
  notifications = notifications[0].to_a if notifications[0].is_a? Set
  notifications.each do |notification|
    @listeners[notification.to_sym] << listener
  end
  true
end

#report_async(expected_example_count) ⇒ Object



2
3
4
5
6
7
8
# File 'opal/opal/rspec/async/reporter.rb', line 2

def report_async(expected_example_count)
  start(expected_example_count)
  yield(self).ensure do |result|
    finish
    result
  end
end