Class: Cucumber::Formatter::Query::PickleByTest

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

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ PickleByTest

Returns a new instance of PickleByTest.



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

def initialize(config)
  @pickle_id_by_test_case_id = {}
  config.on_event :test_case_created, &method(:on_test_case_created)
end

Instance Method Details

#pickle_id(test_case) ⇒ Object



14
15
16
17
18
# File 'lib/cucumber/formatter/query/pickle_by_test.rb', line 14

def pickle_id(test_case)
  return @pickle_id_by_test_case_id[test_case.id] if @pickle_id_by_test_case_id.key?(test_case.id)

  raise TestCaseUnknownError, "No pickle found for #{test_case.id} }. Known: #{@pickle_id_by_test_case_id.keys}"
end