cucumber-in-the-yard 1.3 → 1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +24 -0
- data/Manifest +54 -41
- data/README.md +45 -1
- data/Rakefile +4 -3
- data/cucumber-in-the-yard.gemspec +5 -5
- data/example/{example.step.rb → step_definitions/example.step.rb} +0 -0
- data/example/step_definitions/support/env.rb +0 -0
- data/example/step_definitions/support/env_support.rb +0 -0
- data/example/step_definitions/support/support.rb +0 -0
- data/features/definitions/city_step.rb +89 -0
- data/features/definitions/test.setup.and.teardown.rb +27 -0
- data/features/features.feature +44 -0
- data/lib/city.rb +20 -11
- data/lib/cucumber/city_builder.rb +60 -55
- data/lib/templates/default/feature/html/background.erb +92 -0
- data/lib/templates/default/feature/html/feature.erb +22 -0
- data/lib/templates/default/feature/html/no_steps_defined.erb +1 -0
- data/lib/templates/default/feature/html/outline.erb +19 -0
- data/lib/templates/default/feature/html/pystring.erb +3 -0
- data/lib/templates/default/feature/html/scenario.erb +43 -0
- data/lib/templates/default/feature/html/steps.erb +34 -0
- data/lib/templates/default/feature/html/table.erb +20 -0
- data/lib/templates/default/feature/setup.rb +28 -0
- data/lib/{yard/templates → templates}/default/fulldoc/html/css/common.css +0 -0
- data/lib/{yard/templates → templates}/default/fulldoc/html/full_list.erb +0 -0
- data/lib/templates/default/fulldoc/html/full_list_features.erb +7 -0
- data/lib/templates/default/fulldoc/html/full_list_requirements.erb +1 -0
- data/lib/templates/default/fulldoc/html/full_list_scenarios.erb +8 -0
- data/lib/{yard/templates → templates}/default/fulldoc/html/full_list_stepdefinitions.erb +2 -2
- data/lib/{yard/templates → templates}/default/fulldoc/html/full_list_steps.erb +0 -0
- data/lib/templates/default/fulldoc/html/full_list_tags.erb +8 -0
- data/lib/{yard/templates → templates}/default/fulldoc/html/index.erb +0 -0
- data/lib/{yard/templates → templates}/default/fulldoc/html/js/cucumber.js +1 -1
- data/lib/templates/default/fulldoc/html/setup.rb +56 -0
- data/lib/{yard/templates → templates}/default/layout/html/headers.erb +0 -0
- data/lib/{yard/templates → templates}/default/layout/html/search.erb +0 -0
- data/lib/{yard/templates → templates}/default/scenario/html/scenario.erb +0 -0
- data/lib/{yard/templates → templates}/default/scenario/setup.rb +0 -0
- data/lib/templates/default/steptransformers/html/stepdefinition.erb +38 -0
- data/lib/templates/default/steptransformers/html/steptransformers.erb +7 -0
- data/lib/templates/default/steptransformers/setup.rb +17 -0
- data/lib/templates/default/tag/html/feature.erb +23 -0
- data/lib/templates/default/tag/html/scenario.erb +21 -0
- data/lib/templates/default/tag/html/tag.erb +18 -0
- data/lib/templates/default/tag/setup.rb +5 -0
- data/lib/yard/code_objects/{base.rb → cucumber/base.rb} +3 -9
- data/lib/yard/code_objects/{feature.rb → cucumber/feature.rb} +1 -1
- data/lib/yard/code_objects/cucumber/namespace_object.rb +18 -0
- data/lib/yard/code_objects/{scenario.rb → cucumber/scenario.rb} +1 -1
- data/lib/yard/code_objects/{step.rb → cucumber/step.rb} +0 -0
- data/lib/yard/code_objects/cucumber/tag.rb +27 -0
- data/lib/yard/{extensions.rb → code_objects/namespace_object.rb} +11 -2
- data/lib/yard/code_objects/step_definition.rb +38 -0
- data/lib/yard/code_objects/step_transform.rb +14 -0
- data/lib/yard/handlers/{base.rb → cucumber/base.rb} +0 -0
- data/lib/yard/handlers/{feature_handler.rb → cucumber/feature_handler.rb} +3 -2
- data/lib/yard/handlers/step_definition_handler.rb +57 -0
- data/lib/yard/handlers/step_transform_handler.rb +21 -0
- data/lib/yard/parser/{feature.rb → cucumber/feature.rb} +0 -0
- data/lib/yard/parser/source_parser.rb +54 -0
- data/lib/yard/rake/city_task.rb +1 -1
- data/lib/yard/templates/helpers/base_helper.rb +20 -0
- metadata +105 -77
- data/lib/yard/code_objects/tags.rb +0 -55
- data/lib/yard/rb_extensions.rb +0 -156
- data/lib/yard/templates/default/feature/html/feature.erb +0 -245
- data/lib/yard/templates/default/feature/setup.rb +0 -5
- data/lib/yard/templates/default/fulldoc/html/full_list_features.erb +0 -10
- data/lib/yard/templates/default/fulldoc/html/full_list_scenarios.erb +0 -10
- data/lib/yard/templates/default/fulldoc/html/full_list_tagusages.erb +0 -10
- data/lib/yard/templates/default/fulldoc/html/setup.rb +0 -73
- data/lib/yard/templates/default/module/html/step_transforms.erb +0 -23
- data/lib/yard/templates/default/module/setup.rb +0 -5
- data/lib/yard/templates/default/steptransformers/html/stepdefinition.erb +0 -50
- data/lib/yard/templates/default/steptransformers/setup.rb +0 -5
- data/lib/yard/templates/default/tagusage/html/tagusage.erb +0 -65
- data/lib/yard/templates/default/tagusage/setup.rb +0 -5
- data/spec/city/feature_parser_spec_examples.rb +0 -153
- data/spec/city/gherkin_loader_spec.rb +0 -39
- data/spec/city/test.feature +0 -36
- data/spec/city/yard_handlers_cucumber_spec.rb +0 -24
- data/spec/city/yard_namespace_object_spec.rb +0 -8
- data/spec/city/yard_parser_cucumber_spec.rb +0 -215
- data/spec/city/yard_rb_extensions_spec.rb +0 -128
- data/spec/spec_helper.rb +0 -5
@@ -5,6 +5,8 @@ module Cucumber
|
|
5
5
|
include Gherkin::Rubify
|
6
6
|
|
7
7
|
def initialize(file)
|
8
|
+
@namespace = YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE
|
9
|
+
find_or_create_namespace(file)
|
8
10
|
@file = file
|
9
11
|
end
|
10
12
|
|
@@ -12,9 +14,25 @@ module Cucumber
|
|
12
14
|
@feature || @multiline_arg
|
13
15
|
end
|
14
16
|
|
17
|
+
def find_or_create_namespace(file)
|
18
|
+
file.split('/')[0..-2].each do |directory|
|
19
|
+
@namespace = @namespace.children.find {|child| child.name == directory } || YARD::CodeObjects::Cucumber::NamespaceObject.new(@namespace,directory)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def find_or_create_tag(tag_name,parent)
|
24
|
+
#log.debug "Processing tag #{tag_name}"
|
25
|
+
tag_code_object = YARD::Registry.all(:tag).find {|tag| tag.value == tag_name } ||
|
26
|
+
YARD::CodeObjects::Cucumber::Tag.new(YARD::CodeObjects::Cucumber::CUCUMBER_TAG_NAMESPACE,tag_name.gsub('@','')) {|t| t.owners = [] ; t.value = tag_name }
|
27
|
+
|
28
|
+
parent.tags << tag_code_object
|
29
|
+
tag_code_object.add_file(@file,parent.line)
|
30
|
+
tag_code_object.owners << parent
|
31
|
+
end
|
32
|
+
|
15
33
|
def feature(feature)
|
16
34
|
#log.debug "FEATURE: #{feature.name} #{feature.line} #{feature.keyword} #{feature.description}"
|
17
|
-
@feature = YARD::CodeObjects::Cucumber::Feature.new(
|
35
|
+
@feature = YARD::CodeObjects::Cucumber::Feature.new(@namespace,File.basename(@file.gsub('.feature','').gsub('.','_'))) do |f|
|
18
36
|
f.comments = feature.comments.map{|comment| comment.value}.join("\n")
|
19
37
|
f.description = feature.description
|
20
38
|
f.add_file(@file,feature.line)
|
@@ -22,27 +40,20 @@ module Cucumber
|
|
22
40
|
f.value = feature.name
|
23
41
|
f.tags = []
|
24
42
|
|
25
|
-
feature.tags.
|
26
|
-
|
27
|
-
t.value = tag
|
28
|
-
t.add_file(@file,feature.line)
|
29
|
-
t.feature = f
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
43
|
+
feature.tags.each {|feature_tag| find_or_create_tag(feature_tag.name,f) }
|
44
|
+
end
|
34
45
|
end
|
35
46
|
|
36
47
|
def background(background)
|
37
48
|
#log.debug "BACKGROUND #{background.keyword} #{background.name} #{background.line} #{background.description}"
|
38
|
-
@background = YARD::CodeObjects::Cucumber::Scenario.new(
|
49
|
+
@background = YARD::CodeObjects::Cucumber::Scenario.new(@feature,"background") do |b|
|
39
50
|
b.comments = background.comments.map{|comment| comment.value}.join("\n")
|
40
51
|
b.description = background.description
|
41
52
|
b.keyword = background.keyword
|
42
53
|
b.value = background.name
|
43
54
|
b.add_file(@file,background.line)
|
44
55
|
end
|
45
|
-
|
56
|
+
|
46
57
|
@feature.background = @background
|
47
58
|
@background.feature = @feature
|
48
59
|
@step_container = @background
|
@@ -50,22 +61,16 @@ module Cucumber
|
|
50
61
|
|
51
62
|
def scenario(statement)
|
52
63
|
#log.debug "SCENARIO"
|
53
|
-
scenario = YARD::CodeObjects::Cucumber::Scenario.new(
|
64
|
+
scenario = YARD::CodeObjects::Cucumber::Scenario.new(@feature,"scenario_#{@feature.scenarios.length + 1}") do |s|
|
54
65
|
s.comments = statement.comments.map{|comment| comment.value}.join("\n")
|
55
66
|
s.description = statement.description
|
56
67
|
s.add_file(@file,statement.line)
|
57
68
|
s.keyword = statement.keyword
|
58
69
|
s.value = statement.name
|
59
|
-
|
60
|
-
statement.tags.
|
61
|
-
s.tags << YARD::CodeObjects::Cucumber::Tag.new(:root,"#{s.name}_tag_#{index}") do |t|
|
62
|
-
t.value = tag
|
63
|
-
t.add_file(@file,@feature.line)
|
64
|
-
t.scenario = s
|
65
|
-
end
|
66
|
-
end
|
70
|
+
|
71
|
+
statement.tags.each {|scenario_tag| find_or_create_tag(scenario_tag.name,s) }
|
67
72
|
end
|
68
|
-
|
73
|
+
|
69
74
|
scenario.feature = @feature
|
70
75
|
@feature.scenarios << scenario
|
71
76
|
@step_container = scenario
|
@@ -83,47 +88,47 @@ module Cucumber
|
|
83
88
|
examples.line,
|
84
89
|
examples.comments.map{|comment| comment.value}.join("\n"),
|
85
90
|
matrix(examples.rows) ]
|
86
|
-
end
|
87
|
-
|
88
|
-
def step(step)
|
89
|
-
#log.debug "STEP #{step.multiline_arg}"
|
90
|
-
@table_owner = YARD::CodeObjects::Cucumber::Step.new(:root,"#{@feature.name}_#{step.line}") do |s|
|
91
|
-
s.keyword = step.keyword
|
92
|
-
s.value = step.name
|
93
|
-
s.add_file(@file,step.line)
|
94
91
|
end
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
92
|
+
|
93
|
+
def step(step)
|
94
|
+
#log.debug "STEP #{step.multiline_arg}"
|
95
|
+
@table_owner = YARD::CodeObjects::Cucumber::Step.new(@step_container,"#{step.line}") do |s|
|
96
|
+
s.keyword = step.keyword
|
97
|
+
s.value = step.name
|
98
|
+
s.add_file(@file,step.line)
|
99
|
+
end
|
100
|
+
|
101
|
+
multiline_arg = rubify(step.multiline_arg)
|
102
|
+
case(multiline_arg)
|
103
|
+
when Gherkin::Formatter::Model::PyString
|
104
|
+
@table_owner.text = multiline_arg.value
|
105
|
+
when Array
|
106
|
+
@table_owner.table = matrix(multiline_arg)
|
107
|
+
end
|
108
|
+
|
109
|
+
@table_owner.scenario = @step_container
|
110
|
+
@step_container.steps << @table_owner
|
102
111
|
end
|
103
|
-
|
104
|
-
@table_owner.scenario = @step_container
|
105
|
-
@step_container.steps << @table_owner
|
106
|
-
end
|
107
112
|
|
108
|
-
|
109
|
-
|
113
|
+
def eof
|
114
|
+
end
|
110
115
|
|
111
|
-
|
112
|
-
|
113
|
-
|
116
|
+
def syntax_error(state, event, legal_events, line)
|
117
|
+
# raise "SYNTAX ERROR"
|
118
|
+
end
|
114
119
|
|
115
|
-
|
120
|
+
private
|
116
121
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
+
def matrix(gherkin_table)
|
123
|
+
gherkin_table.map do |gherkin_row|
|
124
|
+
row = gherkin_row.cells
|
125
|
+
class << row
|
126
|
+
attr_accessor :line
|
127
|
+
end
|
128
|
+
row.line = gherkin_row.line
|
129
|
+
row
|
122
130
|
end
|
123
|
-
row.line = gherkin_row.line
|
124
|
-
row
|
125
131
|
end
|
126
132
|
end
|
127
133
|
end
|
128
134
|
end
|
129
|
-
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
|
2
|
+
<script type="text/javascript" charset="utf-8">
|
3
|
+
$(function() {
|
4
|
+
$('#background .toggle').click(function() {
|
5
|
+
$("#backgroundSteps").toggle('blind');
|
6
|
+
|
7
|
+
var stateIndicator = $('#background a.toggle')[0]
|
8
|
+
|
9
|
+
stateIndicator.innerHTML = (stateIndicator.innerHTML === '+' ? '-' : '+');
|
10
|
+
return false;
|
11
|
+
});
|
12
|
+
});
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<div id="background">
|
16
|
+
<div class="title">
|
17
|
+
<a class="toggle">-</a>
|
18
|
+
<span class="pre">Background</span>
|
19
|
+
</div>
|
20
|
+
<% unless @feature.background.description.empty? %>
|
21
|
+
<div class="description">
|
22
|
+
<%= h(@feature.background.description) %>
|
23
|
+
</div>
|
24
|
+
<% end %>
|
25
|
+
|
26
|
+
<!-- Background and scenario should have the same display with some minor changes -->
|
27
|
+
|
28
|
+
<div id="backgroundSteps" class="steps">
|
29
|
+
<% if @feature.background.steps %>
|
30
|
+
<% @feature.background.steps.each_with_index do |step,index| %>
|
31
|
+
<div <%= "id='backgroundStep#{index}'" %> class="step <%= (index + 1) % 2 == 0 ? 'even' : 'odd' %>">
|
32
|
+
<span class="predicate"><%= step.keyword %></span>
|
33
|
+
|
34
|
+
<% if step.definition %>
|
35
|
+
<script type="text/javascript" charset="utf-8">
|
36
|
+
$('<%= "#backgroundStep#{index}" %>').hover(
|
37
|
+
function () { $('<%= "#backgroundStep#{index} div.details" %>').toggle('slide'); },
|
38
|
+
function () { $('<%= "#backgroundStep#{index} div.details" %>').toggle('slide'); }
|
39
|
+
);
|
40
|
+
|
41
|
+
$('<%= "#backgroundStep#{index} div.details" %>').show();
|
42
|
+
|
43
|
+
</script>
|
44
|
+
<span class="defined">
|
45
|
+
<a href="steptransformers.html#<%= step.definition.name %>"><%= h(step.value) %></a>
|
46
|
+
<div class="details" style="display: none;">
|
47
|
+
(<%= h( step.definition.location ) %>)
|
48
|
+
</div>
|
49
|
+
</span>
|
50
|
+
<% else %>
|
51
|
+
<span class="undefined"><%= h(step.value) %></span>
|
52
|
+
<% end %>
|
53
|
+
|
54
|
+
</div>
|
55
|
+
|
56
|
+
<% if step.has_table? %>
|
57
|
+
<div class="multiline">
|
58
|
+
<table style="">
|
59
|
+
|
60
|
+
<thead>
|
61
|
+
<tr>
|
62
|
+
<% step.table.first.each_with_index do |column,column_index| %>
|
63
|
+
<th class="<%= (column_index + 1) % 2 == 0 ? 'even' : 'odd' %>"><%= h(column.strip) %></th>
|
64
|
+
<% end %>
|
65
|
+
</tr>
|
66
|
+
</thead>
|
67
|
+
|
68
|
+
<% step.table[1..-1].each_with_index do |row,row_index| %>
|
69
|
+
<tr class="<%= (row_index + 1) % 2 == 0 ? 'even' : 'odd' %>">
|
70
|
+
<% row.each_with_index do |column,column_index| %>
|
71
|
+
<td><%= h(column.strip) %></td>
|
72
|
+
<% end %>
|
73
|
+
</tr>
|
74
|
+
<% end %>
|
75
|
+
</table>
|
76
|
+
</div>
|
77
|
+
<% end %>
|
78
|
+
|
79
|
+
<% if step.has_text? %>
|
80
|
+
<div class="text">
|
81
|
+
<%= h(step.text) %>
|
82
|
+
</div>
|
83
|
+
<% end %>
|
84
|
+
|
85
|
+
|
86
|
+
<% end %>
|
87
|
+
<% else %>
|
88
|
+
<span>No Steps Defined</span>
|
89
|
+
<% end %>
|
90
|
+
</div>
|
91
|
+
|
92
|
+
</div>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<div class="feature">
|
2
|
+
<div class="title">
|
3
|
+
<span class="pre"><%= @feature.keyword %>:</span>
|
4
|
+
<span class="name"><%= @feature.value %></span>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<div class="meta">
|
8
|
+
<div class="file"><%= h(@feature.file) %></div>
|
9
|
+
<div class="tags">
|
10
|
+
<% @feature.tags.each do |tag| %>
|
11
|
+
<a href="<%= url_for tag %>"><%= tag.value %></a>
|
12
|
+
<% end %>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<div class="description">
|
17
|
+
<%= @feature.description %>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<%= yieldall %>
|
21
|
+
</div>
|
22
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
<span>No Steps Defined</span>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<div class="outline">
|
2
|
+
<div class="keyword"> <%= h @scenario.example_keyword %> </div>
|
3
|
+
<table>
|
4
|
+
<thead>
|
5
|
+
<tr>
|
6
|
+
<% @scenario.example_headers.each_with_index do |header,header_index| %>
|
7
|
+
<th><%= h(header) %></th>
|
8
|
+
<% end %>
|
9
|
+
</tr>
|
10
|
+
</thead>
|
11
|
+
<% @scenario.example_data.each_with_index do |row,row_index| %>
|
12
|
+
<tr class="<%= (row_index + 1) % 2 == 0 ? 'even' : 'odd' %>" >
|
13
|
+
<% row.each_with_index do |column,column_index| %>
|
14
|
+
<td><%= h(column.to_s.strip) %></td>
|
15
|
+
<% end %>
|
16
|
+
</tr>
|
17
|
+
<% end %>
|
18
|
+
</table>
|
19
|
+
</div>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<script type="text/javascript" charset="utf-8">
|
2
|
+
$(function() {
|
3
|
+
$('#<%= @id %> .toggle').click(function() {
|
4
|
+
$("#<%= @id %>Steps").toggle('blind');
|
5
|
+
|
6
|
+
var stateIndicator = $('#<%= @id %> a.toggle')[0]
|
7
|
+
|
8
|
+
stateIndicator.innerHTML = (stateIndicator.innerHTML === '+' ? '-' : '+');
|
9
|
+
return false;
|
10
|
+
});
|
11
|
+
});
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<div id="<%= @id %>" class="scenario">
|
15
|
+
<div class="title">
|
16
|
+
<a class="toggle">-</a>
|
17
|
+
<span class="pre"><%= @scenario.keyword %>:</span>
|
18
|
+
<span class="name"><%= h @scenario.value %></span>
|
19
|
+
</div>
|
20
|
+
<div class="meta">
|
21
|
+
<div class="file">Line: <%= @scenario.line_number %></div>
|
22
|
+
<% unless @scenario.tags.empty? %>
|
23
|
+
<div class="tags">
|
24
|
+
<% @scenario.tags.each do |tag| %>
|
25
|
+
<a href="<%= url_for tag %>"><%= tag.value %></a>
|
26
|
+
<% end %>
|
27
|
+
</div>
|
28
|
+
<% end%>
|
29
|
+
</div>
|
30
|
+
<% unless @scenario.description.empty? %>
|
31
|
+
<div class="description">
|
32
|
+
<%= h @scenario.description %>
|
33
|
+
</div>
|
34
|
+
<% end %>
|
35
|
+
|
36
|
+
<div id="<%= @id %>Steps" class="steps">
|
37
|
+
<%= @scenario.steps ? erb(:steps) : erb(:no_steps_defined) %>
|
38
|
+
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<%= erb(:outline) if @scenario.outline? %>
|
42
|
+
|
43
|
+
</div>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<% @scenario.steps.each_with_index do |step,index| %>
|
2
|
+
<% @step = step %>
|
3
|
+
|
4
|
+
|
5
|
+
<div <%= "id='#{@id}Step#{index}'" %> class="step <%= (index + 1) % 2 == 0 ? 'even' : 'odd' %>">
|
6
|
+
<span class="predicate"><%= step.keyword %></span>
|
7
|
+
|
8
|
+
<% if step.definition %>
|
9
|
+
<script type="text/javascript" charset="utf-8">
|
10
|
+
$('<%= "#{@id}Step#{index}" %>').hover(
|
11
|
+
function () { $('<%= "#{@id}Step#{index} div.details" %>').toggle('slide'); },
|
12
|
+
function () { $('<%= "#{@id}Step#{index} div.details" %>').toggle('slide'); }
|
13
|
+
);
|
14
|
+
|
15
|
+
$('<%= "#{@id}Step#{index} div.details" %>').show();
|
16
|
+
|
17
|
+
</script>
|
18
|
+
<span class="defined">
|
19
|
+
<a href="<%= url_for step.definition %>"><%= h(step.value) %></a>
|
20
|
+
<div class="details" style="display: none;">
|
21
|
+
(<%= h step.definition.location %>)
|
22
|
+
</div>
|
23
|
+
</span>
|
24
|
+
<% else %>
|
25
|
+
<span class="undefined"><%= h step.value %></span>
|
26
|
+
<% end %>
|
27
|
+
|
28
|
+
</div>
|
29
|
+
|
30
|
+
<%= erb(:table) if step.has_table? %>
|
31
|
+
<%= erb(:pystring) if step.has_text? %>
|
32
|
+
|
33
|
+
|
34
|
+
<% end %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<div class="multiline">
|
2
|
+
<table style="">
|
3
|
+
|
4
|
+
<thead>
|
5
|
+
<tr>
|
6
|
+
<% @step.table.first.each_with_index do |column,column_index| %>
|
7
|
+
<th class="<%= (column_index + 1) % 2 == 0 ? 'even' : 'odd' %>"><%= h(column.strip) %></th>
|
8
|
+
<% end %>
|
9
|
+
</tr>
|
10
|
+
</thead>
|
11
|
+
|
12
|
+
<% @step.table[1..-1].each_with_index do |row,row_index| %>
|
13
|
+
<tr class="<%= (row_index + 1) % 2 == 0 ? 'even' : 'odd' %>">
|
14
|
+
<% row.each_with_index do |column,column_index| %>
|
15
|
+
<td><%= h(column.strip) %></td>
|
16
|
+
<% end %>
|
17
|
+
</tr>
|
18
|
+
<% end %>
|
19
|
+
</table>
|
20
|
+
</div>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
def init
|
2
|
+
super
|
3
|
+
@feature = object
|
4
|
+
|
5
|
+
sections.push :feature
|
6
|
+
|
7
|
+
sections.push :background if object.background
|
8
|
+
sections.push :scenarios if object.scenarios
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
def background
|
13
|
+
@scenario = @feature.background
|
14
|
+
@id = "background"
|
15
|
+
erb(:scenario)
|
16
|
+
end
|
17
|
+
|
18
|
+
def scenarios
|
19
|
+
scenarios = ""
|
20
|
+
|
21
|
+
@feature.scenarios.each_with_index do |scenario,index|
|
22
|
+
@scenario = scenario
|
23
|
+
@id = "scenario#{index}"
|
24
|
+
scenarios += erb(:scenario)
|
25
|
+
end
|
26
|
+
|
27
|
+
scenarios
|
28
|
+
end
|