cucumber-in-the-yard 1.4 → 1.5
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/History.txt +11 -0
- data/Manifest +62 -64
- data/README.md +15 -21
- data/Rakefile +1 -1
- data/cucumber-in-the-yard.gemspec +4 -4
- data/example/example.feature +1 -2
- data/lib/city.rb +1 -0
- data/lib/cucumber/city_builder.rb +95 -42
- data/lib/templates/default/feature/html/steps.erb +3 -12
- data/lib/templates/default/feature/setup.rb +14 -0
- data/lib/templates/default/fulldoc/html/css/common.css +10 -30
- data/lib/templates/default/fulldoc/html/setup.rb +1 -1
- data/lib/templates/default/steptransformers/html/steptransformers.erb +0 -6
- data/lib/templates/default/steptransformers/html/transformers.erb +48 -0
- data/lib/templates/default/steptransformers/setup.rb +23 -6
- data/lib/templates/default/tag/setup.rb +1 -0
- data/lib/yard/code_objects/cucumber/scenario.rb +3 -16
- data/lib/yard/code_objects/cucumber/scenario_outline.rb +61 -0
- data/lib/yard/code_objects/cucumber/step.rb +19 -2
- data/lib/yard/code_objects/step_transform.rb +6 -0
- data/lib/yard/handlers/cucumber/feature_handler.rb +70 -20
- data/lib/yard/handlers/step_transform_handler.rb +3 -1
- metadata +7 -8
- data/features/definitions/city_step.rb +0 -89
- data/features/definitions/test.setup.and.teardown.rb +0 -27
- data/features/features.feature +0 -44
- data/lib/templates/default/steptransformers/html/stepdefinition.erb +0 -38
data/History.txt
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
=== 1.5 / 2010-10-25
|
2
|
+
|
3
|
+
* Steps that have found their step definitions will also attempt to find their
|
4
|
+
step transforms (However step transforms are not unpacked yet like step
|
5
|
+
definitions).
|
6
|
+
* Scenario Outlines will expand, behind the scenes, and match like traditional
|
7
|
+
scenarios.
|
8
|
+
* FIX - duplication of owners that the tag reports has been removed.
|
9
|
+
* INFO level messaging while processing features and scenarios to help assist
|
10
|
+
with feedback during the long processing.
|
11
|
+
|
1
12
|
=== 1.4 / 2010-10-17
|
2
13
|
|
3
14
|
* Tagusage has been retired
|
data/Manifest
CHANGED
@@ -1,65 +1,63 @@
|
|
1
|
-
History.txt
|
2
|
-
Manifest
|
3
|
-
README.md
|
4
|
-
Rakefile
|
5
|
-
example/empty.feature
|
6
|
-
example/example.feature
|
7
|
-
example/example.third.feature
|
8
|
-
example/second_example.feature
|
9
|
-
example/step_definitions/example.step.rb
|
10
|
-
example/step_definitions/support/env.rb
|
11
|
-
example/step_definitions/support/env_support.rb
|
12
|
-
example/step_definitions/support/support.rb
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
lib/
|
17
|
-
lib/
|
18
|
-
lib/templates/default/feature/html/
|
19
|
-
lib/templates/default/feature/html/
|
20
|
-
lib/templates/default/feature/html/
|
21
|
-
lib/templates/default/feature/html/
|
22
|
-
lib/templates/default/feature/html/
|
23
|
-
lib/templates/default/feature/
|
24
|
-
lib/templates/default/
|
25
|
-
lib/templates/default/
|
26
|
-
lib/templates/default/
|
27
|
-
lib/templates/default/fulldoc/html/
|
28
|
-
lib/templates/default/fulldoc/html/
|
29
|
-
lib/templates/default/fulldoc/html/
|
30
|
-
lib/templates/default/fulldoc/html/
|
31
|
-
lib/templates/default/fulldoc/html/
|
32
|
-
lib/templates/default/fulldoc/html/
|
33
|
-
lib/templates/default/fulldoc/html/
|
34
|
-
lib/templates/default/fulldoc/html/
|
35
|
-
lib/templates/default/
|
36
|
-
lib/templates/default/
|
37
|
-
lib/templates/default/
|
38
|
-
lib/templates/default/
|
39
|
-
lib/templates/default/
|
40
|
-
lib/templates/default/
|
41
|
-
lib/templates/default/
|
42
|
-
lib/templates/default/
|
43
|
-
lib/templates/default/
|
44
|
-
lib/templates/default/
|
45
|
-
lib/templates/default/tag/
|
46
|
-
lib/
|
47
|
-
lib/
|
48
|
-
lib/
|
49
|
-
lib/yard/code_objects/cucumber/
|
50
|
-
lib/yard/code_objects/cucumber/
|
51
|
-
lib/yard/code_objects/cucumber/
|
52
|
-
lib/yard/code_objects/cucumber/
|
53
|
-
lib/yard/code_objects/
|
54
|
-
lib/yard/code_objects/
|
55
|
-
lib/yard/code_objects/
|
56
|
-
lib/yard/
|
57
|
-
lib/yard/
|
58
|
-
lib/yard/handlers/
|
59
|
-
lib/yard/handlers/
|
60
|
-
lib/yard/
|
61
|
-
lib/yard/
|
62
|
-
lib/yard/
|
63
|
-
lib/yard/parser/source_parser.rb
|
64
|
-
lib/yard/rake/city_task.rb
|
1
|
+
History.txt
|
2
|
+
Manifest
|
3
|
+
README.md
|
4
|
+
Rakefile
|
5
|
+
example/empty.feature
|
6
|
+
example/example.feature
|
7
|
+
example/example.third.feature
|
8
|
+
example/second_example.feature
|
9
|
+
example/step_definitions/example.step.rb
|
10
|
+
example/step_definitions/support/env.rb
|
11
|
+
example/step_definitions/support/env_support.rb
|
12
|
+
example/step_definitions/support/support.rb
|
13
|
+
lib/city.rb
|
14
|
+
lib/cucumber/city_builder.rb
|
15
|
+
lib/templates/default/feature/html/background.erb
|
16
|
+
lib/templates/default/feature/html/feature.erb
|
17
|
+
lib/templates/default/feature/html/no_steps_defined.erb
|
18
|
+
lib/templates/default/feature/html/outline.erb
|
19
|
+
lib/templates/default/feature/html/pystring.erb
|
20
|
+
lib/templates/default/feature/html/scenario.erb
|
21
|
+
lib/templates/default/feature/html/steps.erb
|
22
|
+
lib/templates/default/feature/html/table.erb
|
23
|
+
lib/templates/default/feature/setup.rb
|
24
|
+
lib/templates/default/fulldoc/html/css/common.css
|
25
|
+
lib/templates/default/fulldoc/html/full_list.erb
|
26
|
+
lib/templates/default/fulldoc/html/full_list_features.erb
|
27
|
+
lib/templates/default/fulldoc/html/full_list_requirements.erb
|
28
|
+
lib/templates/default/fulldoc/html/full_list_scenarios.erb
|
29
|
+
lib/templates/default/fulldoc/html/full_list_stepdefinitions.erb
|
30
|
+
lib/templates/default/fulldoc/html/full_list_steps.erb
|
31
|
+
lib/templates/default/fulldoc/html/full_list_tags.erb
|
32
|
+
lib/templates/default/fulldoc/html/index.erb
|
33
|
+
lib/templates/default/fulldoc/html/js/cucumber.js
|
34
|
+
lib/templates/default/fulldoc/html/setup.rb
|
35
|
+
lib/templates/default/layout/html/headers.erb
|
36
|
+
lib/templates/default/layout/html/search.erb
|
37
|
+
lib/templates/default/scenario/html/scenario.erb
|
38
|
+
lib/templates/default/scenario/setup.rb
|
39
|
+
lib/templates/default/steptransformers/html/steptransformers.erb
|
40
|
+
lib/templates/default/steptransformers/html/transformers.erb
|
41
|
+
lib/templates/default/steptransformers/setup.rb
|
42
|
+
lib/templates/default/tag/html/feature.erb
|
43
|
+
lib/templates/default/tag/html/scenario.erb
|
44
|
+
lib/templates/default/tag/html/tag.erb
|
45
|
+
lib/templates/default/tag/setup.rb
|
46
|
+
lib/yard/code_objects/cucumber/base.rb
|
47
|
+
lib/yard/code_objects/cucumber/feature.rb
|
48
|
+
lib/yard/code_objects/cucumber/namespace_object.rb
|
49
|
+
lib/yard/code_objects/cucumber/scenario.rb
|
50
|
+
lib/yard/code_objects/cucumber/scenario_outline.rb
|
51
|
+
lib/yard/code_objects/cucumber/step.rb
|
52
|
+
lib/yard/code_objects/cucumber/tag.rb
|
53
|
+
lib/yard/code_objects/namespace_object.rb
|
54
|
+
lib/yard/code_objects/step_definition.rb
|
55
|
+
lib/yard/code_objects/step_transform.rb
|
56
|
+
lib/yard/handlers/cucumber/base.rb
|
57
|
+
lib/yard/handlers/cucumber/feature_handler.rb
|
58
|
+
lib/yard/handlers/step_definition_handler.rb
|
59
|
+
lib/yard/handlers/step_transform_handler.rb
|
60
|
+
lib/yard/parser/cucumber/feature.rb
|
61
|
+
lib/yard/parser/source_parser.rb
|
62
|
+
lib/yard/rake/city_task.rb
|
65
63
|
lib/yard/templates/helpers/base_helper.rb
|
data/README.md
CHANGED
@@ -40,6 +40,18 @@ Step definitions are displayed in their own index page and for each step definit
|
|
40
40
|
steps for this step definition. This is useful for providing example documentation and quickly understanding
|
41
41
|
which scenarios are affected by a change to a step definition.
|
42
42
|
|
43
|
+
**5. Step Transforms are displayed as links in the step definitions**
|
44
|
+
|
45
|
+
After finding the Step to Step Definition link it looks at the match groups within the step and find which
|
46
|
+
ones match the step transforms. Step transform links can be found after following a link from the step to
|
47
|
+
the step definition.
|
48
|
+
|
49
|
+
**6. Highlight the sections of steps that match in the step definition**
|
50
|
+
|
51
|
+
Steps highlight the match groups in a different color to show which parts of the step are matched in the step
|
52
|
+
definition.
|
53
|
+
|
54
|
+
|
43
55
|
|
44
56
|
Installation
|
45
57
|
------------
|
@@ -113,18 +125,6 @@ the documentation by putting a coat of paint on it.
|
|
113
125
|
Roadmap
|
114
126
|
-------
|
115
127
|
|
116
|
-
**Version 1**
|
117
|
-
|
118
|
-
Current feature set is all that I had planned for this first release.
|
119
|
-
|
120
|
-
**1. Users are able to search by Feature, Tags, and Scenario.**
|
121
|
-
**2. Feature pages are displayed in a decently formatted HTML representation**
|
122
|
-
**3. Tag pages display all the Features and scenarios that currently employ the tag.**
|
123
|
-
**4. Steps link to Step definitions. Step definitions show all uses.**
|
124
|
-
|
125
|
-
Subsequent updates are fixes or enhancements to the fundamental structure behind the scenes. Lsegal,
|
126
|
-
has been extremely helpful in assisting me with the re-organization and refinement of this first release.
|
127
|
-
|
128
128
|
**Future Feature Ideas**
|
129
129
|
|
130
130
|
**1. Users are able to search Features, Scenarios, and Tags in a unified search box.**
|
@@ -142,16 +142,10 @@ update of the total features and scenarios affected by the changes in the filter
|
|
142
142
|
I would like to also address some layout and formatting on the page. Scenarios will also link to the scenarios
|
143
143
|
feature page, show their descriptions, and of course all their other tags.
|
144
144
|
|
145
|
-
**3.
|
146
|
-
|
147
|
-
These tricky pieces of code tend to trip me up and others on the project. I want to be able to show which steps
|
148
|
-
that have mapped to step definitions are being affected by step transforms.
|
149
|
-
|
150
|
-
**4. Highlight the sections of steps that match in the step definition**
|
151
|
-
|
152
|
-
Similar to the great output that Cucumber uses to show what is the variable part of the step definition, I would like
|
153
|
-
to have the steps displayed differently to illustrate that they are the variable in the statement.
|
145
|
+
**3. Performance enhancements**
|
154
146
|
|
147
|
+
At the current rate the documentation generation is dreadfully slow for the project. After implementing a few
|
148
|
+
more of these features I will look at addressing the performance to see where this can be optimized.
|
155
149
|
|
156
150
|
LICENSE
|
157
151
|
-------
|
data/Rakefile
CHANGED
@@ -8,7 +8,7 @@ task :gendoc do
|
|
8
8
|
`yardoc -e lib/city.rb -p lib/templates 'example/**/*' --debug`
|
9
9
|
end
|
10
10
|
|
11
|
-
Echoe.new('cucumber-in-the-yard', '1.
|
11
|
+
Echoe.new('cucumber-in-the-yard', '1.5') do |g|
|
12
12
|
g.author = "Franklin Webber"
|
13
13
|
g.email = "franklin.webber@gmail.com"
|
14
14
|
g.url = "http://github.com/burtlo/Cucumber-In-The-Yard"
|
@@ -2,19 +2,19 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{cucumber-in-the-yard}
|
5
|
-
s.version = "1.
|
5
|
+
s.version = "1.5"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Franklin Webber"]
|
9
|
-
s.date = %q{2010-10-
|
9
|
+
s.date = %q{2010-10-25}
|
10
10
|
s.description = %q{
|
11
11
|
Cucumber-In-The-Yard is a YARD extension that processes Cucumber Features, Scenarios, Steps,
|
12
12
|
Step Definitions, Transforms, and Tags and provides a documentation interface that allows you
|
13
13
|
easily view and investigate the test suite. This tools hopes to bridge the gap of being able
|
14
14
|
to provide your feature descriptions to your Product Owners and Stakeholders. }
|
15
15
|
s.email = %q{franklin.webber@gmail.com}
|
16
|
-
s.extra_rdoc_files = ["README.md", "lib/city.rb", "lib/cucumber/city_builder.rb", "lib/templates/default/feature/html/background.erb", "lib/templates/default/feature/html/feature.erb", "lib/templates/default/feature/html/no_steps_defined.erb", "lib/templates/default/feature/html/outline.erb", "lib/templates/default/feature/html/pystring.erb", "lib/templates/default/feature/html/scenario.erb", "lib/templates/default/feature/html/steps.erb", "lib/templates/default/feature/html/table.erb", "lib/templates/default/feature/setup.rb", "lib/templates/default/fulldoc/html/css/common.css", "lib/templates/default/fulldoc/html/full_list.erb", "lib/templates/default/fulldoc/html/full_list_features.erb", "lib/templates/default/fulldoc/html/full_list_requirements.erb", "lib/templates/default/fulldoc/html/full_list_scenarios.erb", "lib/templates/default/fulldoc/html/full_list_stepdefinitions.erb", "lib/templates/default/fulldoc/html/full_list_steps.erb", "lib/templates/default/fulldoc/html/full_list_tags.erb", "lib/templates/default/fulldoc/html/index.erb", "lib/templates/default/fulldoc/html/js/cucumber.js", "lib/templates/default/fulldoc/html/setup.rb", "lib/templates/default/layout/html/headers.erb", "lib/templates/default/layout/html/search.erb", "lib/templates/default/scenario/html/scenario.erb", "lib/templates/default/scenario/setup.rb", "lib/templates/default/steptransformers/html/
|
17
|
-
s.files = ["History.txt", "Manifest", "README.md", "Rakefile", "example/empty.feature", "example/example.feature", "example/example.third.feature", "example/second_example.feature", "example/step_definitions/example.step.rb", "example/step_definitions/support/env.rb", "example/step_definitions/support/env_support.rb", "example/step_definitions/support/support.rb", "
|
16
|
+
s.extra_rdoc_files = ["README.md", "lib/city.rb", "lib/cucumber/city_builder.rb", "lib/templates/default/feature/html/background.erb", "lib/templates/default/feature/html/feature.erb", "lib/templates/default/feature/html/no_steps_defined.erb", "lib/templates/default/feature/html/outline.erb", "lib/templates/default/feature/html/pystring.erb", "lib/templates/default/feature/html/scenario.erb", "lib/templates/default/feature/html/steps.erb", "lib/templates/default/feature/html/table.erb", "lib/templates/default/feature/setup.rb", "lib/templates/default/fulldoc/html/css/common.css", "lib/templates/default/fulldoc/html/full_list.erb", "lib/templates/default/fulldoc/html/full_list_features.erb", "lib/templates/default/fulldoc/html/full_list_requirements.erb", "lib/templates/default/fulldoc/html/full_list_scenarios.erb", "lib/templates/default/fulldoc/html/full_list_stepdefinitions.erb", "lib/templates/default/fulldoc/html/full_list_steps.erb", "lib/templates/default/fulldoc/html/full_list_tags.erb", "lib/templates/default/fulldoc/html/index.erb", "lib/templates/default/fulldoc/html/js/cucumber.js", "lib/templates/default/fulldoc/html/setup.rb", "lib/templates/default/layout/html/headers.erb", "lib/templates/default/layout/html/search.erb", "lib/templates/default/scenario/html/scenario.erb", "lib/templates/default/scenario/setup.rb", "lib/templates/default/steptransformers/html/steptransformers.erb", "lib/templates/default/steptransformers/html/transformers.erb", "lib/templates/default/steptransformers/setup.rb", "lib/templates/default/tag/html/feature.erb", "lib/templates/default/tag/html/scenario.erb", "lib/templates/default/tag/html/tag.erb", "lib/templates/default/tag/setup.rb", "lib/yard/code_objects/cucumber/base.rb", "lib/yard/code_objects/cucumber/feature.rb", "lib/yard/code_objects/cucumber/namespace_object.rb", "lib/yard/code_objects/cucumber/scenario.rb", "lib/yard/code_objects/cucumber/scenario_outline.rb", "lib/yard/code_objects/cucumber/step.rb", "lib/yard/code_objects/cucumber/tag.rb", "lib/yard/code_objects/namespace_object.rb", "lib/yard/code_objects/step_definition.rb", "lib/yard/code_objects/step_transform.rb", "lib/yard/handlers/cucumber/base.rb", "lib/yard/handlers/cucumber/feature_handler.rb", "lib/yard/handlers/step_definition_handler.rb", "lib/yard/handlers/step_transform_handler.rb", "lib/yard/parser/cucumber/feature.rb", "lib/yard/parser/source_parser.rb", "lib/yard/rake/city_task.rb", "lib/yard/templates/helpers/base_helper.rb"]
|
17
|
+
s.files = ["History.txt", "Manifest", "README.md", "Rakefile", "example/empty.feature", "example/example.feature", "example/example.third.feature", "example/second_example.feature", "example/step_definitions/example.step.rb", "example/step_definitions/support/env.rb", "example/step_definitions/support/env_support.rb", "example/step_definitions/support/support.rb", "lib/city.rb", "lib/cucumber/city_builder.rb", "lib/templates/default/feature/html/background.erb", "lib/templates/default/feature/html/feature.erb", "lib/templates/default/feature/html/no_steps_defined.erb", "lib/templates/default/feature/html/outline.erb", "lib/templates/default/feature/html/pystring.erb", "lib/templates/default/feature/html/scenario.erb", "lib/templates/default/feature/html/steps.erb", "lib/templates/default/feature/html/table.erb", "lib/templates/default/feature/setup.rb", "lib/templates/default/fulldoc/html/css/common.css", "lib/templates/default/fulldoc/html/full_list.erb", "lib/templates/default/fulldoc/html/full_list_features.erb", "lib/templates/default/fulldoc/html/full_list_requirements.erb", "lib/templates/default/fulldoc/html/full_list_scenarios.erb", "lib/templates/default/fulldoc/html/full_list_stepdefinitions.erb", "lib/templates/default/fulldoc/html/full_list_steps.erb", "lib/templates/default/fulldoc/html/full_list_tags.erb", "lib/templates/default/fulldoc/html/index.erb", "lib/templates/default/fulldoc/html/js/cucumber.js", "lib/templates/default/fulldoc/html/setup.rb", "lib/templates/default/layout/html/headers.erb", "lib/templates/default/layout/html/search.erb", "lib/templates/default/scenario/html/scenario.erb", "lib/templates/default/scenario/setup.rb", "lib/templates/default/steptransformers/html/steptransformers.erb", "lib/templates/default/steptransformers/html/transformers.erb", "lib/templates/default/steptransformers/setup.rb", "lib/templates/default/tag/html/feature.erb", "lib/templates/default/tag/html/scenario.erb", "lib/templates/default/tag/html/tag.erb", "lib/templates/default/tag/setup.rb", "lib/yard/code_objects/cucumber/base.rb", "lib/yard/code_objects/cucumber/feature.rb", "lib/yard/code_objects/cucumber/namespace_object.rb", "lib/yard/code_objects/cucumber/scenario.rb", "lib/yard/code_objects/cucumber/scenario_outline.rb", "lib/yard/code_objects/cucumber/step.rb", "lib/yard/code_objects/cucumber/tag.rb", "lib/yard/code_objects/namespace_object.rb", "lib/yard/code_objects/step_definition.rb", "lib/yard/code_objects/step_transform.rb", "lib/yard/handlers/cucumber/base.rb", "lib/yard/handlers/cucumber/feature_handler.rb", "lib/yard/handlers/step_definition_handler.rb", "lib/yard/handlers/step_transform_handler.rb", "lib/yard/parser/cucumber/feature.rb", "lib/yard/parser/source_parser.rb", "lib/yard/rake/city_task.rb", "lib/yard/templates/helpers/base_helper.rb", "cucumber-in-the-yard.gemspec"]
|
18
18
|
s.homepage = %q{http://github.com/burtlo/Cucumber-In-The-Yard}
|
19
19
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Cucumber-in-the-yard", "--main", "README.md"]
|
20
20
|
s.require_paths = ["lib"]
|
data/example/example.feature
CHANGED
@@ -9,5 +9,4 @@ Feature: Customer Login Feature
|
|
9
9
|
Scenario: Customer with valid login is able to login
|
10
10
|
Given that a customer is a valid customer
|
11
11
|
When a customer logs in as username 'frank' with password 'default'
|
12
|
-
Then I expect them to have logged in successfully
|
13
|
-
|
12
|
+
Then I expect them to have logged in successfully
|
data/lib/city.rb
CHANGED
@@ -8,6 +8,7 @@ require 'yard'
|
|
8
8
|
require File.dirname(__FILE__) + "/yard/code_objects/cucumber/base.rb"
|
9
9
|
require File.dirname(__FILE__) + "/yard/code_objects/cucumber/namespace_object.rb"
|
10
10
|
require File.dirname(__FILE__) + "/yard/code_objects/cucumber/feature.rb"
|
11
|
+
require File.dirname(__FILE__) + "/yard/code_objects/cucumber/scenario_outline.rb"
|
11
12
|
require File.dirname(__FILE__) + "/yard/code_objects/cucumber/scenario.rb"
|
12
13
|
require File.dirname(__FILE__) + "/yard/code_objects/cucumber/step.rb"
|
13
14
|
require File.dirname(__FILE__) + "/yard/code_objects/cucumber/tag.rb"
|
@@ -21,17 +21,18 @@ module Cucumber
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def find_or_create_tag(tag_name,parent)
|
24
|
-
|
24
|
+
log.debug "Processing tag #{tag_name}"
|
25
25
|
tag_code_object = YARD::Registry.all(:tag).find {|tag| tag.value == tag_name } ||
|
26
|
-
|
26
|
+
YARD::CodeObjects::Cucumber::Tag.new(YARD::CodeObjects::Cucumber::CUCUMBER_TAG_NAMESPACE,tag_name.gsub('@','')) {|t| t.owners = [] ; t.value = tag_name }
|
27
27
|
|
28
|
-
parent.tags << tag_code_object
|
29
28
|
tag_code_object.add_file(@file,parent.line)
|
30
|
-
|
29
|
+
|
30
|
+
parent.tags << tag_code_object unless parent.tags.find {|tag| tag_code_object }
|
31
|
+
tag_code_object.owners << parent unless tag_code_object.owners.find {|owner| owner == parent}
|
31
32
|
end
|
32
33
|
|
33
34
|
def feature(feature)
|
34
|
-
|
35
|
+
log.debug "FEATURE: #{feature.name} #{feature.line} #{feature.keyword} #{feature.description}"
|
35
36
|
@feature = YARD::CodeObjects::Cucumber::Feature.new(@namespace,File.basename(@file.gsub('.feature','').gsub('.','_'))) do |f|
|
36
37
|
f.comments = feature.comments.map{|comment| comment.value}.join("\n")
|
37
38
|
f.description = feature.description
|
@@ -60,7 +61,7 @@ module Cucumber
|
|
60
61
|
end
|
61
62
|
|
62
63
|
def scenario(statement)
|
63
|
-
|
64
|
+
log.debug "SCENARIO"
|
64
65
|
scenario = YARD::CodeObjects::Cucumber::Scenario.new(@feature,"scenario_#{@feature.scenarios.length + 1}") do |s|
|
65
66
|
s.comments = statement.comments.map{|comment| comment.value}.join("\n")
|
66
67
|
s.description = statement.description
|
@@ -77,58 +78,110 @@ module Cucumber
|
|
77
78
|
end
|
78
79
|
|
79
80
|
def scenario_outline(statement)
|
80
|
-
|
81
|
-
end
|
81
|
+
#log.debug "SCENARIO OUTLINE"
|
82
82
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
83
|
+
outline = YARD::CodeObjects::Cucumber::ScenarioOutline.new(@feature,"scenario_#{@feature.scenarios.length + 1}") do |s|
|
84
|
+
s.comments = statement.comments.map{|comment| comment.value}.join("\n")
|
85
|
+
s.description = statement.description
|
86
|
+
s.add_file(@file,statement.line)
|
87
|
+
s.keyword = statement.keyword
|
88
|
+
s.value = statement.name
|
89
|
+
|
90
|
+
statement.tags.each {|scenario_tag| find_or_create_tag(scenario_tag.name,s) }
|
91
91
|
end
|
92
92
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
93
|
+
outline.feature = @feature
|
94
|
+
@feature.scenarios << outline
|
95
|
+
@step_container = outline
|
96
|
+
end
|
97
|
+
|
98
|
+
def examples(examples)
|
99
|
+
#log.debug "EXAMPLES #{examples.name}"
|
100
|
+
|
101
|
+
@step_container.examples = { :keyword => examples.keyword,
|
102
|
+
:name => examples.name,
|
103
|
+
:line => examples.line,
|
104
|
+
:comments => examples.comments.map{|comment| comment.value}.join("\n"),
|
105
|
+
:rows => matrix(examples.rows) }
|
106
|
+
|
107
|
+
# For each example generate a scenario and steps
|
108
|
+
|
109
|
+
@step_container.example_data.length.times do |row_index|
|
110
|
+
|
111
|
+
scenario = YARD::CodeObjects::Cucumber::Scenario.new(@step_container,"example_#{@step_container.scenarios.length + 1}") do |s|
|
112
|
+
s.comments = @comments
|
113
|
+
s.description = @description
|
114
|
+
s.add_file(@file,@step_container.line_number)
|
115
|
+
s.keyword = @keyword
|
116
|
+
s.value = "#{@value} (#{@step_container.scenarios.length + 1})"
|
117
|
+
|
118
|
+
#TODO: Should scenario instances have their own tag instances?
|
99
119
|
end
|
100
120
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
121
|
+
@step_container.steps.each do |step|
|
122
|
+
step_instance = YARD::CodeObjects::Cucumber::Step.new(scenario,step.line_number) do |s|
|
123
|
+
s.keyword = step.keyword
|
124
|
+
s.value = step.value
|
125
|
+
s.add_file(@file,step.line_number)
|
126
|
+
end
|
127
|
+
|
128
|
+
@step_container.example_values_for_row(row_index).each do |key,text|
|
129
|
+
step_instance.value.gsub!("<#{key}>",text)
|
130
|
+
end
|
131
|
+
|
132
|
+
step_instance.scenario = scenario
|
133
|
+
scenario.steps << step_instance
|
107
134
|
end
|
108
135
|
|
109
|
-
|
110
|
-
@
|
136
|
+
# Scenario instances of an outline link to the feature but are not linked from the feature
|
137
|
+
# @feature.scenarios << scenario
|
138
|
+
|
139
|
+
scenario.feature = @feature
|
140
|
+
@step_container.scenarios << scenario
|
141
|
+
|
111
142
|
end
|
143
|
+
|
144
|
+
end
|
112
145
|
|
113
|
-
|
146
|
+
def step(step)
|
147
|
+
#log.debug "STEP #{step.multiline_arg}"
|
148
|
+
@table_owner = YARD::CodeObjects::Cucumber::Step.new(@step_container,"#{step.line}") do |s|
|
149
|
+
s.keyword = step.keyword
|
150
|
+
s.value = step.name
|
151
|
+
s.add_file(@file,step.line)
|
114
152
|
end
|
115
153
|
|
116
|
-
|
117
|
-
|
154
|
+
multiline_arg = rubify(step.multiline_arg)
|
155
|
+
|
156
|
+
case(multiline_arg)
|
157
|
+
when Gherkin::Formatter::Model::PyString
|
158
|
+
@table_owner.text = multiline_arg.value
|
159
|
+
when Array
|
160
|
+
@table_owner.table = matrix(multiline_arg)
|
118
161
|
end
|
162
|
+
|
163
|
+
@table_owner.scenario = @step_container
|
164
|
+
@step_container.steps << @table_owner
|
165
|
+
end
|
166
|
+
|
167
|
+
def eof
|
168
|
+
end
|
119
169
|
|
120
|
-
|
170
|
+
def syntax_error(state, event, legal_events, line)
|
171
|
+
# raise "SYNTAX ERROR"
|
172
|
+
end
|
121
173
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
row.line = gherkin_row.line
|
129
|
-
row
|
174
|
+
private
|
175
|
+
def matrix(gherkin_table)
|
176
|
+
gherkin_table.map do |gherkin_row|
|
177
|
+
row = gherkin_row.cells
|
178
|
+
class << row
|
179
|
+
attr_accessor :line
|
130
180
|
end
|
181
|
+
row.line = gherkin_row.line
|
182
|
+
row
|
131
183
|
end
|
132
184
|
end
|
133
185
|
end
|
134
186
|
end
|
187
|
+
end
|
@@ -6,19 +6,10 @@
|
|
6
6
|
<span class="predicate"><%= step.keyword %></span>
|
7
7
|
|
8
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
9
|
<span class="defined">
|
19
|
-
|
20
|
-
<div class="details"
|
21
|
-
|
10
|
+
<%= highlight_matches(step) %>
|
11
|
+
<div class="details">
|
12
|
+
<a href="<%= url_for step.definition %>">?</a>
|
22
13
|
</div>
|
23
14
|
</span>
|
24
15
|
<% else %>
|
@@ -25,4 +25,18 @@ def scenarios
|
|
25
25
|
end
|
26
26
|
|
27
27
|
scenarios
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
def highlight_matches(step)
|
32
|
+
|
33
|
+
value = h(step.value)
|
34
|
+
|
35
|
+
if step.definition
|
36
|
+
step.value.match(%r{#{step.definition.compare_value}}).to_a[1..-1].each do |match|
|
37
|
+
value.gsub!(h(match),"<span class='match'>#{h(match)}</span>")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
value
|
28
42
|
end
|
@@ -51,14 +51,8 @@
|
|
51
51
|
font-family: 'Trebuchet MS', Arial, Helvetica;
|
52
52
|
}
|
53
53
|
|
54
|
-
.odd {
|
55
|
-
|
56
|
-
}
|
57
|
-
|
58
|
-
.even {
|
59
|
-
background-color: #FFFFFF;
|
60
|
-
}
|
61
|
-
|
54
|
+
.odd { background-color: #F0F6F9; }
|
55
|
+
.even { background-color: #FFFFFF; }
|
62
56
|
|
63
57
|
#background {
|
64
58
|
margin-top: 10px;
|
@@ -110,30 +104,16 @@
|
|
110
104
|
margin-top: 10px;
|
111
105
|
}
|
112
106
|
|
113
|
-
.step .predicate {
|
114
|
-
|
115
|
-
}
|
116
|
-
|
117
|
-
.step .undefined {
|
118
|
-
border-bottom: 1px dashed #E99494;
|
119
|
-
}
|
107
|
+
.step .predicate { color: #5D5C5B; }
|
108
|
+
.step .undefined { border-bottom: 1px dashed #E99494; }
|
120
109
|
.step .defined {}
|
121
|
-
.step .details {
|
122
|
-
float: right;
|
123
|
-
color: #343332;
|
124
|
-
}
|
110
|
+
.step .details { float: right; color: #343332; }
|
125
111
|
.step .details .pre {}
|
126
|
-
.step .details .name {
|
127
|
-
|
128
|
-
color: black;
|
129
|
-
}
|
130
|
-
|
131
|
-
.multiline, .text {
|
132
|
-
margin-top: 10px;
|
133
|
-
margin-left: 20px;
|
134
|
-
}
|
112
|
+
.step .details .name { font-family: monospace; color: black; }
|
113
|
+
.step .defined .match { color: #346F97; }
|
135
114
|
|
136
|
-
.text {
|
115
|
+
.multiline, .text { margin-top: 10px; margin-left: 20px; }
|
116
|
+
.text {
|
137
117
|
padding: 20px;
|
138
118
|
background-color: #F8F8FF;
|
139
119
|
color: #444444;
|
@@ -181,7 +161,7 @@
|
|
181
161
|
border-bottom: 1px solid #E3E3E3;
|
182
162
|
}
|
183
163
|
|
184
|
-
.stepdef .steps, .stepdef .
|
164
|
+
.stepdef .steps, .stepdef .method_details_list {
|
185
165
|
margin: 10px 0px 0px 30px;
|
186
166
|
}
|
187
167
|
.stepdef .steps .step {
|
@@ -0,0 +1,48 @@
|
|
1
|
+
|
2
|
+
<div style="margin: 10px;"> </div>
|
3
|
+
|
4
|
+
<div class="title">
|
5
|
+
<div class="name"><%= @item_title %></div>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<div style="margin: 10px;"> </div>
|
9
|
+
|
10
|
+
<% @items.each do |item| %>
|
11
|
+
|
12
|
+
<div class="stepdef">
|
13
|
+
<a name="<%= anchor_for item %>"></a>
|
14
|
+
<div class="title">
|
15
|
+
<span class="pre"><%= item.keyword %></span>
|
16
|
+
<span class="name"><%= item.value %></span>
|
17
|
+
<div style="float: right;"><%= h( item.location ) %></div>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<div class="method_details_list">
|
21
|
+
<table class="source_code">
|
22
|
+
<tr>
|
23
|
+
<td>
|
24
|
+
<pre class="lines"><%= "" %><%= h format_lines(item) %></pre>
|
25
|
+
</td>
|
26
|
+
<td>
|
27
|
+
<pre class="code"><%= "" %><%= html_syntax_highlight item.source %></pre>
|
28
|
+
</td>
|
29
|
+
</tr>
|
30
|
+
</table>
|
31
|
+
</div>
|
32
|
+
|
33
|
+
<div class="steps">
|
34
|
+
<% if item.steps && !item.steps.empty? %>
|
35
|
+
<% item.steps.each_with_index do |step,step_index| %>
|
36
|
+
<div class="step <%= (step_index + 1) % 2 == 0 ? 'even' : 'odd' %>">
|
37
|
+
<%= link_transformed_step(step) %>
|
38
|
+
<div class="details"><a href="<%= url_for step.scenario.feature %>"><%= h(step.location) %></a></div>
|
39
|
+
</div>
|
40
|
+
<% end %>
|
41
|
+
<% else %>
|
42
|
+
<span class="undefined">No steps were found to match this <%= @item_type %>.</span>
|
43
|
+
<% end%>
|
44
|
+
</div>
|
45
|
+
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<% end %>
|
@@ -3,15 +3,32 @@ def init
|
|
3
3
|
sections.push :steptransformers, [:stepdefinitions, :steptransforms]
|
4
4
|
end
|
5
5
|
|
6
|
+
|
6
7
|
def stepdefinitions
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
end.join("\n")
|
12
|
-
|
8
|
+
@item_title = "Step Definitions"
|
9
|
+
@item_type = "step definition"
|
10
|
+
@items = YARD::Registry.all(:stepdefinition)
|
11
|
+
erb(:transformers)
|
13
12
|
end
|
14
13
|
|
15
14
|
def steptransforms
|
15
|
+
@item_title = "Step Transformers"
|
16
|
+
@item_type = "step transformer"
|
17
|
+
@items = YARD::Registry.all(:steptransform)
|
18
|
+
erb(:transformers)
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
def link_transformed_step(step)
|
23
|
+
value = "#{step.keyword}#{step.value}"
|
16
24
|
|
25
|
+
if step.transformed?
|
26
|
+
step.value.match(%r{#{step.definition.compare_value}}).to_a.each do |match|
|
27
|
+
step.transforms.each do |transform|
|
28
|
+
value.gsub!(match,"<a href='#{url_for(transform)}'>#{match}</a>") if %r{#{transform.compare_value}}.match(match)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
value
|
17
34
|
end
|
@@ -4,14 +4,13 @@ module YARD::CodeObjects::Cucumber
|
|
4
4
|
|
5
5
|
class Scenario < NamespaceObject
|
6
6
|
|
7
|
-
attr_accessor :value, :description, :steps, :tags, :feature
|
7
|
+
attr_accessor :value, :comments, :keyword, :description, :steps, :tags, :feature
|
8
8
|
|
9
9
|
def initialize(namespace,name)
|
10
10
|
super(namespace,name.to_s.strip)
|
11
|
-
@description = @value = @feature = nil
|
11
|
+
@commants = @description = @keyword = @value = @feature = nil
|
12
12
|
@steps = []
|
13
13
|
@tags = []
|
14
|
-
@examples = []
|
15
14
|
end
|
16
15
|
|
17
16
|
def background?
|
@@ -19,19 +18,7 @@ module YARD::CodeObjects::Cucumber
|
|
19
18
|
end
|
20
19
|
|
21
20
|
def outline?
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
def example_keyword
|
26
|
-
@examples.first.first.to_s.strip
|
27
|
-
end
|
28
|
-
|
29
|
-
def example_headers
|
30
|
-
@examples.first.find {|example| example.is_a?(Array) }.first
|
31
|
-
end
|
32
|
-
|
33
|
-
def example_data
|
34
|
-
@examples.first.find {|example| example.is_a?(Array) }[1..-1]
|
21
|
+
false
|
35
22
|
end
|
36
23
|
|
37
24
|
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module YARD::CodeObjects::Cucumber
|
4
|
+
|
5
|
+
class ScenarioOutline < NamespaceObject
|
6
|
+
|
7
|
+
attr_accessor :value, :comments, :description, :steps, :tags, :feature
|
8
|
+
attr_accessor :scenarios, :examples
|
9
|
+
|
10
|
+
def initialize(namespace,name)
|
11
|
+
super(namespace,name.to_s.strip)
|
12
|
+
@comments = @description = @value = @feature = nil
|
13
|
+
@steps = []
|
14
|
+
@tags = []
|
15
|
+
@scenarios = []
|
16
|
+
@examples = {}
|
17
|
+
end
|
18
|
+
|
19
|
+
def background?
|
20
|
+
false
|
21
|
+
end
|
22
|
+
|
23
|
+
def outline?
|
24
|
+
true
|
25
|
+
end
|
26
|
+
|
27
|
+
def example_keyword
|
28
|
+
@examples[:keyword]
|
29
|
+
end
|
30
|
+
|
31
|
+
def example_headers
|
32
|
+
@examples[:rows].first
|
33
|
+
end
|
34
|
+
|
35
|
+
def example_data
|
36
|
+
@examples[:rows][1..-1]
|
37
|
+
end
|
38
|
+
|
39
|
+
def example_values_for_row(row)
|
40
|
+
hash = {}
|
41
|
+
|
42
|
+
example_headers.each_with_index do |header,index|
|
43
|
+
hash[header] = example_data[row][index]
|
44
|
+
end
|
45
|
+
|
46
|
+
hash
|
47
|
+
end
|
48
|
+
|
49
|
+
def example_hash
|
50
|
+
hash = {}
|
51
|
+
|
52
|
+
@examples[:rows].each_with_index do |header,index|
|
53
|
+
hash[header] = @examples[:rows].collect {|row| row[index] }
|
54
|
+
end
|
55
|
+
|
56
|
+
hash
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
@@ -4,11 +4,13 @@ module YARD::CodeObjects::Cucumber
|
|
4
4
|
|
5
5
|
class Step < Base
|
6
6
|
|
7
|
-
attr_accessor :definition, :keyword, :scenario, :table, :text, :value
|
7
|
+
attr_accessor :definition, :examples, :keyword, :scenario, :table, :text, :transforms, :value
|
8
8
|
|
9
9
|
def initialize(namespace,name)
|
10
10
|
super(namespace,name.to_s.strip)
|
11
11
|
@definition = @description = @keyword = @table = @text = @value = nil
|
12
|
+
@examples = {}
|
13
|
+
@transforms = []
|
12
14
|
end
|
13
15
|
|
14
16
|
def has_table?
|
@@ -18,7 +20,22 @@ module YARD::CodeObjects::Cucumber
|
|
18
20
|
def has_text?
|
19
21
|
!@text.nil?
|
20
22
|
end
|
21
|
-
|
23
|
+
|
24
|
+
def definition=(stepdef)
|
25
|
+
@definition = stepdef
|
26
|
+
stepdef.steps << self
|
27
|
+
end
|
28
|
+
|
29
|
+
def transformed?
|
30
|
+
!@transforms.empty?
|
31
|
+
end
|
32
|
+
|
33
|
+
def compare_values
|
34
|
+
|
35
|
+
@scenario.example_hash.collect do |stub,replacements|
|
36
|
+
replacements.collect {|replace| value.gsub("<#{stub}>",replace) }
|
37
|
+
end.flatten
|
38
|
+
end
|
22
39
|
end
|
23
40
|
|
24
41
|
end
|
@@ -7,43 +7,93 @@ module YARD
|
|
7
7
|
handles CodeObjects::Cucumber::Feature
|
8
8
|
|
9
9
|
def process
|
10
|
-
|
10
|
+
|
11
11
|
if statement
|
12
|
+
log.info "Processing Feature: #{statement.value}"
|
12
13
|
# For the background and the scenario, find the steps that have definitions
|
13
14
|
process_scenario(statement.background) if statement.background
|
14
|
-
|
15
|
+
|
16
|
+
|
15
17
|
statement.scenarios.each do |scenario|
|
16
|
-
|
18
|
+
if scenario.outline?
|
19
|
+
log.info "Scenario Outline: #{scenario.value}"
|
20
|
+
scenario.scenarios.each_with_index do |example,index|
|
21
|
+
log.info " * Processing Example #{index + 1}"
|
22
|
+
process_scenario(example)
|
23
|
+
end
|
24
|
+
else
|
25
|
+
log.info "Processing Scenario: #{scenario.value}"
|
26
|
+
process_scenario(scenario)
|
27
|
+
end
|
17
28
|
end
|
29
|
+
|
18
30
|
else
|
19
31
|
log.warn "Empty feature file. A feature failed to process correctly or contains no feature"
|
20
32
|
end
|
21
|
-
|
33
|
+
|
22
34
|
rescue YARD::Handlers::NamespaceMissingError
|
35
|
+
rescue Exception => exception
|
36
|
+
log.error "Skipping feature because an error has occurred."
|
37
|
+
log.debug "#\n{exception}\n#{exception.backtrace.join("\n")}\n"
|
23
38
|
end
|
24
|
-
|
25
|
-
|
26
|
-
def process_scenario(scenario)
|
27
39
|
|
40
|
+
|
41
|
+
|
42
|
+
def process_scenario(scenario)
|
28
43
|
scenario.steps.each do |step|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
44
|
+
process_step(step)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
def process_step(step)
|
50
|
+
step_definition = match_step_to_step_definition(step.value)
|
51
|
+
|
52
|
+
if step_definition
|
53
|
+
step.definition = step_definition
|
54
|
+
find_transforms_for_step(step)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
def match_step_to_step_definition(step_value)
|
60
|
+
YARD::Registry.all(:stepdefinition).each do |stepdef|
|
61
|
+
#log.debug "Looking at step #{step_value} against #{stepdef}"
|
62
|
+
|
63
|
+
if stepdef.compare_value =~ /.+\#\{[^\}]+\}.+/
|
64
|
+
log.warn "Step definition has packed constant #{stepdef.compare_value}"
|
65
|
+
else
|
66
|
+
if %r{#{stepdef.compare_value}}.match(step_value)
|
67
|
+
return stepdef
|
41
68
|
end
|
42
69
|
end
|
43
70
|
end
|
44
|
-
|
71
|
+
|
72
|
+
nil
|
45
73
|
end
|
46
74
|
|
75
|
+
def find_transforms_for_step(step)
|
76
|
+
#log.debug "Looking at step #{step} for transforms"
|
77
|
+
|
78
|
+
if step.definition
|
79
|
+
|
80
|
+
step.value.match(%r{#{step.definition.compare_value}}).to_a.each do |match|
|
81
|
+
YARD::Registry.all(:steptransform).each do |steptrans|
|
82
|
+
#log.debug "Looking at transform #{steptrans.value}"
|
83
|
+
if %r{#{steptrans.compare_value}}.match(match)
|
84
|
+
#log.debug "Step #{step} is affected by the transform #{steptrans}"
|
85
|
+
step.transforms << steptrans
|
86
|
+
steptrans.steps << step
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
|
47
97
|
|
48
98
|
end
|
49
99
|
|
@@ -8,10 +8,12 @@ class StepTransformHandler < YARD::Handlers::Ruby::Legacy::Base
|
|
8
8
|
def process
|
9
9
|
transform = statement.tokens.to_s[MATCH,1]
|
10
10
|
|
11
|
+
@@unique_name = @@unique_name + 1
|
12
|
+
|
11
13
|
obj = register StepTransformObject.new(YARD::CodeObjects::Cucumber::CUCUMBER_STEPTRANSFORM_NAMESPACE, "transform_#{@@unique_name}") do |o|
|
12
14
|
o.source = "Transform #{transform} do #{statement.block.to_s}\nend"
|
13
|
-
o.source = statement.block.to_s
|
14
15
|
o.value = transform
|
16
|
+
o.keyword = "Transform"
|
15
17
|
end
|
16
18
|
|
17
19
|
parse_block :owner => obj
|
metadata
CHANGED
@@ -4,8 +4,8 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
-
|
8
|
-
version: "1.
|
7
|
+
- 5
|
8
|
+
version: "1.5"
|
9
9
|
platform: ruby
|
10
10
|
authors:
|
11
11
|
- Franklin Webber
|
@@ -13,7 +13,7 @@ autorequire:
|
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
15
|
|
16
|
-
date: 2010-10-
|
16
|
+
date: 2010-10-25 00:00:00 -07:00
|
17
17
|
default_executable:
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
@@ -78,8 +78,8 @@ extra_rdoc_files:
|
|
78
78
|
- lib/templates/default/layout/html/search.erb
|
79
79
|
- lib/templates/default/scenario/html/scenario.erb
|
80
80
|
- lib/templates/default/scenario/setup.rb
|
81
|
-
- lib/templates/default/steptransformers/html/stepdefinition.erb
|
82
81
|
- lib/templates/default/steptransformers/html/steptransformers.erb
|
82
|
+
- lib/templates/default/steptransformers/html/transformers.erb
|
83
83
|
- lib/templates/default/steptransformers/setup.rb
|
84
84
|
- lib/templates/default/tag/html/feature.erb
|
85
85
|
- lib/templates/default/tag/html/scenario.erb
|
@@ -89,6 +89,7 @@ extra_rdoc_files:
|
|
89
89
|
- lib/yard/code_objects/cucumber/feature.rb
|
90
90
|
- lib/yard/code_objects/cucumber/namespace_object.rb
|
91
91
|
- lib/yard/code_objects/cucumber/scenario.rb
|
92
|
+
- lib/yard/code_objects/cucumber/scenario_outline.rb
|
92
93
|
- lib/yard/code_objects/cucumber/step.rb
|
93
94
|
- lib/yard/code_objects/cucumber/tag.rb
|
94
95
|
- lib/yard/code_objects/namespace_object.rb
|
@@ -115,9 +116,6 @@ files:
|
|
115
116
|
- example/step_definitions/support/env.rb
|
116
117
|
- example/step_definitions/support/env_support.rb
|
117
118
|
- example/step_definitions/support/support.rb
|
118
|
-
- features/definitions/city_step.rb
|
119
|
-
- features/definitions/test.setup.and.teardown.rb
|
120
|
-
- features/features.feature
|
121
119
|
- lib/city.rb
|
122
120
|
- lib/cucumber/city_builder.rb
|
123
121
|
- lib/templates/default/feature/html/background.erb
|
@@ -144,8 +142,8 @@ files:
|
|
144
142
|
- lib/templates/default/layout/html/search.erb
|
145
143
|
- lib/templates/default/scenario/html/scenario.erb
|
146
144
|
- lib/templates/default/scenario/setup.rb
|
147
|
-
- lib/templates/default/steptransformers/html/stepdefinition.erb
|
148
145
|
- lib/templates/default/steptransformers/html/steptransformers.erb
|
146
|
+
- lib/templates/default/steptransformers/html/transformers.erb
|
149
147
|
- lib/templates/default/steptransformers/setup.rb
|
150
148
|
- lib/templates/default/tag/html/feature.erb
|
151
149
|
- lib/templates/default/tag/html/scenario.erb
|
@@ -155,6 +153,7 @@ files:
|
|
155
153
|
- lib/yard/code_objects/cucumber/feature.rb
|
156
154
|
- lib/yard/code_objects/cucumber/namespace_object.rb
|
157
155
|
- lib/yard/code_objects/cucumber/scenario.rb
|
156
|
+
- lib/yard/code_objects/cucumber/scenario_outline.rb
|
158
157
|
- lib/yard/code_objects/cucumber/step.rb
|
159
158
|
- lib/yard/code_objects/cucumber/tag.rb
|
160
159
|
- lib/yard/code_objects/namespace_object.rb
|
@@ -1,89 +0,0 @@
|
|
1
|
-
require 'rexml/document'
|
2
|
-
|
3
|
-
|
4
|
-
TARGET_MATCH = /the feature/
|
5
|
-
|
6
|
-
Transform /^the feature$/ do |feauture|
|
7
|
-
@cache[:feature]
|
8
|
-
end
|
9
|
-
|
10
|
-
|
11
|
-
Given /^the feature file, '([^']+)', is the (feature) for the scenario$/ do |name,type|
|
12
|
-
@cache[type.to_sym] = name
|
13
|
-
end
|
14
|
-
|
15
|
-
Then /^I expect (#{TARGET_MATCH}) file (\w+) to exist at '([^']+)'$/ do |target,file_type,path|
|
16
|
-
file = "#{$env[:documents]}/#{path}/#{target}.#{file_type}"
|
17
|
-
File.should exist(file)
|
18
|
-
file
|
19
|
-
end
|
20
|
-
|
21
|
-
Then /^I expect the feature title to be '([^']+)'$/ do |title|
|
22
|
-
xml = REXML::Document.new(File.open("doc/requirements/features/features.html"))
|
23
|
-
|
24
|
-
actual_title = xml.elements["//title"].text
|
25
|
-
actual_title.should == title
|
26
|
-
end
|
27
|
-
|
28
|
-
Then /^I expect the feature heading to be '([^']+)'$/ do |title|
|
29
|
-
xml = REXML::Document.new(File.open("doc/requirements/features/features.html"))
|
30
|
-
|
31
|
-
actual_title = "#{xml.elements["//*[@class='feature']/*[@class='title']/*[@class='pre']"].text} " +
|
32
|
-
"#{xml.elements["//*[@class='feature']/*[@class='title']/*[@class='name']"].text}"
|
33
|
-
|
34
|
-
actual_title.should == title
|
35
|
-
end
|
36
|
-
|
37
|
-
Then /^I expect the feature to have the (@\w+) tag$/ do |tag|
|
38
|
-
xml = REXML::Document.new(File.open("doc/requirements/features/features.html"))
|
39
|
-
|
40
|
-
found = false
|
41
|
-
|
42
|
-
xml.elements.each("//*[@class='feature']//*[@class='tags']/a") do |actual_tag|
|
43
|
-
found = true if actual_tag.text == tag
|
44
|
-
end
|
45
|
-
|
46
|
-
found.should be_true
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
Then /^I expect the feature description to be$/ do |description|
|
51
|
-
|
52
|
-
xml = REXML::Document.new(File.open("doc/requirements/features/features.html"))
|
53
|
-
xml.elements["//*[@class='feature']//*[@class='description']"].text.strip.should == description.strip
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
Then /^I expect the feature to have a background$/ do
|
58
|
-
|
59
|
-
xml = REXML::Document.new(File.open("doc/requirements/features/features.html"))
|
60
|
-
xml.elements["//*[@id='background']"].should_not be_nil
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
Then /^I expect the background to have steps?$/ do |string|
|
65
|
-
|
66
|
-
found = true
|
67
|
-
|
68
|
-
xml = REXML::Document.new(File.open("doc/requirements/features/features.html"))
|
69
|
-
xml.elements["//*[@id='backgroundSteps']"].elements.each do |step|
|
70
|
-
found = true if "#{step.elements["span[1]"].text}#{step.elements["span[2]"].text}" == string
|
71
|
-
end
|
72
|
-
|
73
|
-
found.should be_true
|
74
|
-
|
75
|
-
end
|
76
|
-
|
77
|
-
Then /^I expect the feature to have the scenarios:$/ do |string|
|
78
|
-
|
79
|
-
xml = REXML::Document.new(File.open("doc/requirements/features/features.html"))
|
80
|
-
string.split("\n").each do |expected_title|
|
81
|
-
found = nil
|
82
|
-
xml.elements.each("//*[@class='scenario']/*[@class='title']/*[@class='name']") do |scenario|
|
83
|
-
found = scenario if scenario.text == expected_title
|
84
|
-
end
|
85
|
-
found.should_not be_nil
|
86
|
-
end
|
87
|
-
|
88
|
-
end
|
89
|
-
|
@@ -1,27 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Before all of the scenarios....
|
3
|
-
#
|
4
|
-
Before do
|
5
|
-
$env = {}
|
6
|
-
$env[:documents] = 'doc'
|
7
|
-
@cache = {}
|
8
|
-
end
|
9
|
-
|
10
|
-
|
11
|
-
#
|
12
|
-
# Before each scenario ...
|
13
|
-
#
|
14
|
-
Before do |scenario|
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
#
|
19
|
-
# After each scenario...
|
20
|
-
#
|
21
|
-
After do |scenario|
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
at_exit do
|
26
|
-
|
27
|
-
end
|
data/features/features.feature
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
@feature
|
2
|
-
Feature: Features Page
|
3
|
-
As a Cucumber-In-The-YARD user I rely on the ability to view the details of each feature.
|
4
|
-
|
5
|
-
Background:
|
6
|
-
Given the feature file, 'features', is the feature for the scenario
|
7
|
-
|
8
|
-
|
9
|
-
Scenario: Location
|
10
|
-
Then I expect the feature file html to exist at 'requirements/features'
|
11
|
-
|
12
|
-
Scenario: Identification
|
13
|
-
Then I expect the feature title to be 'Feature: Features Page'
|
14
|
-
And I expect the feature heading to be 'Feature: Features Page'
|
15
|
-
|
16
|
-
Scenario: Tags
|
17
|
-
Then I expect the feature to have the @feature tag
|
18
|
-
|
19
|
-
Scenario: Description
|
20
|
-
Then I expect the feature description to be
|
21
|
-
"""
|
22
|
-
As a Cucumber-In-The-YARD user I rely on the ability to view the details of each feature.
|
23
|
-
"""
|
24
|
-
|
25
|
-
Scenario: Background
|
26
|
-
Then I expect the feature to have a background
|
27
|
-
And I expect the background to have steps
|
28
|
-
"""
|
29
|
-
Given the feature, 'features.feature', is the feature for the scenario
|
30
|
-
"""
|
31
|
-
|
32
|
-
Scenario: Scenarios
|
33
|
-
Then I expect the feature to have the scenarios:
|
34
|
-
"""
|
35
|
-
Location
|
36
|
-
Identification
|
37
|
-
Tags
|
38
|
-
Description
|
39
|
-
Background
|
40
|
-
Scenarios
|
41
|
-
"""
|
42
|
-
|
43
|
-
|
44
|
-
|
@@ -1,38 +0,0 @@
|
|
1
|
-
<div class="stepdef">
|
2
|
-
<a name="<%= anchor_for @stepdefinition %>">
|
3
|
-
<div class="title">
|
4
|
-
<span class="pre"><%= @stepdefinition.keyword %></span>
|
5
|
-
<span class="name"><%= @stepdefinition.value %></span>
|
6
|
-
<div style="float: right;"><%= h( @stepdefinition.location ) %></div>
|
7
|
-
</div>
|
8
|
-
|
9
|
-
|
10
|
-
<div class="steps">
|
11
|
-
<% if @stepdefinition.steps && !@stepdefinition.steps.empty? %>
|
12
|
-
<% @stepdefinition.steps.each_with_index do |step,step_index| %>
|
13
|
-
<div class="step <%= (step_index + 1) % 2 == 0 ? 'even' : 'odd' %>">
|
14
|
-
<%= h("#{step.keyword} #{step.value}") %>
|
15
|
-
<div class="details"><a href="<%= url_for step.scenario.feature %>"><%= h(step.location) %></a></div>
|
16
|
-
</div>
|
17
|
-
<% end %>
|
18
|
-
<% else %>
|
19
|
-
<span class="undefined">No steps were found to match this step definition.</span>
|
20
|
-
<% end%>
|
21
|
-
</div>
|
22
|
-
|
23
|
-
<div class="source">
|
24
|
-
<span class="showSource">
|
25
|
-
[ <a href="#" class="toggleSource">View source</a> ]
|
26
|
-
</span>
|
27
|
-
<table class="source_code">
|
28
|
-
<tr>
|
29
|
-
<td>
|
30
|
-
<pre class="lines"><%= "" %><%= h format_lines(@stepdefinition) %></pre>
|
31
|
-
</td>
|
32
|
-
<td>
|
33
|
-
<pre class="code"><%= "" %><%= html_syntax_highlight @stepdefinition.source %></pre>
|
34
|
-
</td>
|
35
|
-
</tr>
|
36
|
-
</table>
|
37
|
-
</div>
|
38
|
-
</div>
|