Class: Cucumber::Messages::Step
- Defined in:
- lib/cucumber/messages/step.rb
Overview
Represents the Step message in Cucumber’s message protocol.
A step
Instance Attribute Summary collapse
-
#data_table ⇒ Object
readonly
Returns the value of attribute data_table.
-
#doc_string ⇒ Object
readonly
Returns the value of attribute doc_string.
-
#id ⇒ Object
readonly
Unique ID to be able to reference the Step from PickleStep.
-
#keyword ⇒ Object
readonly
The actual keyword as it appeared in the source.
-
#keyword_type ⇒ Object
readonly
The test phase signalled by the keyword: Context definition (Given), Action performance (When), Outcome assertion (Then).
-
#location ⇒ Object
readonly
The location of the steps’ ‘keyword`.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Class Method Summary collapse
-
.from_h(hash) ⇒ Object
Returns a new Step from the given hash.
Instance Method Summary collapse
-
#initialize(location: Location.new, keyword: '', keyword_type: nil, text: '', doc_string: nil, data_table: nil, id: '') ⇒ Step
constructor
A new instance of Step.
Methods inherited from Message
camelize, from_json, #to_h, #to_json
Constructor Details
#initialize(location: Location.new, keyword: '', keyword_type: nil, text: '', doc_string: nil, data_table: nil, id: '') ⇒ Step
Returns a new instance of Step.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# 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 |
Instance Attribute Details
#data_table ⇒ Object (readonly)
Returns the value of attribute data_table.
32 33 34 |
# File 'lib/cucumber/messages/step.rb', line 32 def data_table @data_table end |
#doc_string ⇒ Object (readonly)
Returns the value of attribute doc_string.
30 31 32 |
# File 'lib/cucumber/messages/step.rb', line 30 def doc_string @doc_string end |
#id ⇒ Object (readonly)
Unique ID to be able to reference the Step from PickleStep
37 38 39 |
# File 'lib/cucumber/messages/step.rb', line 37 def id @id end |
#keyword ⇒ Object (readonly)
The actual keyword as it appeared in the source.
21 22 23 |
# File 'lib/cucumber/messages/step.rb', line 21 def keyword @keyword end |
#keyword_type ⇒ Object (readonly)
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’.
26 27 28 |
# File 'lib/cucumber/messages/step.rb', line 26 def keyword_type @keyword_type end |
#location ⇒ Object (readonly)
The location of the steps’ ‘keyword`
16 17 18 |
# File 'lib/cucumber/messages/step.rb', line 16 def location @location end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
28 29 30 |
# File 'lib/cucumber/messages/step.rb', line 28 def text @text end |
Class Method Details
.from_h(hash) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 |
# 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 |