Skip to content

Commit

Permalink
ReportAdapter should get array of formtters. Closes cucumber#603.
Browse files Browse the repository at this point in the history
  • Loading branch information
os97673 committed Nov 17, 2013
1 parent 62dce33 commit 32e3445
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
1 change: 0 additions & 1 deletion features/docs/cli/specifying_multiple_formatters.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@wip-new-core
@spawn
Feature: Running multiple formatters

Expand Down
10 changes: 6 additions & 4 deletions lib/cucumber/formatter/report_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@
module Cucumber
module Formatter

FormatterWrapper = Struct.new(:formatter) do
FormatterWrapper = Struct.new(:formatters) do
def method_missing(message, *args)
formatter.send(message, *args) if formatter.respond_to?(message)
formatters.each do |formatter|
formatter.send(message, *args) if formatter.respond_to?(message)
end
end
end

ReportAdapter = Struct.new(:runtime, :formatter) do
def initialize(runtime, formatter)
super runtime, FormatterWrapper.new(formatter)
def initialize(runtime, formatters)
super runtime, FormatterWrapper.new(formatters)
end

extend Forwardable
Expand Down
2 changes: 1 addition & 1 deletion lib/cucumber/runtime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def mappings

require 'cucumber/formatter/report_adapter'
def report
@report ||= Cucumber::Formatter::ReportAdapter.new(self, @configuration.formatters(self).first)
@report ||= Cucumber::Formatter::ReportAdapter.new(self, @configuration.formatters(self))
end

def filters
Expand Down
2 changes: 1 addition & 1 deletion spec/cucumber/formatter/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def mappings

require 'cucumber/formatter/report_adapter'
def report
@report ||= Cucumber::Formatter::ReportAdapter.new runtime, @formatter
@report ||= Cucumber::Formatter::ReportAdapter.new runtime, [@formatter]
end

require 'cucumber/core/gherkin/document'
Expand Down

0 comments on commit 32e3445

Please sign in to comment.