yard-cucumber 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.rspec +3 -0
- data/History.txt +190 -0
- data/README.md +145 -0
- data/Rakefile +17 -0
- data/city.gemspec +66 -0
- data/example/README.md +8 -0
- data/example/child_feature/README.md +21 -0
- data/example/child_feature/child.feature +11 -0
- data/example/child_feature/grandchild_feature/grandchild.feature +12 -0
- data/example/empty.feature +2 -0
- data/example/scenario.feature +63 -0
- data/example/scenario_outline.feature +80 -0
- data/example/step_definitions/example.step.rb +109 -0
- data/example/step_definitions/first.step.rb +21 -0
- data/example/step_definitions/support/env.rb +7 -0
- data/example/step_definitions/support/env_support.rb +12 -0
- data/example/step_definitions/support/support.rb +6 -0
- data/example/tags.feature +18 -0
- data/example/transform.feature +13 -0
- data/lib/cucumber/city_builder.rb +209 -0
- data/lib/docserver/default/fulldoc/html/js/cucumber.js +85 -0
- data/lib/docserver/default/layout/html/headers.erb +13 -0
- data/lib/docserver/doc_server/full_list/html/full_list.erb +37 -0
- data/lib/docserver/doc_server/full_list/html/setup.rb +18 -0
- data/lib/templates/default/feature/html/feature.erb +39 -0
- data/lib/templates/default/feature/html/no_steps_defined.erb +1 -0
- data/lib/templates/default/feature/html/outline.erb +42 -0
- data/lib/templates/default/feature/html/pystring.erb +3 -0
- data/lib/templates/default/feature/html/scenario.erb +55 -0
- data/lib/templates/default/feature/html/setup.rb +55 -0
- data/lib/templates/default/feature/html/steps.erb +39 -0
- data/lib/templates/default/feature/html/table.erb +20 -0
- data/lib/templates/default/featuredirectory/html/alpha_table.erb +26 -0
- data/lib/templates/default/featuredirectory/html/directory.erb +32 -0
- data/lib/templates/default/featuredirectory/html/setup.rb +41 -0
- data/lib/templates/default/featuretags/html/namespace.erb +131 -0
- data/lib/templates/default/featuretags/html/setup.rb +34 -0
- data/lib/templates/default/fulldoc/html/css/common.css +214 -0
- data/lib/templates/default/fulldoc/html/full_list.erb +36 -0
- data/lib/templates/default/fulldoc/html/full_list_features.erb +28 -0
- data/lib/templates/default/fulldoc/html/full_list_stepdefinitions.erb +11 -0
- data/lib/templates/default/fulldoc/html/full_list_steps.erb +13 -0
- data/lib/templates/default/fulldoc/html/full_list_tags.erb +12 -0
- data/lib/templates/default/fulldoc/html/index.erb +24 -0
- data/lib/templates/default/fulldoc/html/js/cucumber.js +314 -0
- data/lib/templates/default/fulldoc/html/setup.rb +72 -0
- data/lib/templates/default/layout/html/headers.erb +14 -0
- data/lib/templates/default/layout/html/search.erb +7 -0
- data/lib/templates/default/requirements/html/alpha_table.erb +26 -0
- data/lib/templates/default/requirements/html/requirements.erb +50 -0
- data/lib/templates/default/requirements/html/setup.rb +51 -0
- data/lib/templates/default/steptransformers/html/header.erb +12 -0
- data/lib/templates/default/steptransformers/html/index.erb +10 -0
- data/lib/templates/default/steptransformers/html/setup.rb +94 -0
- data/lib/templates/default/steptransformers/html/transformers.erb +74 -0
- data/lib/templates/default/steptransformers/html/undefinedsteps.erb +26 -0
- data/lib/templates/default/tag/html/alpha_table.erb +32 -0
- data/lib/templates/default/tag/html/setup.rb +27 -0
- data/lib/templates/default/tag/html/tag.erb +35 -0
- data/lib/yard/code_objects/cucumber/base.rb +32 -0
- data/lib/yard/code_objects/cucumber/feature.rb +18 -0
- data/lib/yard/code_objects/cucumber/namespace_object.rb +45 -0
- data/lib/yard/code_objects/cucumber/scenario.rb +26 -0
- data/lib/yard/code_objects/cucumber/scenario_outline.rb +66 -0
- data/lib/yard/code_objects/cucumber/step.rb +35 -0
- data/lib/yard/code_objects/cucumber/tag.rb +27 -0
- data/lib/yard/code_objects/step_definition.rb +7 -0
- data/lib/yard/code_objects/step_transform.rb +7 -0
- data/lib/yard/code_objects/step_transformer.rb +51 -0
- data/lib/yard/handlers/cucumber/base.rb +22 -0
- data/lib/yard/handlers/cucumber/feature_handler.rb +93 -0
- data/lib/yard/handlers/legacy/step_definition_handler.rb +46 -0
- data/lib/yard/handlers/legacy/step_transform_handler.rb +24 -0
- data/lib/yard/handlers/step_definition_handler.rb +22 -0
- data/lib/yard/handlers/step_transform_handler.rb +23 -0
- data/lib/yard/parser/cucumber/feature.rb +46 -0
- data/lib/yard/parser/source_parser.rb +54 -0
- data/lib/yard/rake/city_task.rb +12 -0
- data/lib/yard/server/adapter.rb +29 -0
- data/lib/yard/server/commands/list_command.rb +25 -0
- data/lib/yard/server/router.rb +31 -0
- data/lib/yard/templates/helpers/base_helper.rb +26 -0
- data/lib/yard-cucumber.rb +53 -0
- metadata +173 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
|
|
2
|
+
Transform /^#{CUSTOMER}$/ do |customer|
|
|
3
|
+
"a transformed customer"
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
Transform /^an? customer$/ do |customer|
|
|
7
|
+
"a transformed customer"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
Transform /^the customer$/ do |customer|
|
|
11
|
+
"the transformed customer"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
Transform /^(#{ORDER}) customer$/ do |order|
|
|
15
|
+
"#{order} customer"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
Transform /^#{TEDDY_BEAR}$/ do |teddy|
|
|
19
|
+
"the tranformed teddy bear"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
#
|
|
23
|
+
# This is a complicated Transform with a comment
|
|
24
|
+
#
|
|
25
|
+
Transform /^((?:\d{1,2}[\/-]){2}(?:\d\d){1,2})?\s*(\w{3})?\s*(\d{1,2}:\d{2}\s*(?:AM|PM)?)$/ do |date,day,time|
|
|
26
|
+
"#{date} #{day} #{time}"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
Given /^that (#{CUSTOMER}) is a valid customer$/ do |customer|
|
|
30
|
+
pending "Customer #{customer} validation"
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
#
|
|
34
|
+
# This comment will likely blow {things up}!
|
|
35
|
+
#
|
|
36
|
+
When /^a customer logs in as username '([^']+)' with password '([^']+)'$/ do |username,password|
|
|
37
|
+
Given "that the customer is a valid customer"
|
|
38
|
+
pending "Customer logs in with #{username} and #{password}"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
Then /^I expect them to have logged in (successfully|miserably)$/ do |success|
|
|
42
|
+
pending "Validation that the customer has logged in #{success}"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
When /^the customer logs out$/ do
|
|
46
|
+
pending
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
Then /^I expect the customer to be shown the logout page$/ do
|
|
50
|
+
pending
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
And /^this (third) defined step definition$/ do |number|
|
|
54
|
+
pending
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
And /^the customer has the following details:$/ do |table|
|
|
58
|
+
pending "Table of data #{table.hashes}"
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
And /^edits their the (biography) to state:$/ do |section,text|
|
|
62
|
+
pending "text_field not present for #{section} #{bio} for this release"
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
Then /I expect (#{CUSTOMER}) to be a member of the '([^']+)' group/ do |customer,product|
|
|
66
|
+
pending "Customer #{customer} with product #{product}"
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
#
|
|
70
|
+
# Complicated step definition with optional parameters
|
|
71
|
+
#
|
|
72
|
+
Given /^(?:I create )?an? (?:(active|deactive|inactive|simulated)d?)? ?project(?:[\s,]*(?:with)? ?(?:an?|the)? (?:(?:the size? (?:at|of)? ?(\d+)|named? (?:of )?'([^']+)'|start date (?:of )?((?:(?:\d{1,2}[\/-]){2}(?:\d\d){1,2}))|end date (?:of )?((?:(?:\d{1,2}[\/-]){2}(?:\d\d){1,2}))|user range (?:of )?(\d+-\d+)|description (?:of )?'([^']+)'|nicknamed? (?:of )?'([^']+)')[,\s]*)* ?)?$/ do |state,size,name,start_date,end_date,user_range,description,nickname|
|
|
73
|
+
pending "#{state} #{size} #{name} #{start_date} #{end_date} #{user_range} #{description} #{nickname}"
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
#
|
|
78
|
+
# The highlighting replacement uses a span which had trouble when blindly using
|
|
79
|
+
# a gsub replacement.
|
|
80
|
+
#
|
|
81
|
+
Given /(a|\d+) ducks? that ha(?:s|ve) (a|\d+) bills?/ do |duck_count,bills_count|
|
|
82
|
+
pending
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
Then /I expect the (duck|bird) to (\w+)/ do |animal,verb|
|
|
86
|
+
pending
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
#
|
|
90
|
+
# This double-quoted step definition caused some problems when being rendered
|
|
91
|
+
#
|
|
92
|
+
When /^searching the log for the exact match of the message "([^"]+)"$/ do |message|
|
|
93
|
+
pending message
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
#
|
|
97
|
+
#
|
|
98
|
+
#
|
|
99
|
+
When /^the step definition has HTML escaped characters like: "([^"]+)"$/ do |characters|
|
|
100
|
+
pending characters
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
#
|
|
105
|
+
# Some details about the helper method that might be picked up in the documentation.
|
|
106
|
+
#
|
|
107
|
+
def a_helper_method
|
|
108
|
+
puts "performs some operation"
|
|
109
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Transform /^#{ORDER}$/ do |order|
|
|
2
|
+
order
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
Transform /^background$/ do |background|
|
|
6
|
+
"background"
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
#
|
|
10
|
+
# This step transform converts "scenario" to "scenario"
|
|
11
|
+
#
|
|
12
|
+
Transform /^scenario$/ do |scenario|
|
|
13
|
+
"scenario"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
#
|
|
17
|
+
# This step definition is all about steps
|
|
18
|
+
#
|
|
19
|
+
Given /^this (scenario|background|#{ORDER}) step$/ do |step|
|
|
20
|
+
pending "step #{order}"
|
|
21
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@tags
|
|
2
|
+
Feature: Tags
|
|
3
|
+
As a developer of the test suite I expect that various tags will be supported
|
|
4
|
+
|
|
5
|
+
@tag
|
|
6
|
+
Scenario: Basic Tag
|
|
7
|
+
|
|
8
|
+
@tag123456
|
|
9
|
+
Scenario: Tag With Numbers
|
|
10
|
+
|
|
11
|
+
@tag_with_underscore
|
|
12
|
+
Scenario: Tag With Underscore
|
|
13
|
+
|
|
14
|
+
@tag-with-dash
|
|
15
|
+
Scenario: Tag With Dash
|
|
16
|
+
|
|
17
|
+
@tag+with+plus
|
|
18
|
+
Scenario: Tag With Plus
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
@scenarios @bvt
|
|
2
|
+
Feature: Step Transforms
|
|
3
|
+
As a developer of the test suite I expect that step transforms are documented correctly
|
|
4
|
+
|
|
5
|
+
@first
|
|
6
|
+
Scenario: Step with step transformation
|
|
7
|
+
Given this scenario step
|
|
8
|
+
Then I expect that the step, on the step transformer page, will link to the step transform
|
|
9
|
+
|
|
10
|
+
@second
|
|
11
|
+
Scenario: Step Transform uses a constant
|
|
12
|
+
Given this first step
|
|
13
|
+
Then I expect that the step, on the step transformer page, will link to the step transform
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
|
|
2
|
+
module Cucumber
|
|
3
|
+
module Parser
|
|
4
|
+
class CityBuilder
|
|
5
|
+
include Gherkin::Rubify
|
|
6
|
+
|
|
7
|
+
def initialize(file)
|
|
8
|
+
@namespace = YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE
|
|
9
|
+
find_or_create_namespace(file)
|
|
10
|
+
@file = file
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def ast
|
|
14
|
+
@feature || @multiline_arg
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def find_or_create_namespace(file)
|
|
18
|
+
@namespace = YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE
|
|
19
|
+
|
|
20
|
+
File.dirname(file).split('/').each do |directory|
|
|
21
|
+
@namespace = @namespace.children.find {|child| child.is_a?(YARD::CodeObjects::Cucumber::FeatureDirectory) && child.name.to_s == directory } ||
|
|
22
|
+
@namespace = YARD::CodeObjects::Cucumber::FeatureDirectory.new(@namespace,directory) {|dir| dir.add_file(directory)}
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
if @namespace.description == "" && File.exists?("#{File.dirname(file)}/README.md")
|
|
26
|
+
@namespace.description = File.read("#{File.dirname(file)}/README.md")
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def find_or_create_tag(tag_name,parent)
|
|
31
|
+
#log.debug "Processing tag #{tag_name}"
|
|
32
|
+
tag_code_object = YARD::Registry.all(:tag).find {|tag| tag.value == tag_name } ||
|
|
33
|
+
YARD::CodeObjects::Cucumber::Tag.new(YARD::CodeObjects::Cucumber::CUCUMBER_TAG_NAMESPACE,tag_name.gsub('@','')) {|t| t.owners = [] ; t.value = tag_name }
|
|
34
|
+
|
|
35
|
+
tag_code_object.add_file(@file,parent.line)
|
|
36
|
+
|
|
37
|
+
parent.tags << tag_code_object unless parent.tags.find {|tag| tag == tag_code_object }
|
|
38
|
+
tag_code_object.owners << parent unless tag_code_object.owners.find {|owner| owner == parent}
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def feature(feature)
|
|
42
|
+
#log.debug "FEATURE"
|
|
43
|
+
|
|
44
|
+
@feature = YARD::CodeObjects::Cucumber::Feature.new(@namespace,File.basename(@file.gsub('.feature','').gsub('.','_'))) do |f|
|
|
45
|
+
f.comments = feature.comments.map{|comment| comment.value}.join("\n")
|
|
46
|
+
f.description = feature.description
|
|
47
|
+
f.add_file(@file,feature.line)
|
|
48
|
+
f.keyword = feature.keyword
|
|
49
|
+
f.value = feature.name
|
|
50
|
+
f.tags = []
|
|
51
|
+
|
|
52
|
+
feature.tags.each {|feature_tag| find_or_create_tag(feature_tag.name,f) }
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def background(background)
|
|
57
|
+
#log.debug "BACKGROUND"
|
|
58
|
+
|
|
59
|
+
@background = YARD::CodeObjects::Cucumber::Scenario.new(@feature,"background") do |b|
|
|
60
|
+
b.comments = background.comments.map{|comment| comment.value}.join("\n")
|
|
61
|
+
b.description = background.description
|
|
62
|
+
b.keyword = background.keyword
|
|
63
|
+
b.value = background.name
|
|
64
|
+
b.add_file(@file,background.line)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
@feature.background = @background
|
|
68
|
+
@background.feature = @feature
|
|
69
|
+
@step_container = @background
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def scenario(statement)
|
|
73
|
+
#log.debug "SCENARIO"
|
|
74
|
+
|
|
75
|
+
scenario = YARD::CodeObjects::Cucumber::Scenario.new(@feature,"scenario_#{@feature.scenarios.length + 1}") do |s|
|
|
76
|
+
s.comments = statement.comments.map{|comment| comment.value}.join("\n")
|
|
77
|
+
s.description = statement.description
|
|
78
|
+
s.add_file(@file,statement.line)
|
|
79
|
+
s.keyword = statement.keyword
|
|
80
|
+
s.value = statement.name
|
|
81
|
+
|
|
82
|
+
statement.tags.each {|scenario_tag| find_or_create_tag(scenario_tag.name,s) }
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
scenario.feature = @feature
|
|
86
|
+
@feature.scenarios << scenario
|
|
87
|
+
@step_container = scenario
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def scenario_outline(statement)
|
|
91
|
+
#log.debug "SCENARIO OUTLINE"
|
|
92
|
+
|
|
93
|
+
outline = YARD::CodeObjects::Cucumber::ScenarioOutline.new(@feature,"scenario_#{@feature.scenarios.length + 1}") do |s|
|
|
94
|
+
s.comments = statement.comments.map{|comment| comment.value}.join("\n")
|
|
95
|
+
s.description = statement.description
|
|
96
|
+
s.add_file(@file,statement.line)
|
|
97
|
+
s.keyword = statement.keyword
|
|
98
|
+
s.value = statement.name
|
|
99
|
+
|
|
100
|
+
statement.tags.each {|scenario_tag| find_or_create_tag(scenario_tag.name,s) }
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
outline.feature = @feature
|
|
104
|
+
@feature.scenarios << outline
|
|
105
|
+
@step_container = outline
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def examples(examples)
|
|
109
|
+
#log.debug "EXAMPLES"
|
|
110
|
+
|
|
111
|
+
@step_container.examples = { :keyword => examples.keyword,
|
|
112
|
+
:name => examples.name,
|
|
113
|
+
:line => examples.line,
|
|
114
|
+
:comments => examples.comments.map{|comment| comment.value}.join("\n"),
|
|
115
|
+
:rows => matrix(examples.rows) }
|
|
116
|
+
|
|
117
|
+
# For each example generate a scenario and steps
|
|
118
|
+
|
|
119
|
+
@step_container.example_data.length.times do |row_index|
|
|
120
|
+
|
|
121
|
+
scenario = YARD::CodeObjects::Cucumber::Scenario.new(@step_container,"example_#{@step_container.scenarios.length + 1}") do |s|
|
|
122
|
+
s.comments = @step_container.comments
|
|
123
|
+
s.description = @step_container.description
|
|
124
|
+
s.add_file(@file,@step_container.line_number)
|
|
125
|
+
s.keyword = @step_container.keyword
|
|
126
|
+
s.value = "#{@step_container.value} (#{@step_container.scenarios.length + 1})"
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
@step_container.steps.each do |step|
|
|
130
|
+
step_instance = YARD::CodeObjects::Cucumber::Step.new(scenario,step.line_number) do |s|
|
|
131
|
+
s.keyword = step.keyword.dup
|
|
132
|
+
s.value = step.value.dup
|
|
133
|
+
s.add_file(@file,step.line_number)
|
|
134
|
+
|
|
135
|
+
s.text = step.text.dup if step.has_text?
|
|
136
|
+
s.table = clone_table(step.table) if step.has_table?
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
@step_container.example_values_for_row(row_index).each do |key,text|
|
|
140
|
+
text ||= "" #handle empty cells in the example table
|
|
141
|
+
step_instance.value.gsub!("<#{key}>",text)
|
|
142
|
+
step_instance.text.gsub!("<#{key}>",text) if step_instance.has_text?
|
|
143
|
+
step_instance.table.each{|row| row.each{|col| col.gsub!("<#{key}>",text)}} if step_instance.has_table?
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
step_instance.scenario = scenario
|
|
147
|
+
scenario.steps << step_instance
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Scenario instances of an outline link to the feature but are not linked from the feature
|
|
151
|
+
# @feature.scenarios << scenario
|
|
152
|
+
|
|
153
|
+
scenario.feature = @feature
|
|
154
|
+
@step_container.scenarios << scenario
|
|
155
|
+
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
def step(step)
|
|
161
|
+
#log.debug "STEP"
|
|
162
|
+
|
|
163
|
+
@table_owner = YARD::CodeObjects::Cucumber::Step.new(@step_container,"#{step.line}") do |s|
|
|
164
|
+
s.keyword = step.keyword
|
|
165
|
+
s.value = step.name
|
|
166
|
+
s.add_file(@file,step.line)
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
@table_owner.comments = step.comments.map{|comment| comment.value}.join("\n")
|
|
170
|
+
|
|
171
|
+
multiline_arg = rubify(step.multiline_arg)
|
|
172
|
+
|
|
173
|
+
case(multiline_arg)
|
|
174
|
+
when Gherkin::Formatter::Model::PyString
|
|
175
|
+
@table_owner.text = multiline_arg.value
|
|
176
|
+
when Array
|
|
177
|
+
#log.info "Matrix: #{matrix(multiline_arg).collect{|row| row.collect{|cell| cell.class } }.flatten.join("\n")}"
|
|
178
|
+
@table_owner.table = matrix(multiline_arg)
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
@table_owner.scenario = @step_container
|
|
182
|
+
@step_container.steps << @table_owner
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
def eof
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
def syntax_error(state, event, legal_events, line)
|
|
189
|
+
# raise "SYNTAX ERROR"
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
private
|
|
193
|
+
def matrix(gherkin_table)
|
|
194
|
+
gherkin_table.map do |gherkin_row|
|
|
195
|
+
row = gherkin_row.cells
|
|
196
|
+
class << row
|
|
197
|
+
attr_accessor :line
|
|
198
|
+
end
|
|
199
|
+
row.line = gherkin_row.line
|
|
200
|
+
row
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
def clone_table(base)
|
|
205
|
+
base.map {|row| row.map {|cell| cell.dup }}
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
function cucumberSearchFrameLinks() {
|
|
2
|
+
$('#features_list_link').click(function() {
|
|
3
|
+
toggleSearchFrame(this, '/' + library + '/features');
|
|
4
|
+
});
|
|
5
|
+
$('#tags_list_link').click(function() {
|
|
6
|
+
toggleSearchFrame(this, '/' + library + '/tags');
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
$(cucumberSearchFrameLinks);
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
function toggleScenarioExample(id,example) {
|
|
15
|
+
|
|
16
|
+
var element = $("#" + id + "Example" + example + "Steps")[0];
|
|
17
|
+
|
|
18
|
+
$('#' + id + ' tr').each(function(index) {
|
|
19
|
+
this.style.backgroundColor = (index % 2 == 0 ? '#FFFFFF' : '#F0F6F9' );
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
if (element.style.display != 'none') {
|
|
23
|
+
element = $("#" + id + "Steps")[0];
|
|
24
|
+
} else {
|
|
25
|
+
$('#' + id + ' .outline * tr')[example].style.backgroundColor = '#FFCC80';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
$('#' + id + ' .steps').each(function(index) {
|
|
29
|
+
this.style.display = 'none';
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
element.style.display = 'block';
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function determine_tags_used_in_formula(tag_string) {
|
|
37
|
+
//$("#tag_debug")[0].innerHTML = "";
|
|
38
|
+
|
|
39
|
+
tag_string = tag_string.replace(/^(\s+)|(\s+)$/,'').replace(/\s{2,}/,' ');
|
|
40
|
+
|
|
41
|
+
var tags = tag_string.match(/@\w+/g);
|
|
42
|
+
|
|
43
|
+
var return_tags = [];
|
|
44
|
+
|
|
45
|
+
if (tags != null) {
|
|
46
|
+
tags.forEach(function(tag, index, array) {
|
|
47
|
+
//$("#tag_debug")[0].innerHTML += tag + " ";
|
|
48
|
+
if (tag_list.indexOf(tag) != -1) { return_tags.push(tag); }
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return return_tags;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
function display_example_command_line(tags) {
|
|
57
|
+
$("#command_example")[0].innerHTML = "cucumber ";
|
|
58
|
+
|
|
59
|
+
if (tags.length > 0) {
|
|
60
|
+
$("#command_example")[0].innerHTML += "--tags " + tags.join(" --tags ");
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function display_qualifying_features_and_scenarios(tags) {
|
|
65
|
+
//$("#tag_debug")[0].innerHTML = "";
|
|
66
|
+
|
|
67
|
+
if (tags.length > 0) {
|
|
68
|
+
|
|
69
|
+
$(".feature,.scenario").each(function(feature){
|
|
70
|
+
this.style.display = "none";
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
$(".feature.\\" + tags.join(".\\") + ",.scenario.\\" + tags.join(".\\")).each(function(feature) {
|
|
74
|
+
//$("#tag_debug")[0].innerHTML += feature + " " + this;
|
|
75
|
+
this.style.display = "block";
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
} else {
|
|
80
|
+
$(".feature,.scenario").each(function(feature){
|
|
81
|
+
this.style.display = "block";
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<meta name="Content-Type" content="text/html; charset=UTF-8" />
|
|
2
|
+
<title><%= @page_title %></title>
|
|
3
|
+
<link rel="stylesheet" href="/css/style.css" type="text/css" media="screen" charset="utf-8" />
|
|
4
|
+
<link rel="stylesheet" href="/css/custom.css" type="text/css" media="screen" charset="utf-8" />
|
|
5
|
+
<link rel="stylesheet" href="/css/common.css" type="text/css" media="screen" charset="utf-8" />
|
|
6
|
+
<script type="text/javascript" charset="utf-8" src="/js/jquery.js"></script>
|
|
7
|
+
<script type="text/javascript" charset="utf-8" src="/js/autocomplete.js"></script>
|
|
8
|
+
<script type="text/javascript" charset="utf-8" src="/js/app.js"></script>
|
|
9
|
+
<script type="text/javascript" charset="utf-8" src="/js/live.js"></script>
|
|
10
|
+
<script type="text/javascript" charset="utf-8" src="/js/cucumber.js"></script>
|
|
11
|
+
<script type="text/javascript" charset="utf-8">
|
|
12
|
+
library = '<%= base_path(router.list_prefix) %>';
|
|
13
|
+
</script>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<meta name="Content-Type" content="text/html; charset=<%= charset %>" />
|
|
6
|
+
<link rel="stylesheet" href="/css/full_list.css" type="text/css" media="screen" charset="utf-8" />
|
|
7
|
+
<link rel="stylesheet" href="/css/common.css" type="text/css" media="screen" charset="utf-8" />
|
|
8
|
+
<script type="text/javascript" charset="utf-8" src="/js/jquery.js"></script>
|
|
9
|
+
<script type="text/javascript" charset="utf-8" src="/js/full_list.js"></script>
|
|
10
|
+
<base id="base_target" target="_parent" />
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<script type="text/javascript" charset="utf-8">
|
|
14
|
+
if (window.top.frames.main) {
|
|
15
|
+
document.getElementById('base_target').target = 'main';
|
|
16
|
+
document.body.className = 'frames';
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
<div id="content">
|
|
20
|
+
<h1 id="full_list_header"><%= @list_title %></h1>
|
|
21
|
+
<div id="nav">
|
|
22
|
+
<a target="_self" href="/<%= base_path(router.list_prefix) %>/features">Features</a> |
|
|
23
|
+
<a target="_self" href="/<%= base_path(router.list_prefix) %>/tags">Tags</a> |
|
|
24
|
+
<a target="_self" href="/<%= base_path(router.list_prefix) %>/class">Classes</a> |
|
|
25
|
+
<a target="_self" href="/<%= base_path(router.list_prefix) %>/methods">Methods</a> |
|
|
26
|
+
<a target="_self" href="/<%= base_path(router.list_prefix) %>/files">Files</a>
|
|
27
|
+
</div>
|
|
28
|
+
<div id="search">Search: <input type="text" /></div>
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
<ul id="full_list" class="<%= @list_class || @list_type %>">
|
|
32
|
+
<%= erb "full_list_#{@list_type}" %>
|
|
33
|
+
</ul>
|
|
34
|
+
</div>
|
|
35
|
+
</body>
|
|
36
|
+
</html>
|
|
37
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
include T('default/fulldoc/html')
|
|
2
|
+
|
|
3
|
+
def init
|
|
4
|
+
# This is the css class type; here we just default to class
|
|
5
|
+
@list_class = "class"
|
|
6
|
+
case @list_type.to_sym
|
|
7
|
+
when :features; @list_title = "Features"
|
|
8
|
+
when :tags; @list_title = "Tags"
|
|
9
|
+
when :class; @list_title = "Class List"
|
|
10
|
+
when :methods; @list_title = "Method List"
|
|
11
|
+
when :files; @list_title = "File List"
|
|
12
|
+
end
|
|
13
|
+
sections :full_list
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def all_features_link
|
|
17
|
+
linkify YARD::CodeObjects::Cucumber::CUCUMBER_NAMESPACE, "All Features"
|
|
18
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script type="text/javascript" charset="utf-8">
|
|
2
|
+
$(function() {
|
|
3
|
+
$(".developer").hide();
|
|
4
|
+
$(".scenario .title").css('cursor','pointer');
|
|
5
|
+
});
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<div class="feature">
|
|
9
|
+
<div class="title">
|
|
10
|
+
<a id="view" class="control" href="#">[More Detail]</a>
|
|
11
|
+
<a id="expand" class="control" href="#">[Collapse All]</a>
|
|
12
|
+
<div style="clear: right;"></div>
|
|
13
|
+
<span class="pre"><%= @feature.keyword %>:</span>
|
|
14
|
+
<span class="name"><%= @feature.value %></span>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<% if @feature.comments.length > 0 %>
|
|
18
|
+
<div class="comments developer">
|
|
19
|
+
<%= htmlify_with_newlines @feature.comments %>
|
|
20
|
+
</div>
|
|
21
|
+
<% end %>
|
|
22
|
+
|
|
23
|
+
<div class="description">
|
|
24
|
+
<%= htmlify_with_newlines @feature.description %>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<div class="meta">
|
|
28
|
+
<div class="file developer"><%= h(@feature.file) %></div>
|
|
29
|
+
<div style="clear: right;"></div>
|
|
30
|
+
<div class="tags developer">
|
|
31
|
+
<% @feature.tags.each do |tag| %>
|
|
32
|
+
<a href="<%= url_for tag %>"><%= tag.value %></a>
|
|
33
|
+
<% end %>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
<%= yieldall %>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<div class="none">No Steps Defined</div>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<% @scenario.scenarios.each_with_index do |scenario,example_index| %>
|
|
2
|
+
<div style="display: none;" class="steps <%= "example#{example_index + 1}" %>">
|
|
3
|
+
<% @scenario_outline = @scenario ; @scenario = scenario ; @steps = scenario.steps %>
|
|
4
|
+
<%= erb(:steps) %>
|
|
5
|
+
<% @scenario = @scenario_outline %>
|
|
6
|
+
</div>
|
|
7
|
+
<% end %>
|
|
8
|
+
|
|
9
|
+
<div class="outline">
|
|
10
|
+
|
|
11
|
+
<% if @scenario.examples? %>
|
|
12
|
+
<div class="keyword"> <%= h @scenario.example_keyword %></div>
|
|
13
|
+
<table>
|
|
14
|
+
<thead>
|
|
15
|
+
<tr>
|
|
16
|
+
<% @scenario.example_headers.each_with_index do |header,header_index| %>
|
|
17
|
+
<th><%= h(header) %></th>
|
|
18
|
+
<% end %>
|
|
19
|
+
</tr>
|
|
20
|
+
</thead>
|
|
21
|
+
<% unless @scenario.example_data.empty? %>
|
|
22
|
+
<% @scenario.example_data.each_with_index do |row,row_index| %>
|
|
23
|
+
<tr class="<%= (row_index + 1) % 2 == 0 ? "even example#{row_index +1}" : "odd example#{row_index +1}" %>">
|
|
24
|
+
<% row.each_with_index do |column,column_index| %>
|
|
25
|
+
<td><%= h(column.to_s.strip) %></td>
|
|
26
|
+
<% end %>
|
|
27
|
+
</tr>
|
|
28
|
+
<% end %>
|
|
29
|
+
<% else %>
|
|
30
|
+
<!-- Scenario Outline example table is empty -->
|
|
31
|
+
<tr class="odd">
|
|
32
|
+
<td colspan="<%= @scenario.example_headers.length %>" style="text-align: center;">
|
|
33
|
+
No Examples Defined
|
|
34
|
+
</td>
|
|
35
|
+
</tr>
|
|
36
|
+
<% end %>
|
|
37
|
+
</table>
|
|
38
|
+
<% else %>
|
|
39
|
+
<div class="keyword">No Example Table Defined</div>
|
|
40
|
+
<div class="keyword suggestion developer">[!] Did you mean to create a Scenario?</div>
|
|
41
|
+
<% end %>
|
|
42
|
+
</div>
|