yard-cucumber 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/.rspec
ADDED
data/History.txt
ADDED
@@ -0,0 +1,190 @@
|
|
1
|
+
=== 2.0.0 / 2011-02-08
|
2
|
+
|
3
|
+
* Cucumber In The YARD becomes `yard-cucumber` and with that gains the
|
4
|
+
benefits of being a YARD plugin
|
5
|
+
|
6
|
+
=== 1.7.9 / 2011-02-05
|
7
|
+
|
8
|
+
- FIX links to Scenarios and Transforms in various places
|
9
|
+
- FIX Comments on Step Definitions that may blow up
|
10
|
+
|
11
|
+
=== 1.7.8 / 2011-01-30
|
12
|
+
|
13
|
+
* 'All Features' lands you on the root features directory; 'Requirements'
|
14
|
+
is still accessible through the breadcrumbs.
|
15
|
+
* Feature directory pages will display all the features in all subdirectories
|
16
|
+
* Better sorting for features, tags, and step transformers.
|
17
|
+
|
18
|
+
- FIX Feature-Scenario links and Cursors
|
19
|
+
|
20
|
+
=== 1.7.7 / 2011-01-06
|
21
|
+
|
22
|
+
* Feature Directories now support a README.md file that can be used to provide
|
23
|
+
information (with markdown support) about the directory of features.
|
24
|
+
|
25
|
+
=== 1.7.6 / 2011-01-06
|
26
|
+
|
27
|
+
* Feature descriptions, multi-line strings, and comments will preserve spacing.
|
28
|
+
|
29
|
+
=== 1.7.5 / 2010-12-14
|
30
|
+
|
31
|
+
* FIX Step Transforms were colliding with Step Definitions in Ruby 1.9.2
|
32
|
+
|
33
|
+
=== 1.7.4 / 2010-12-11
|
34
|
+
|
35
|
+
* Ruby 1.9.2 Support
|
36
|
+
* Change to YARD Server support:
|
37
|
+
yard server -e /path/to/gem/lib/server.b
|
38
|
+
|
39
|
+
=== 1.7.3 / 2010-12-06
|
40
|
+
|
41
|
+
* Shortcut Keys (t) for tags and (r) for features (f was taken)
|
42
|
+
* Step definitions/transforms consolidate steps for easier viewing
|
43
|
+
and when they have no steps they are colored differently
|
44
|
+
* Tag filtering supports inverse (~) of tags
|
45
|
+
|
46
|
+
* FIX Scenario Outlines without examples will not crash the parser
|
47
|
+
* FIX Features, Scenarios, and Directories should display in alphabetic order
|
48
|
+
* FIX Comments and multiline strings will display correctly
|
49
|
+
* FIX Feature comments will show
|
50
|
+
|
51
|
+
=== 1.7.2 / 2010-11-30
|
52
|
+
|
53
|
+
* Step Definition and Transform page enhancements
|
54
|
+
* Step Regex links to Rubular
|
55
|
+
* FIX Steps with HTML encoded characters will display correctly
|
56
|
+
|
57
|
+
=== 1.7.1 / 2010-11-28
|
58
|
+
|
59
|
+
* Feature file with layout enhancements
|
60
|
+
* Scenarios are now linked/linkable
|
61
|
+
* FIX Scenario Outline error on CentOS, Ruby 1.8.7
|
62
|
+
* FIX Requiring Cucumber before Gherkin so that correct gherkin is loaded
|
63
|
+
|
64
|
+
=== 1.7.0 / 2010-11-18
|
65
|
+
|
66
|
+
* Dynamic Tag Union / Intersection
|
67
|
+
|
68
|
+
=== 1.6.4 / 2010-11-16
|
69
|
+
|
70
|
+
* `yard server` can now serve up requirements with YARD 0.6.2
|
71
|
+
* 'All Tags' page now has a cucumber tag AND filtering tool (beta)
|
72
|
+
* Step Defs and Transforms will show comments
|
73
|
+
|
74
|
+
* FIX removed warnings by no longer requiring YARD
|
75
|
+
|
76
|
+
=== 1.6.2 / 2010-11-07
|
77
|
+
|
78
|
+
* Undefined Steps are displayed on the Step Transformer page
|
79
|
+
* Defined and Undefined steps are better linked to the Transformer page
|
80
|
+
|
81
|
+
* FIX Requirements tags were conflicting with YARD tags and being displayed
|
82
|
+
in multiple locations
|
83
|
+
* FIX Scenario Outlines Examples failed to show their tables or text
|
84
|
+
|
85
|
+
=== 1.6.1 / 2010-11-04
|
86
|
+
|
87
|
+
* FIX - Feature Directries with sub-directories aborted serialization
|
88
|
+
|
89
|
+
=== 1.6.0 / 2010-11-02
|
90
|
+
|
91
|
+
* Feature directories, subdirectories, and Tags breadcrumb pages are present
|
92
|
+
* Scenario Outlines now display each example inline when the example is clicked
|
93
|
+
* 'All Features' and 'All Tags' links in the search fields
|
94
|
+
|
95
|
+
=== 1.5.4 / 2010-10-28
|
96
|
+
|
97
|
+
* Optimization - Found that for a large test suite that the processing time was
|
98
|
+
approaching 2 hours (oh boy!). Reduced that time to a few minutes by optimizing
|
99
|
+
the feature handler to cache all step definitions and step transforms.
|
100
|
+
|
101
|
+
* Step Transforms will now attempt to unpack any constants found within them.
|
102
|
+
* FIX - Step Transforms were not being parsed because the regex incorrectly included
|
103
|
+
the block.
|
104
|
+
* FIX - Features and Scenarios with multiple tags were not being displayed
|
105
|
+
|
106
|
+
=== 1.5.3 / 2010-10-26
|
107
|
+
|
108
|
+
* FIX - Step Definition YARD handler regex was poorly formed and raised exceptions
|
109
|
+
when it contained a forward-slash (even if escaped).
|
110
|
+
* FIX - Step highlighting was causing 'Out Of Memory' issues because
|
111
|
+
gsub could not handle nil values.
|
112
|
+
* FIX - Step highlighting failed to replace matches properly causing for corrupted
|
113
|
+
HTML span values to appear in the highlighted step definitions
|
114
|
+
|
115
|
+
=== 1.5.2 / 2010-10-26
|
116
|
+
|
117
|
+
* FIX - Step Transform YARD handler regex was poorly formed and raised exceptions
|
118
|
+
when a transform contained a forward-slash (even if escaped).
|
119
|
+
|
120
|
+
=== 1.5.1 / 2010-10-26
|
121
|
+
|
122
|
+
* Unified Feature/Scenario search field that resembles the Namespace-Class field
|
123
|
+
* Tag search also displays immediate features/scenarios
|
124
|
+
* Removed Scenario searching field
|
125
|
+
* Added filename and line number to a number of locations
|
126
|
+
* Minor Tag template enhancements
|
127
|
+
* FIX - Scenario Outline Reference was being replaced with the first example
|
128
|
+
* FIX - Scenario Outlines were not getting counted for tags
|
129
|
+
|
130
|
+
=== 1.5 / 2010-10-25
|
131
|
+
|
132
|
+
* Steps that have found their step definitions will also attempt to find their
|
133
|
+
step transforms (However step transforms are not unpacked yet like step
|
134
|
+
definitions).
|
135
|
+
* Scenario Outlines will expand, behind the scenes, and match like traditional
|
136
|
+
scenarios.
|
137
|
+
* FIX - duplication of owners that the tag reports has been removed.
|
138
|
+
* INFO level messaging while processing features and scenarios to help assist
|
139
|
+
with feedback during the long processing.
|
140
|
+
|
141
|
+
=== 1.4 / 2010-10-17
|
142
|
+
|
143
|
+
* Tagusage has been retired
|
144
|
+
* Tags are found during parsing by name or created and all uses are appended to the exising or newly created object
|
145
|
+
* Tagusage template renamed and fixed up for just a tag and all the references
|
146
|
+
* Tags are named tag_TAG (removed the @ as it was encoded during file serialization and I couldn't find an encoder helper)
|
147
|
+
* Cleaned up all references in the fulldoc, full list to references tags
|
148
|
+
|
149
|
+
* Moved Cucumber CodeObjects, Handlers, and Parsers to a Cucumber sub-directory
|
150
|
+
* Moved StepDefinition and StepTransforms form extensions.rb to individual StepObject and Handlers files
|
151
|
+
|
152
|
+
* (lsegal advice) Created Cucumber Namespace and sub namespaces for features, tags, and step transformers.
|
153
|
+
* (lsegal advice) Started to break apart the feature.erb into smaller digestable erb sections
|
154
|
+
|
155
|
+
* Feature namespace now parallels the directory structure of the feature directory (from where it is parsed)
|
156
|
+
* Feature files have simpler names; i.e. featurefile.html instead of featurefile.feature.html
|
157
|
+
* Feature page title now states Feature: The Feature ( KEYWORD: FEATURE_TITLE )
|
158
|
+
* Moved the templates to lib/templates so I could use yard/templates to override the YARD helpers
|
159
|
+
|
160
|
+
* Changed document parsing to mirror the order imposed by Cucumber, this is to stop features being loaded before step definitions.
|
161
|
+
This should hopefully address the issue where steps were not being mapped correctly to step definitions. This fixed the issue
|
162
|
+
in the small and large test suite I ran it against.
|
163
|
+
|
164
|
+
|
165
|
+
=== 1.3 / 2010-10-13
|
166
|
+
|
167
|
+
* (7rans requested) Step definitions to show their source code; required a better source definition to be stored during creation of the CodeObject
|
168
|
+
* Fixes to the Feature template which had some unclosed table header elements
|
169
|
+
* Scenario Outline helper methods added to Scenarios
|
170
|
+
* Scenario Outlines, Tables, and Multiline Strings had other minor CSS changes
|
171
|
+
* Step tables and Scenario Example tables are no longer locked to 150px; instead that is the minimum width
|
172
|
+
* Tables and Multiline Strings (PyStrings) are no longer displayed in the steps frame which was causing ugliness with the striping of the rows
|
173
|
+
* (lsegal strongly recommended) Removed the pervasive use of filename in the CodeObjects
|
174
|
+
* Cleaned up the fulldoc setup to remove the redundancy
|
175
|
+
* Updated all the templates to support the lack of filename
|
176
|
+
|
177
|
+
=== 1.2 / 2010-10-10
|
178
|
+
|
179
|
+
* FIX: Empty Step Definitions caused failure during serialization
|
180
|
+
* FIX: Empty Step Definitions caused failure during rendering HTML
|
181
|
+
|
182
|
+
=== 1.1 / 2010-10-10
|
183
|
+
|
184
|
+
* FIX: Feature template had references to old methods for description (when it was an array)
|
185
|
+
* FIX: Empty feature files caused the documentation to fail; ignoring emptying feature files
|
186
|
+
* FIX: Tags, Step definitions, and other CodeObjects that were not present caused rendering to fail; Checking for nil
|
187
|
+
|
188
|
+
=== 1.0 / 2010-10-10
|
189
|
+
|
190
|
+
* Initial Release
|
data/README.md
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
Cucumber-In-The-YARD (CITY): A Requirements Documentation Tool
|
2
|
+
====================================
|
3
|
+
|
4
|
+
Synopsis
|
5
|
+
--------
|
6
|
+
|
7
|
+
Cucumber-In-The-Yard is a YARD extension that processes Cucumber features,
|
8
|
+
scenarios, steps, tags, step definitions, and even transforms to provide
|
9
|
+
documentation similar to what you expect to how YARD displays classes, methods
|
10
|
+
and constants.This tools bridges the gap of having feature files found in
|
11
|
+
your source code and true documentation that your team, product owners and
|
12
|
+
stakeholders can use.
|
13
|
+
|
14
|
+
Examples
|
15
|
+
--------
|
16
|
+
|
17
|
+
I have created a trivial, example project to help provide a quick
|
18
|
+
visualization of the resulting documentation. I encourage you to look at it as
|
19
|
+
an example and see if it would assist your project from a multitude of
|
20
|
+
perspectives: as the project's core developer; another developer or a new
|
21
|
+
developer; quality assurance engineer; or product owner/stakeholder.
|
22
|
+
|
23
|
+
The implemented example has been deployed at [http://recursivegames.com/cukes/](http://recursivegames.com/cukes/).
|
24
|
+
|
25
|
+
**1. View Features and Scenarios** [example](http://recursivegames.com/cukes/requirements/)
|
26
|
+
|
27
|
+
**2. Search through [features, scenarios](http://recursivegames.com/cukes/feature_list.html), and [tags](http://recursivegames.com/cukes/tag_list.html)**
|
28
|
+
|
29
|
+
**3. Dynamic Tag Unions and Intersections** [example](http://recursivegames.com/cukes/requirements/tags.html)
|
30
|
+
|
31
|
+
**4. View all features and scenarios by tag** [example](http://recursivegames.com/cukes/requirements/tags/message.html)
|
32
|
+
|
33
|
+
**5. View Step Definitions and Transforms** [example](http://recursivegames.com/cukes/requirements/step_transformers.html)
|
34
|
+
|
35
|
+
**6. All steps [matched](http://recursivegames.com/cukes/requirements/step_transformers.html#definition_5-stepdefinition) to step definitions**
|
36
|
+
|
37
|
+
**7. [Steps](http://recursivegames.com/cukes/requirements/step_transformers.html#transform_3-steptransform) that have transforms applied to them**
|
38
|
+
|
39
|
+
**8. [Undefined steps](http://recursivegames.com/cukes/requirements/step_transformers.html#undefined_steps) and even [Rubular](http://rubular.com/) links of your step definitions.**
|
40
|
+
|
41
|
+
**9. Feature directories with a README.md will be parsed into the description** [example](http://recursivegames.com/cukes/requirements/features.html)
|
42
|
+
|
43
|
+
Installation
|
44
|
+
------------
|
45
|
+
|
46
|
+
Cucumber-In-The-Yard (CITY) requires the following gems installed:
|
47
|
+
|
48
|
+
Gherkin - http://cukes.info
|
49
|
+
Cucumber - http://cukes.info
|
50
|
+
YARD - http://yardoc.org
|
51
|
+
|
52
|
+
To install CITY use the following command:
|
53
|
+
|
54
|
+
$ gem install yard-cucumber
|
55
|
+
|
56
|
+
(Add `sudo` if you're installing under a POSIX system as root)
|
57
|
+
|
58
|
+
Usage
|
59
|
+
-----
|
60
|
+
|
61
|
+
YARD supports for automatically including gems with the prefix `yard-`
|
62
|
+
as a plugin. To enable automatic loading yard-cucumber.
|
63
|
+
|
64
|
+
1. Edit `~/.yard/config` and insert the following line:
|
65
|
+
|
66
|
+
load_plugins: true
|
67
|
+
|
68
|
+
2. Run `yardoc`, use the rake task, or run `yard server`, as would [normally](https://github.com/lsegal/yard).
|
69
|
+
|
70
|
+
Be sure to update any file patterns so that they do not exclude `feature`
|
71
|
+
files. yard-cucumber will even process your step definitions and transforms.
|
72
|
+
|
73
|
+
$ yardoc 'example/**/*.rb' 'example/**/*.feature'
|
74
|
+
|
75
|
+
An example with the rake task:
|
76
|
+
|
77
|
+
require 'yard'
|
78
|
+
|
79
|
+
YARD::Rake::YardocTask.new do |t|
|
80
|
+
t.files = ['features/**/*.feature', 'features/**/*.rb']
|
81
|
+
t.options = ['--any', '--extra', '--opts'] # optional
|
82
|
+
end
|
83
|
+
|
84
|
+
Details
|
85
|
+
--------
|
86
|
+
|
87
|
+
There are two things that I enjoy: a test framework written in my own Domain
|
88
|
+
Specific Language (DSL) that is easily understood by all those on a project
|
89
|
+
and the ability for all participants to easily read, search, and view the tests.
|
90
|
+
|
91
|
+
Cucumber is an amazing tool that allowed me to define exercisable requirements.
|
92
|
+
My biggest obstacle was bringing these requirements to my team, the product
|
93
|
+
owner, and other stakeholders.
|
94
|
+
|
95
|
+
Initially I tried to expose more of the functionality by providing freshly
|
96
|
+
authored requirements through email, attachments to JIRA tickets, or linked in
|
97
|
+
wiki documents. None of these methods were very sustainable or successful.
|
98
|
+
First, I was continually pushing out the documents to those interested.
|
99
|
+
Second, the documents were displayed to the user in text without the syntax
|
100
|
+
highlighting that was exceedingly helpful for quickly understanding the requirements.
|
101
|
+
|
102
|
+
I also found it hard to share the test framework that I had put together with
|
103
|
+
another developer that joined the team. It was difficult to direct them around
|
104
|
+
the features, tags, step definitions, and transforms. It was when I started to convey to them the conventions that I had established that I wished I had a
|
105
|
+
tool that would allow me to provide documentation like one would find generated
|
106
|
+
by a great tool like YARD.
|
107
|
+
|
108
|
+
So I set out to integrate Cucumber objects like features, backgrounds,
|
109
|
+
scenarios, tags, steps, step definitions, and transforms into a YARD template.
|
110
|
+
From my quick survey of the landscape I can see that the my needs are
|
111
|
+
different than a lot of others that use Cucumber. The entire project that
|
112
|
+
spawned this effort was solely to exercise the functionality of a different,
|
113
|
+
large project and so there is a huge dependence on having the requirements
|
114
|
+
documented. This is in contrast to other projects that are using this on a
|
115
|
+
small scale to test the functionality of small software component. Though,
|
116
|
+
ultimately, I realized that the functionality may provide a valuable tool for
|
117
|
+
many as I feel it helps more solidly bridge the reporting of the documentation
|
118
|
+
by putting a coat of paint on it.
|
119
|
+
|
120
|
+
|
121
|
+
LICENSE
|
122
|
+
-------
|
123
|
+
|
124
|
+
(The MIT License)
|
125
|
+
|
126
|
+
Copyright (c) 2011 FIX
|
127
|
+
|
128
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
129
|
+
a copy of this software and associated documentation files (the
|
130
|
+
'Software'), to deal in the Software without restriction, including
|
131
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
132
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
133
|
+
permit persons to whom the Software is furnished to do so, subject to
|
134
|
+
the following conditions:
|
135
|
+
|
136
|
+
The above copyright notice and this permission notice shall be
|
137
|
+
included in all copies or substantial portions of the Software.
|
138
|
+
|
139
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
140
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
141
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
142
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
143
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
144
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
145
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rake'
|
2
|
+
|
3
|
+
task :default => :yardoc
|
4
|
+
|
5
|
+
task :clean do
|
6
|
+
`rm -rf doc`
|
7
|
+
`rm -rf .yardoc`
|
8
|
+
end
|
9
|
+
|
10
|
+
task :gendoc => :clean do
|
11
|
+
`yardoc -e ./lib/city.rb -p ./lib/templates 'example/**/*' --debug`
|
12
|
+
end
|
13
|
+
|
14
|
+
task :gem do
|
15
|
+
`gem build city.gemspec`
|
16
|
+
`gem install --local yard-cucumber-2.0.0.gem`
|
17
|
+
end
|
data/city.gemspec
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'YARD'
|
2
|
+
require File.dirname(__FILE__) + "/lib/yard-cucumber"
|
3
|
+
|
4
|
+
module CucumberInTheYARD
|
5
|
+
def self.show_version_changes(version)
|
6
|
+
date = ""
|
7
|
+
changes = []
|
8
|
+
grab_changes = false
|
9
|
+
|
10
|
+
File.open("#{File.dirname(__FILE__)}/History.txt",'r') do |file|
|
11
|
+
while (line = file.gets) do
|
12
|
+
|
13
|
+
if line =~ /^===\s*#{version.gsub('.','\.')}\s*\/\s*(.+)\s*$/
|
14
|
+
grab_changes = true
|
15
|
+
date = $1.strip
|
16
|
+
elsif line =~ /^===\s*.+$/
|
17
|
+
grab_changes = false
|
18
|
+
elsif grab_changes
|
19
|
+
changes = changes << line
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
{ :date => date, :changes => changes }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
Gem::Specification.new do |s|
|
30
|
+
s.name = 'yard-cucumber'
|
31
|
+
s.version = ::CucumberInTheYARD::VERSION
|
32
|
+
s.authors = ["Franklin Webber"]
|
33
|
+
s.description = %{
|
34
|
+
YARD-Cucumber is a YARD extension that processes Cucumber Features, Scenarios, Steps,
|
35
|
+
Step Definitions, Transforms, and Tags and provides a documentation interface that allows you
|
36
|
+
easily view and investigate the test suite. This tools hopes to bridge the gap of being able
|
37
|
+
to provide your feature descriptions to your Product Owners and Stakeholders. }
|
38
|
+
s.summary = "Cucumber Features in YARD"
|
39
|
+
s.email = 'franklin.webber@gmail.com'
|
40
|
+
s.homepage = "http://github.com/burtlo/yard-cucumber"
|
41
|
+
|
42
|
+
s.platform = Gem::Platform::RUBY
|
43
|
+
|
44
|
+
changes = CucumberInTheYARD.show_version_changes(::CucumberInTheYARD::VERSION)
|
45
|
+
|
46
|
+
s.post_install_message = %{
|
47
|
+
(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
|
48
|
+
|
49
|
+
Thank you for installing yard-cucumber #{::CucumberInTheYARD::VERSION} / #{changes[:date]}.
|
50
|
+
|
51
|
+
Changes:
|
52
|
+
#{changes[:changes].collect{|change| " #{change}"}.join("")}
|
53
|
+
(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
|
54
|
+
|
55
|
+
}
|
56
|
+
|
57
|
+
s.add_dependency 'gherkin', '>= 2.2.9'
|
58
|
+
s.add_dependency 'cucumber', '>= 0.7.5'
|
59
|
+
s.add_dependency 'yard', '>= 0.6.3'
|
60
|
+
|
61
|
+
s.rubygems_version = "1.3.7"
|
62
|
+
s.files = `git ls-files`.split("\n")
|
63
|
+
s.extra_rdoc_files = ["README.md", "History.txt"]
|
64
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
65
|
+
s.require_path = "lib"
|
66
|
+
end
|
data/example/README.md
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
This collection of features are really just to test some of the varied cases
|
2
|
+
that CITY may come in contact with while parsing a series of features. All
|
3
|
+
of the features, tags, and directories displayed here are contained in this
|
4
|
+
directory and all subdirectories.
|
5
|
+
|
6
|
+
* First, the features which are broken down alphabetically and displayed
|
7
|
+
* Second, the tags, used by all the features and scenarios
|
8
|
+
* Third, the subdirectories, contained in this directory and in the subdirectories.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Child Features
|
2
|
+
==============
|
3
|
+
|
4
|
+
Synopsis
|
5
|
+
--------
|
6
|
+
|
7
|
+
This collection of features are contained in this folder. The description README
|
8
|
+
allows a user to place a description for entire directory of the features and appears
|
9
|
+
in the output to assist with understanding about the collection of features.
|
10
|
+
|
11
|
+
Resources
|
12
|
+
---------
|
13
|
+
|
14
|
+
Links to particular resources like the links to the stories, tasks, or other areas
|
15
|
+
can also be represented.
|
16
|
+
|
17
|
+
The implemented example has been deployed at [http://recursivegames.com/cukes/](http://recursivegames.com/cukes/).
|
18
|
+
|
19
|
+
**1. An Item** [example](http://recursivegames.com/cukes/requirements/)
|
20
|
+
|
21
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
@scenarios
|
2
|
+
Feature: Child Feature
|
3
|
+
As a reader of the documentation I expect that scenario are documented correctly
|
4
|
+
|
5
|
+
Background:
|
6
|
+
Given this background step
|
7
|
+
|
8
|
+
Scenario: Child Scenario
|
9
|
+
Given this first step
|
10
|
+
When this second step
|
11
|
+
Then this third step
|
@@ -0,0 +1,12 @@
|
|
1
|
+
@scenarios
|
2
|
+
Feature: Grandchild Feature
|
3
|
+
As a reader of the documentation I expect that scenario are documented correctly
|
4
|
+
|
5
|
+
Background:
|
6
|
+
Given this background step
|
7
|
+
|
8
|
+
@first
|
9
|
+
Scenario: Grandchild Scenario
|
10
|
+
Given this first step
|
11
|
+
When this second step
|
12
|
+
Then this third step
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# Comments that appear before the feature are associated with the feature
|
2
|
+
@scenarios
|
3
|
+
Feature: Displaying Scenarios
|
4
|
+
As a reader of the documentation I expect that scenario are documented correctly
|
5
|
+
|
6
|
+
# Comments after the feature description belong to the background or first scenario
|
7
|
+
Background:
|
8
|
+
Given this background step
|
9
|
+
|
10
|
+
@first @bvt
|
11
|
+
Scenario: No Step Scenario
|
12
|
+
|
13
|
+
@second @bvt
|
14
|
+
Scenario: Scenario With Steps
|
15
|
+
Given this first step
|
16
|
+
When this second step
|
17
|
+
Then this third step
|
18
|
+
|
19
|
+
@third @optional_parameters
|
20
|
+
Scenario: Optional Parameter Step Definition
|
21
|
+
# This step definition has some optional parameters
|
22
|
+
Given a project
|
23
|
+
And an inactive project
|
24
|
+
And a project with the name 'optional', start date 10/26/2010, nicknamed 'norman'
|
25
|
+
|
26
|
+
@fourth @highlight
|
27
|
+
Scenario: Matched Term Highlighting
|
28
|
+
Given a duck that has a bill
|
29
|
+
Then I expect the duck to quack
|
30
|
+
|
31
|
+
@fifth @table
|
32
|
+
Scenario: Scenario With Table
|
33
|
+
Given the following table:
|
34
|
+
| column 1 | column 2 | column 3 |
|
35
|
+
| value 1 | value 2 | value 3 |
|
36
|
+
|
37
|
+
@sixth @text
|
38
|
+
Scenario: Scenario With Text
|
39
|
+
Given the following text:
|
40
|
+
"""
|
41
|
+
Oh what a bother!
|
42
|
+
That this text has to take up two lines
|
43
|
+
This line should be indented 2 spaces
|
44
|
+
This line should be indented 4 spaces
|
45
|
+
"""
|
46
|
+
|
47
|
+
# Comments before the scenario
|
48
|
+
@seventh @comments
|
49
|
+
Scenario: Scenario with comments and a description
|
50
|
+
There once was a need for information to be displayed alongside all the
|
51
|
+
entities that I hoped to test
|
52
|
+
# First Comment
|
53
|
+
Given this first step
|
54
|
+
# Second Comment that
|
55
|
+
# spans a few lines
|
56
|
+
And this second step
|
57
|
+
# Third Comment
|
58
|
+
And this third step
|
59
|
+
# Comments after the last step, where do they go?
|
60
|
+
|
61
|
+
Scenario: Step ending with a match with double-quotes
|
62
|
+
When searching the log for the exact match of the message "Entering application."
|
63
|
+
When the step definition has HTML escaped characters like: "<>&"
|
@@ -0,0 +1,80 @@
|
|
1
|
+
@scenario_outlines @bvt
|
2
|
+
Feature: Displaying Scenario Outlines
|
3
|
+
As a reader of the documentation I expect that scenario outlines are documented correctly
|
4
|
+
|
5
|
+
@first
|
6
|
+
Scenario Outline: Three Examples
|
7
|
+
Given that <Customer> is a valid customer
|
8
|
+
And that the product, named '<Product>', is a valid product
|
9
|
+
When the customer has purchased the product
|
10
|
+
Then I expect the customer to be a member of the '<Product>' group
|
11
|
+
|
12
|
+
Examples:
|
13
|
+
| Customer | Product |
|
14
|
+
| Customer A | Product A |
|
15
|
+
| Customer A | Product B |
|
16
|
+
| Customer A | Product C |
|
17
|
+
|
18
|
+
@second
|
19
|
+
Scenario Outline: Step contains a text block
|
20
|
+
Given the following text:
|
21
|
+
"""
|
22
|
+
The <noun> jumped over the <place>
|
23
|
+
"""
|
24
|
+
When I click on an example row
|
25
|
+
Then I expect <noun> to be replaced by the example noun
|
26
|
+
And I expect <place> to be replaced by the example place
|
27
|
+
|
28
|
+
Examples:
|
29
|
+
| noun | place |
|
30
|
+
| cow | moon |
|
31
|
+
| horse | spoon |
|
32
|
+
|
33
|
+
@third
|
34
|
+
Scenario Outline: Step contains a table
|
35
|
+
Given the following table:
|
36
|
+
| name | price | quantity |
|
37
|
+
| <name> | <price> | 100000 |
|
38
|
+
When I click on an example row
|
39
|
+
Then I expect <name> to be replaced by the example name
|
40
|
+
And I expect <price> to be replaced by the example price
|
41
|
+
|
42
|
+
Examples:
|
43
|
+
| name | price |
|
44
|
+
| toy | $99 |
|
45
|
+
| game | $49 |
|
46
|
+
|
47
|
+
@fourth
|
48
|
+
Scenario Outline: Step contains a table; table header uses an example
|
49
|
+
Given the following table:
|
50
|
+
| name | <denomination> | quantity |
|
51
|
+
| <name> | <price> | 100000 |
|
52
|
+
When I click on an example row
|
53
|
+
Then I expect <name> to be replaced by the example name
|
54
|
+
And I expect <price> to be replaced by the example price
|
55
|
+
And I expect <denomination> to be replaced by the example denomination
|
56
|
+
|
57
|
+
Examples:
|
58
|
+
| name | price | denomination |
|
59
|
+
| toy | 99 | cost in euros |
|
60
|
+
| game | 49 | cost in dollars |
|
61
|
+
|
62
|
+
# This is an example of a scenario outline in development.
|
63
|
+
# The example table has not been defined yet
|
64
|
+
Scenario Outline: Example Table Missing
|
65
|
+
When I click on an example row
|
66
|
+
Then I expect <name> to be replaced by the example name
|
67
|
+
And I expect <price> to be replaced by the example price
|
68
|
+
And I expect <denomination> to be replaced by the example denomination
|
69
|
+
|
70
|
+
|
71
|
+
# This is an example of a scenario outline in development.
|
72
|
+
# The examples table has been defined, but is missing data.
|
73
|
+
Scenario Outline: Empty Example Table
|
74
|
+
When I click on an example row
|
75
|
+
Then I expect <name> to be replaced by the example name
|
76
|
+
And I expect <price> to be replaced by the example price
|
77
|
+
And I expect <denomination> to be replaced by the example denomination
|
78
|
+
|
79
|
+
Examples:
|
80
|
+
| name | price | denomination |
|