Class: Cucumber::Messages::TestRunHookStarted

Inherits:
Message
  • Object
show all
Defined in:
lib/cucumber/messages/test_run_hook_started.rb

Overview

Represents the TestRunHookStarted message in Cucumber’s message protocol.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Message

camelize, from_json, #to_h, #to_json

Constructor Details

#initialize(id: '', test_run_started_id: '', hook_id: '', timestamp: Timestamp.new) ⇒ TestRunHookStarted

Returns a new instance of TestRunHookStarted.



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cucumber/messages/test_run_hook_started.rb', line 28

def initialize(
  id: '',
  test_run_started_id: '',
  hook_id: '',
  timestamp: Timestamp.new
)
  @id = id
  @test_run_started_id = test_run_started_id
  @hook_id = hook_id
  @timestamp = timestamp
  super()
end

Instance Attribute Details

#hook_idObject (readonly)

Identifier for the hook that will be executed



24
25
26
# File 'lib/cucumber/messages/test_run_hook_started.rb', line 24

def hook_id
  @hook_id
end

#idObject (readonly)

Unique identifier for this hook execution



14
15
16
# File 'lib/cucumber/messages/test_run_hook_started.rb', line 14

def id
  @id
end

#test_run_started_idObject (readonly)

Identifier for the test run that this hook execution belongs to



19
20
21
# File 'lib/cucumber/messages/test_run_hook_started.rb', line 19

def test_run_started_id
  @test_run_started_id
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



26
27
28
# File 'lib/cucumber/messages/test_run_hook_started.rb', line 26

def timestamp
  @timestamp
end

Class Method Details

.from_h(hash) ⇒ Object

Returns a new TestRunHookStarted from the given hash. If the hash keys are camelCased, they are properly assigned to the corresponding snake_cased attributes.

Cucumber::Messages::TestRunHookStarted.from_h(some_hash) # => #<Cucumber::Messages::TestRunHookStarted:0x... ...>


48
49
50
51
52
53
54
55
56
57
# File 'lib/cucumber/messages/test_run_hook_started.rb', line 48

def self.from_h(hash)
  return nil if hash.nil?

  new(
    id: hash[:id],
    test_run_started_id: hash[:testRunStartedId],
    hook_id: hash[:hookId],
    timestamp: Timestamp.from_h(hash[:timestamp])
  )
end