class Cucumber::Messages::Step

Represents the Step message in Cucumber’s message protocol.

A step

Attributes

data_table[R]
doc_string[R]
id[R]

Unique ID to be able to reference the Step from PickleStep

keyword[R]

The actual keyword as it appeared in the source.

keyword_type[R]

The test phase signalled by the keyword: Context definition (Given), Action performance (When), Outcome assertion (Then). Other keywords signal Continuation (And and But) from a prior keyword. Please note that all translations which a dialect maps to multiple keywords (‘*` is in this category for all dialects), map to ’Unknown’.

location[R]

The location of the steps’ ‘keyword`

text[R]

Public Class Methods

from_h(hash) click to toggle source

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

Cucumber::Messages::Step.from_h(some_hash) # => #<Cucumber::Messages::Step:0x... ...>
# File lib/cucumber/messages/step.rb, line 65
def self.from_h(hash)
  return nil if hash.nil?

  new(
    location: Location.from_h(hash[:location]),
    keyword: hash[:keyword],
    keyword_type: hash[:keywordType],
    text: hash[:text],
    doc_string: DocString.from_h(hash[:docString]),
    data_table: DataTable.from_h(hash[:dataTable]),
    id: hash[:id]
  )
end
new( location: Location.new, keyword: '', keyword_type: nil, text: '', doc_string: nil, data_table: nil, id: '' ) click to toggle source
Calls superclass method
# File lib/cucumber/messages/step.rb, line 39
def initialize(
  location: Location.new,
  keyword: '',
  keyword_type: nil,
  text: '',
  doc_string: nil,
  data_table: nil,
  id: ''
)
  @location = location
  @keyword = keyword
  @keyword_type = keyword_type
  @text = text
  @doc_string = doc_string
  @data_table = data_table
  @id = id
  super()
end