Class: Cucumber::Messages::Scenario
- Defined in:
- lib/cucumber/messages/scenario.rb
Overview
Represents the Scenario message in Cucumber’s message protocol.
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#examples ⇒ Object
readonly
Returns the value of attribute examples.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#keyword ⇒ Object
readonly
Returns the value of attribute keyword.
-
#location ⇒ Object
readonly
The location of the ‘Scenario` keyword.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#steps ⇒ Object
readonly
Returns the value of attribute steps.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Class Method Summary collapse
-
.from_h(hash) ⇒ Object
Returns a new Scenario from the given hash.
Instance Method Summary collapse
-
#initialize(location: Location.new, tags: [], keyword: '', name: '', description: '', steps: [], examples: [], id: '') ⇒ Scenario
constructor
A new instance of Scenario.
Methods inherited from Message
camelize, from_json, #to_h, #to_json
Constructor Details
#initialize(location: Location.new, tags: [], keyword: '', name: '', description: '', steps: [], examples: [], id: '') ⇒ Scenario
Returns a new instance of Scenario.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/cucumber/messages/scenario.rb', line 30 def initialize( location: Location.new, tags: [], keyword: '', name: '', description: '', steps: [], examples: [], id: '' ) @location = location @tags = @keyword = keyword @name = name @description = description @steps = steps @examples = examples @id = id super() end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
22 23 24 |
# File 'lib/cucumber/messages/scenario.rb', line 22 def description @description end |
#examples ⇒ Object (readonly)
Returns the value of attribute examples.
26 27 28 |
# File 'lib/cucumber/messages/scenario.rb', line 26 def examples @examples end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
28 29 30 |
# File 'lib/cucumber/messages/scenario.rb', line 28 def id @id end |
#keyword ⇒ Object (readonly)
Returns the value of attribute keyword.
18 19 20 |
# File 'lib/cucumber/messages/scenario.rb', line 18 def keyword @keyword end |
#location ⇒ Object (readonly)
The location of the ‘Scenario` keyword
14 15 16 |
# File 'lib/cucumber/messages/scenario.rb', line 14 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
20 21 22 |
# File 'lib/cucumber/messages/scenario.rb', line 20 def name @name end |
#steps ⇒ Object (readonly)
Returns the value of attribute steps.
24 25 26 |
# File 'lib/cucumber/messages/scenario.rb', line 24 def steps @steps end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
16 17 18 |
# File 'lib/cucumber/messages/scenario.rb', line 16 def @tags end |
Class Method Details
.from_h(hash) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/cucumber/messages/scenario.rb', line 58 def self.from_h(hash) return nil if hash.nil? new( location: Location.from_h(hash[:location]), tags: hash[:tags]&.map { |item| Tag.from_h(item) }, keyword: hash[:keyword], name: hash[:name], description: hash[:description], steps: hash[:steps]&.map { |item| Step.from_h(item) }, examples: hash[:examples]&.map { |item| Examples.from_h(item) }, id: hash[:id] ) end |