Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Accept multiple reporters #23

Open
marceloboeira opened this issue Feb 11, 2016 · 1 comment
Open

Feature request: Accept multiple reporters #23

marceloboeira opened this issue Feb 11, 2016 · 1 comment

Comments

@marceloboeira
Copy link
Contributor

Like rspec, (rspec/rspec-core#47), spec2 could support multiple reporters/formatters, in order to make possible to use several outputs.

I'm currently working on a way to send OSX notifications, like rspec-nc for spec2, so that would help me a lot.

@waterlink
Copy link
Owner

@marceloboeira By the way, if one uses Composite pattern, it is possible to make multiple reporters work without the modification of the library. Here is the concept:

class CompositeReporter < ::Spec2::Reporter

  def initialize(@list : Array(::Spec2::Reporter)); end

  def configure_output(output) @list.each &.configure_output(output); end
  def context_started(context) @list.each &.context_started(context); end
  def context_finished(context) @list.each &.context_finished(context); end
  def example_started(example) @list.each &.example_started(example); end
  def example_succeeded(example) @list.each &.example_succeeded(example); end
  def example_failed(example, exception) @list.each &.example_failed(example, exception); end
  def example_errored(example, exception) @list.each &.example_errored(example, exception); end
  def report; @list.each &.report; end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants