Class: Cucumber::Formatter::Query::TestCaseStartedByTestCase

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

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ TestCaseStartedByTestCase

Returns a new instance of TestCaseStartedByTestCase.



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

def initialize(config)
  @config = config
  config.on_event :test_case_created, &method(:on_test_case_created)
  config.on_event :test_case_started, &method(:on_test_case_started)

  @attempts_by_test_case_id = {}
  @test_case_started_id_by_test_case_id = {}
end

Instance Method Details

#attempt_by_test_case(test_case) ⇒ Object



18
19
20
21
22
# File 'lib/cucumber/formatter/query/test_case_started_by_test_case.rb', line 18

def attempt_by_test_case(test_case)
  raise TestCaseUnknownError, "No test case found for #{test_case.id} }. Known: #{@attempts_by_test_case_id.keys}" unless @attempts_by_test_case_id.key?(test_case.id)

  @attempts_by_test_case_id[test_case.id]
end

#test_case_started_id_by_test_case(test_case) ⇒ Object



24
25
26
27
28
# File 'lib/cucumber/formatter/query/test_case_started_by_test_case.rb', line 24

def test_case_started_id_by_test_case(test_case)
  raise TestCaseUnknownError, "No test case found for #{test_case.id} }. Known: #{@test_case_started_id_by_test_case_id.keys}" unless @test_case_started_id_by_test_case_id.key?(test_case.id)

  @test_case_started_id_by_test_case_id[test_case.id]
end