@@ -30,14 +30,21 @@ def initialize(config)
3030 @query = Cucumber ::Query . new ( @repository )
3131
3232 config . on_event :envelope , &method ( :on_envelope )
33+
34+ config . on_event :gherkin_source_parsed , &method ( :on_gherkin_source_parsed )
3335 config . on_event :gherkin_source_read , &method ( :on_gherkin_source_read )
36+ config . on_event :hook_test_step_created , &method ( :on_hook_test_step_created )
37+ config . on_event :step_activated , &method ( :on_step_activated )
38+ config . on_event :step_definition_registered , &method ( :on_step_definition_registered )
39+ # TODO: Handle TestCaseCreated
40+ config . on_event :test_case_finished , &method ( :on_test_case_finished )
3441 config . on_event :test_case_ready , &method ( :on_test_case_ready )
35- config . on_event :test_run_started , &method ( :on_test_run_started )
3642 config . on_event :test_case_started , &method ( :on_test_case_started )
37- config . on_event :test_step_started , &method ( :on_test_step_started )
38- config . on_event :test_step_finished , &method ( :on_test_step_finished )
39- config . on_event :test_case_finished , &method ( :on_test_case_finished )
4043 config . on_event :test_run_finished , &method ( :on_test_run_finished )
44+ config . on_event :test_run_started , &method ( :on_test_run_started )
45+ # TODO: Handle TestStepCreated
46+ config . on_event :test_step_finished , &method ( :on_test_step_finished )
47+ config . on_event :test_step_started , &method ( :on_test_step_started )
4148 config . on_event :undefined_parameter_type , &method ( :on_undefined_parameter_type )
4249
4350 @test_case_by_step_id = { }
@@ -74,6 +81,10 @@ def on_envelope(event)
7481 output_envelope ( event . envelope )
7582 end
7683
84+ def on_gherkin_source_parsed ( event )
85+ # TODO: Handle GherkinSourceParsed
86+ end
87+
7788 def on_gherkin_source_read ( event )
7889 message = Cucumber ::Messages ::Envelope . new (
7990 source : Cucumber ::Messages ::Source . new (
@@ -86,13 +97,12 @@ def on_gherkin_source_read(event)
8697 output_envelope ( message )
8798 end
8899
89- def on_test_case_ready ( event )
90- # TODO: Switch this over to using the Repo Query object -> `test_step_by_id`
91- # TODO: The finder in query is `find_test_step_by` (Using +TestStepStarted+ message)
92- event . test_case . test_steps . each do |step |
93- @test_case_by_step_id [ step . id ] = event . test_case
94- end
100+ def on_hook_test_step_created ( event )
101+ # TODO: Handle HookTestStepCreated
102+ @hook_by_test_step
103+ end
95104
105+ def on_test_case_ready ( event )
96106 message = Cucumber ::Messages ::Envelope . new (
97107 test_case : Cucumber ::Messages ::TestCase . new (
98108 id : event . test_case . id ,
@@ -102,6 +112,14 @@ def on_test_case_ready(event)
102112 )
103113 )
104114
115+ @repository . update ( message )
116+
117+ # TODO: Switch this over to using the Repo Query object -> `test_step_by_id`
118+ # TODO: The finder in query is `find_test_step_by` (Using +TestStepStarted+ message)
119+ event . test_case . test_steps . each do |step |
120+ @test_case_by_step_id [ step . id ] = event . test_case
121+ end
122+
105123 # TODO: Once we're comfortable switching this over. Call @repository.update(message) alongside output_envelope
106124 # however this may not be necessary as output_envelope may/should already be doing this?
107125
@@ -270,6 +288,14 @@ def on_test_run_finished(event)
270288 output_envelope ( message )
271289 end
272290
291+ def on_step_activated ( event )
292+ # TODO: Handle StepActivated
293+ end
294+
295+ def on_step_definition_registered ( event )
296+ output_envelope ( event . step_definition . to_envelope )
297+ end
298+
273299 def on_undefined_parameter_type ( event )
274300 message = Cucumber ::Messages ::Envelope . new (
275301 undefined_parameter_type : Cucumber ::Messages ::UndefinedParameterType . new (
0 commit comments