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.


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

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


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

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


21
22
23
24
# File 'lib/cucumber/formatter/query/test_case_started_by_test_case.rb', line 21

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