Class: Cucumber::Messages::TestCaseFinished

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

Overview

Represents the TestCaseFinished 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_case_started_id: '', timestamp: Timestamp.new, will_be_retried: false) ⇒ TestCaseFinished

Returns a new instance of TestCaseFinished.



17
18
19
20
21
22
23
24
25
26
# File 'lib/cucumber/messages/test_case_finished.rb', line 17

def initialize(
  test_case_started_id: '',
  timestamp: Timestamp.new,
  will_be_retried: false
)
  @test_case_started_id = test_case_started_id
  @timestamp = timestamp
  @will_be_retried = will_be_retried
  super()
end

Instance Attribute Details

#test_case_started_idObject (readonly)

Returns the value of attribute test_case_started_id.



11
12
13
# File 'lib/cucumber/messages/test_case_finished.rb', line 11

def test_case_started_id
  @test_case_started_id
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



13
14
15
# File 'lib/cucumber/messages/test_case_finished.rb', line 13

def timestamp
  @timestamp
end

#will_be_retriedObject (readonly)

Returns the value of attribute will_be_retried.



15
16
17
# File 'lib/cucumber/messages/test_case_finished.rb', line 15

def will_be_retried
  @will_be_retried
end

Class Method Details

.from_h(hash) ⇒ Object

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

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


35
36
37
38
39
40
41
42
43
# File 'lib/cucumber/messages/test_case_finished.rb', line 35

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

  new(
    test_case_started_id: hash[:testCaseStartedId],
    timestamp: Timestamp.from_h(hash[:timestamp]),
    will_be_retried: hash[:willBeRetried]
  )
end