From 8bb7860ae48238340454d75f1723bd1ce9bd6f32 Mon Sep 17 00:00:00 2001 From: Matt Wynne Date: Mon, 3 Aug 2015 16:44:01 +0100 Subject: [PATCH] Simplify Runtime API by using EventBus for StepMatches --- lib/cucumber/formatter/usage.rb | 6 +++++- lib/cucumber/runtime.rb | 4 ---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/cucumber/formatter/usage.rb b/lib/cucumber/formatter/usage.rb index d029df3efa..a8c74afacf 100644 --- a/lib/cucumber/formatter/usage.rb +++ b/lib/cucumber/formatter/usage.rb @@ -16,12 +16,16 @@ def initialize(runtime, path_or_io, options) @options = options @stepdef_to_match = Hash.new { |h, stepdef_key| h[stepdef_key] = [] } @total_duration = 0 + @matches = {} + runtime.configuration.on_event :step_match do |event| + @matches[event.test_step.source] = event.step_match + end end def after_test_step(test_step, result) return if HookQueryVisitor.new(test_step).hook? - step_match = @runtime.step_match(test_step.source.last.name) + step_match = @matches[test_step.source] step_definition = step_match.step_definition stepdef_key = StepDefKey.new(step_definition.regexp_source, step_definition.location) unless @stepdef_to_match[stepdef_key].map { |key| key[:location] }.include? test_step.location diff --git a/lib/cucumber/runtime.rb b/lib/cucumber/runtime.rb index 0b315e70c2..1786c86b86 100644 --- a/lib/cucumber/runtime.rb +++ b/lib/cucumber/runtime.rb @@ -87,10 +87,6 @@ def steps(status = nil) @results.steps(status) end - def step_match(step_name, name_to_report=nil) #:nodoc: - @support_code.step_match(step_name, name_to_report) - end - def unmatched_step_definitions @support_code.unmatched_step_definitions end