Class: Cucumber::Formatter::Query::HookByTestStep

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/formatter/query/hook_by_test_step.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ HookByTestStep

Returns a new instance of HookByTestStep.



9
10
11
12
13
14
# File 'lib/cucumber/formatter/query/hook_by_test_step.rb', line 9

def initialize(config)
  @hook_id_by_test_step_id = {}

  config.on_event :test_step_created, &method(:on_test_step_created)
  config.on_event :hook_test_step_created, &method(:on_hook_test_step_created)
end

Instance Method Details

#hook_id(test_step) ⇒ Object



16
17
18
19
20
# File 'lib/cucumber/formatter/query/hook_by_test_step.rb', line 16

def hook_id(test_step)
  return @hook_id_by_test_step_id[test_step.id] if @hook_id_by_test_step_id.key?(test_step.id)

  raise TestStepUnknownError, "No hook found for #{test_step.id} }. Known: #{@hook_id_by_test_step_id.keys}"
end