Module: Cucumber::Core::Events

Defined in:
lib/cucumber/core/events.rb

Defined Under Namespace

Classes: Envelope, GherkinSourceParsed, TestCaseCreated, TestCaseFinished, TestCaseStarted, TestStepCreated, TestStepFinished, TestStepStarted

Class Method Summary collapse

Class Method Details

.build_registry(*types) ⇒ Hash{Symbol => Class}

Build an event registry to be passed to the Cucumber::Core::EventBus constructor from a list of types.

Each type must respond to ‘event_id` so that it can be added to the registry hash.

Returns:

  • (Hash{Symbol => Class})


89
90
91
# File 'lib/cucumber/core/events.rb', line 89

def self.build_registry(*types)
  types.map { |type| [type.event_id, type] }.to_h
end

.registryObject

The registry contains all the events registered in the core, that will be used by the Cucumber::Core::EventBus by default.



69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/cucumber/core/events.rb', line 69

def self.registry
  build_registry(
    Envelope,
    GherkinSourceParsed,
    TestStepCreated,
    TestCaseCreated,
    TestCaseStarted,
    TestStepStarted,
    TestStepFinished,
    TestCaseFinished
  )
end