Class: Turnip::Node::Feature
Overview
Note:
Feature metadata generated by Gherkin
{
type: :Feature,
tags: [], # Array of Tag
location: { line: 10, column: 3 },
language: 'en',
keyword: 'Feature',
name: 'Feature name',
description: 'Feature description',
children: [], # Array of Background, Scenario and Scenario Outline
}
Instance Attribute Summary
Attributes inherited from Base
#raw
Instance Method Summary
collapse
Methods included from HasTags
#tag_names, #tags
Methods inherited from Base
#initialize
#line, #location
Instance Method Details
#backgrounds ⇒ Object
55
56
57
58
59
|
# File 'lib/turnip/node/feature.rb', line 55
def backgrounds
@backgrounds ||= children.select do |c|
c.is_a?(Background)
end
end
|
#children ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/turnip/node/feature.rb', line 42
def children
@children ||= @raw[:children].map do |c|
case c[:type]
when :Background
Background.new(c)
when :Scenario
Scenario.new(c)
when :ScenarioOutline
ScenarioOutline.new(c)
end
end.compact
end
|
#description ⇒ Object
38
39
40
|
# File 'lib/turnip/node/feature.rb', line 38
def description
@raw[:description]
end
|
#keyword ⇒ Object
34
35
36
|
# File 'lib/turnip/node/feature.rb', line 34
def keyword
@raw[:keyword]
end
|
#language ⇒ Object
30
31
32
|
# File 'lib/turnip/node/feature.rb', line 30
def language
@raw[:language]
end
|
72
73
74
|
# File 'lib/turnip/node/feature.rb', line 72
def metadata_hash
super.merge(:type => Turnip.type, :turnip => true)
end
|
#name ⇒ Object
26
27
28
|
# File 'lib/turnip/node/feature.rb', line 26
def name
@raw[:name]
end
|
#scenarios ⇒ Object
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/turnip/node/feature.rb', line 61
def scenarios
@scenarios ||= children.map do |c|
case c
when Scenario
c
when ScenarioOutline
c.to_scenarios
end
end.flatten.compact
end
|