Class: Cucumber::Messages::TestRunHookFinished

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

Overview

Represents the TestRunHookFinished 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(test_run_hook_started_id: '', result: TestStepResult.new, timestamp: Timestamp.new) ⇒ TestRunHookFinished

Returns a new instance of TestRunHookFinished.



20
21
22
23
24
25
26
27
28
29
# File 'lib/cucumber/messages/test_run_hook_finished.rb', line 20

def initialize(
  test_run_hook_started_id: '',
  result: TestStepResult.new,
  timestamp: Timestamp.new
)
  @test_run_hook_started_id = test_run_hook_started_id
  @result = result
  @timestamp = timestamp
  super()
end

Instance Attribute Details

#resultObject (readonly)

Returns the value of attribute result.



16
17
18
# File 'lib/cucumber/messages/test_run_hook_finished.rb', line 16

def result
  @result
end

#test_run_hook_started_idObject (readonly)

Identifier for the hook execution that has finished



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

def test_run_hook_started_id
  @test_run_hook_started_id
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



18
19
20
# File 'lib/cucumber/messages/test_run_hook_finished.rb', line 18

def timestamp
  @timestamp
end

Class Method Details

.from_h(hash) ⇒ Object

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

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


38
39
40
41
42
43
44
45
46
# File 'lib/cucumber/messages/test_run_hook_finished.rb', line 38

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

  new(
    test_run_hook_started_id: hash[:testRunHookStartedId],
    result: TestStepResult.from_h(hash[:result]),
    timestamp: Timestamp.from_h(hash[:timestamp])
  )
end