cucumber-in-the-yard 1.6.1 → 1.6.3
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 +13 -0
- data/README.md +27 -50
- data/example/child_feature/grandchild_feature/scenario.feature +52 -0
- data/example/child_feature/scenario.feature +52 -0
- data/example/scenario.feature +51 -0
- data/example/scenario_outline.feature +60 -0
- data/example/step_definitions/example.step.rb +7 -2
- data/example/step_definitions/first.step.rb +15 -0
- data/example/step_definitions/support/support.rb +6 -0
- data/example/transform.feature +13 -0
- data/lib/city.rb +2 -1
- data/lib/cucumber/city_builder.rb +10 -0
- data/lib/templates/default/feature/html/no_steps_defined.erb +1 -1
- data/lib/templates/default/feature/html/outline.erb +36 -29
- data/lib/templates/default/feature/html/scenario.erb +1 -1
- data/lib/templates/default/feature/html/steps.erb +20 -8
- data/lib/templates/default/feature/html/table.erb +16 -16
- data/lib/templates/default/feature/setup.rb +1 -1
- data/lib/templates/default/{tags → featuretags}/html/namespace.erb +0 -0
- data/lib/templates/default/{tags → featuretags}/html/setup.rb +0 -0
- data/lib/templates/default/fulldoc/html/css/common.css +25 -5
- data/lib/templates/default/requirements/html/namespace.erb +47 -34
- data/lib/templates/default/requirements/html/setup.rb +16 -5
- data/lib/templates/default/steptransformers/html/transformers.erb +5 -0
- data/lib/templates/default/steptransformers/html/undefined_steps.erb +30 -0
- data/lib/templates/default/steptransformers/setup.rb +17 -7
- data/lib/yard/code_objects/cucumber/namespace_object.rb +2 -2
- data/lib/yard/code_objects/step_definition.rb +2 -35
- data/lib/yard/code_objects/step_transform.rb +1 -34
- data/lib/yard/code_objects/step_transformer.rb +50 -0
- data/lib/yard/handlers/cucumber/feature_handler.rb +1 -1
- data/lib/yard/handlers/step_definition_handler.rb +0 -36
- data/lib/yard/handlers/step_transform_handler.rb +1 -33
- metadata +27 -22
- data/.autotest +0 -15
- data/autotest/discover.rb +0 -3
- data/example/example.third.feature +0 -33
- data/example/first_example.feature +0 -19
- data/example/second_example.feature +0 -51
- data/example/sub_features/second_example.feature +0 -51
- data/spec/city/feature_parser_spec_examples.rb +0 -153
- data/spec/city/gherkin_loader_spec.rb +0 -39
- data/spec/city/test.feature +0 -36
- data/spec/city/yard_handlers_cucumber_spec.rb +0 -24
- data/spec/city/yard_namespace_object_spec.rb +0 -8
- data/spec/city/yard_parser_cucumber_spec.rb +0 -215
- data/spec/city/yard_rb_extensions_spec.rb +0 -128
- data/spec/spec_helper.rb +0 -5
data/History.txt
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
=== 1.6.3 / 2010-11-08
|
2
|
+
|
3
|
+
* FIX Step Definitions and Step Transforms incorrectly cached the YARD Constants
|
4
|
+
|
5
|
+
=== 1.6.2 / 2010-11-07
|
6
|
+
|
7
|
+
* Undefined Steps are displayed on the Step Transformer page
|
8
|
+
* Defined and Undefined steps are better linked to the Transformer page
|
9
|
+
|
10
|
+
* FIX Requirements tags were conflicting with YARD tags and being displayed
|
11
|
+
in multiple locations
|
12
|
+
* FIX Scenario Outlines Examples failed to show their tables or text
|
13
|
+
|
1
14
|
=== 1.6.1 / 2010-11-04
|
2
15
|
|
3
16
|
* FIX - Feature Directries with sub-directories aborted serialization
|
data/README.md
CHANGED
@@ -4,59 +4,35 @@ Cucumber-In-The-YARD (CITY): A Requirements Documentation Tool
|
|
4
4
|
Synopsis
|
5
5
|
--------
|
6
6
|
|
7
|
-
Cucumber-In-The-Yard is a YARD extension that processes Cucumber
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
Cucumber-In-The-Yard is a YARD extension that processes Cucumber features, scenarios, steps,
|
8
|
+
tags, step definitions, and even transforms to provide documentation similar to what you expect
|
9
|
+
to how YARD displays classes, methods and constants. This tools bridges the gap of having
|
10
|
+
feature files found in your source code and true documentation that your team, product owners
|
11
|
+
and stakeholders can use.
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
An example, particularly the example features included with the project, of CITY can be viewed at
|
16
|
-
|
17
|
-
[http://recursivegames.com/cukes/](http://recursivegames.com/cukes/)
|
18
|
-
|
19
|
-
**1. Users are able to search by Feature, Tags, and Scenario.**
|
20
|
-
|
21
|
-
Appended to the traditional search areas is the ability to now search by Feature, Tag, and Scenario.
|
22
|
-
The user is able to search by steps, though I have not placed those links on the page, in step_list.html
|
23
|
-
found in the root of the output directory.
|
24
|
-
|
25
|
-
**2. Feature pages are displayed in a decently formatted HTML representation**
|
26
|
-
|
27
|
-
As opposed to pointing team members, stakeholders, and product owners to feature files which require
|
28
|
-
an editor with syntax highlighting. As well as providing the ability to quickly follow tags and steps
|
29
|
-
for more information.
|
30
|
-
|
31
|
-
**3. Tag pages display all the Features and scenarios that currently employ the tag.**
|
32
|
-
|
33
|
-
Providing quick access to the important tag divisions that have been created in a project.
|
34
|
-
On the top of the page there are some quick calculations of the number of features and scenarios that
|
35
|
-
share the specified tag.
|
13
|
+
Examples
|
14
|
+
--------
|
36
15
|
|
37
|
-
|
16
|
+
I have created a trivial, example project to help provide a quick visualization of the resulting
|
17
|
+
documentation. I encourage you to look at it as an example and see if it would assist your
|
18
|
+
project from a multitude of perspectives: as the project's core developer; another developer or
|
19
|
+
a new developer; quality assurance engineer; or product owner/stakeholder.
|
38
20
|
|
39
|
-
|
40
|
-
steps for this step definition. This is useful for providing example documentation and quickly understanding
|
41
|
-
which scenarios are affected by a change to a step definition.
|
21
|
+
The implemented example has been deployed at [http://recursivegames.com/cukes/](http://recursivegames.com/cukes/).
|
42
22
|
|
43
|
-
**
|
23
|
+
**1. Formatted Features** [example](http://recursivegames.com/cukes/requirements/example/scenario.html)
|
44
24
|
|
45
|
-
|
46
|
-
ones match the step transforms. Step transform links can be found after following a link from the step to
|
47
|
-
the step definition.
|
25
|
+
**2. Search through features, scenarios, and tags** [example](http://recursivegames.com/cukes/feature_list.html) & [example](http://recursivegames.com/cukes/tag_list.html)
|
48
26
|
|
49
|
-
**
|
27
|
+
**4. View features and scenarios by tag** [example](http://recursivegames.com/cukes/requirements/tags/bvt.html)
|
50
28
|
|
51
|
-
Steps
|
52
|
-
definition.
|
29
|
+
**5. Steps link to their step definitions** [example](http://recursivegames.com/cukes/requirements/example/scenario.html)
|
53
30
|
|
54
|
-
**
|
31
|
+
**6. Step definitions show implemented steps** [example](http://recursivegames.com/cukes/requirements/step_transformers.html#definition_13-stepdefinition)
|
55
32
|
|
56
|
-
|
57
|
-
make it easier to represent them to product owners. As well as link the instance of the step definitions
|
58
|
-
for developers.
|
33
|
+
**7. Step definitions show the step transforms used** [example](http://recursivegames.com/cukes/requirements/step_transformers.html#transform_8-steptransform)
|
59
34
|
|
35
|
+
**8. Undefined steps are listed** [example](http://recursivegames.com/cukes/requirements/step_transformers.html#undefined_steps)
|
60
36
|
|
61
37
|
Installation
|
62
38
|
------------
|
@@ -73,10 +49,6 @@ To install CITY use the following command:
|
|
73
49
|
|
74
50
|
(Add `sudo` if you're installing under a POSIX system as root)
|
75
51
|
|
76
|
-
Alternatively, if you've checked the source out directly, you can call
|
77
|
-
`rake install` from the root project directory.
|
78
|
-
|
79
|
-
|
80
52
|
Usage
|
81
53
|
-----
|
82
54
|
|
@@ -88,7 +60,7 @@ You can do this by adding the following to your `Rakefile`:
|
|
88
60
|
require "city"
|
89
61
|
|
90
62
|
YARD::Rake::CitydocTask.new do |t|
|
91
|
-
t.files = ['features
|
63
|
+
t.files = ['features/**/*', OTHER_PATHS] # optional
|
92
64
|
t.options = ['--any', '--extra', '--opts'] # optional
|
93
65
|
end
|
94
66
|
|
@@ -98,6 +70,10 @@ to add. Again, a full list of options is available by typing `yardoc --help`
|
|
98
70
|
in a shell. You can also override the options at the Rake command-line with the
|
99
71
|
OPTS environment variable:
|
100
72
|
|
73
|
+
**2. YARD command-line**
|
74
|
+
|
75
|
+
$ yardoc -e path/to/cucumber-in-the-yard/lib/city.rb -p path/to/cucumber-in-the-yard/lib/templates 'features/**/*.*'
|
76
|
+
|
101
77
|
|
102
78
|
Details
|
103
79
|
--------
|
@@ -111,7 +87,9 @@ bringing these requirements to my team, the product owner, and other stakeholder
|
|
111
87
|
|
112
88
|
Initially I tried to expose more of the functionality by providing freshly authored requirements through
|
113
89
|
email, attachments to JIRA tickets, or linked in wiki documents. None of these methods were very sustainable
|
114
|
-
or successful. First, I was continually pushing out the documents to those interested. Second, the documents
|
90
|
+
or successful. First, I was continually pushing out the documents to those interested. Second, the documents
|
91
|
+
were displayed to the user in text without the syntax highlighting that was exceedingly
|
92
|
+
helpful for quickly understanding the requirements.
|
115
93
|
|
116
94
|
I also found it hard to share the test framework that I had put together with another developer that joined
|
117
95
|
the team. It was difficult to direct them around the features, tags, step definitions, and transforms.
|
@@ -160,7 +138,6 @@ hooks that are tied to tags (unions and intersections) on the tag pages.
|
|
160
138
|
|
161
139
|
More work could be done to make this page more searchable, sortable, and usable.
|
162
140
|
|
163
|
-
|
164
141
|
**6. Table Step Transforms**
|
165
142
|
|
166
143
|
The table step transform matching would be nice to show which tables are affected by table transforms
|
@@ -0,0 +1,52 @@
|
|
1
|
+
@scenarios
|
2
|
+
Feature: Scenario
|
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: No Step Scenario
|
10
|
+
|
11
|
+
@second
|
12
|
+
Scenario: Scenario With Steps
|
13
|
+
Given this first step
|
14
|
+
When this second step
|
15
|
+
Then this third step
|
16
|
+
|
17
|
+
@third @optional_parameters
|
18
|
+
Scenario: Optional Parameter Step Definition
|
19
|
+
# This step definition has some optional parameters
|
20
|
+
Given a project
|
21
|
+
And an inactive project
|
22
|
+
And a project with the name 'optional', start date 10/26/2010, nicknamed 'norman'
|
23
|
+
|
24
|
+
@fourth @highlight
|
25
|
+
Scenario: Matched Term Highlighting
|
26
|
+
Given a duck that has a bill
|
27
|
+
Then I expect the duck to quack
|
28
|
+
|
29
|
+
@fifth @table
|
30
|
+
Scenario: Scenario With Table
|
31
|
+
Given the following table:
|
32
|
+
| column 1 | column 2 | column 3 |
|
33
|
+
| value 1 | value 2 | value 3 |
|
34
|
+
|
35
|
+
@sixth @text
|
36
|
+
Scenario: Scenario With Text
|
37
|
+
Given the following text:
|
38
|
+
"""
|
39
|
+
Oh what a bother!
|
40
|
+
"""
|
41
|
+
|
42
|
+
@seventh @comments
|
43
|
+
Scenario: Scenario with comments and
|
44
|
+
with multiple lines for the name
|
45
|
+
# First Comment
|
46
|
+
Given this first step
|
47
|
+
# Second Comment
|
48
|
+
And this second step
|
49
|
+
# Third Comment
|
50
|
+
And this third step
|
51
|
+
# Comments after the last step, where do they go?
|
52
|
+
|
@@ -0,0 +1,52 @@
|
|
1
|
+
@scenarios
|
2
|
+
Feature: Scenario
|
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: No Step Scenario
|
10
|
+
|
11
|
+
@second
|
12
|
+
Scenario: Scenario With Steps
|
13
|
+
Given this first step
|
14
|
+
When this second step
|
15
|
+
Then this third step
|
16
|
+
|
17
|
+
@third @optional_parameters
|
18
|
+
Scenario: Optional Parameter Step Definition
|
19
|
+
# This step definition has some optional parameters
|
20
|
+
Given a project
|
21
|
+
And an inactive project
|
22
|
+
And a project with the name 'optional', start date 10/26/2010, nicknamed 'norman'
|
23
|
+
|
24
|
+
@fourth @highlight
|
25
|
+
Scenario: Matched Term Highlighting
|
26
|
+
Given a duck that has a bill
|
27
|
+
Then I expect the duck to quack
|
28
|
+
|
29
|
+
@fifth @table
|
30
|
+
Scenario: Scenario With Table
|
31
|
+
Given the following table:
|
32
|
+
| column 1 | column 2 | column 3 |
|
33
|
+
| value 1 | value 2 | value 3 |
|
34
|
+
|
35
|
+
@sixth @text
|
36
|
+
Scenario: Scenario With Text
|
37
|
+
Given the following text:
|
38
|
+
"""
|
39
|
+
Oh what a bother!
|
40
|
+
"""
|
41
|
+
|
42
|
+
@seventh @comments
|
43
|
+
Scenario: Scenario with comments and
|
44
|
+
with multiple lines for the name
|
45
|
+
# First Comment
|
46
|
+
Given this first step
|
47
|
+
# Second Comment
|
48
|
+
And this second step
|
49
|
+
# Third Comment
|
50
|
+
And this third step
|
51
|
+
# Comments after the last step, where do they go?
|
52
|
+
|
@@ -0,0 +1,51 @@
|
|
1
|
+
@scenarios @bvt
|
2
|
+
Feature: Scenario
|
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: No Step Scenario
|
10
|
+
|
11
|
+
@second
|
12
|
+
Scenario: Scenario With Steps
|
13
|
+
Given this first step
|
14
|
+
When this second step
|
15
|
+
Then this third step
|
16
|
+
|
17
|
+
@third @optional_parameters
|
18
|
+
Scenario: Optional Parameter Step Definition
|
19
|
+
# This step definition has some optional parameters
|
20
|
+
Given a project
|
21
|
+
And an inactive project
|
22
|
+
And a project with the name 'optional', start date 10/26/2010, nicknamed 'norman'
|
23
|
+
|
24
|
+
@fourth @highlight
|
25
|
+
Scenario: Matched Term Highlighting
|
26
|
+
Given a duck that has a bill
|
27
|
+
Then I expect the duck to quack
|
28
|
+
|
29
|
+
@fifth @table
|
30
|
+
Scenario: Scenario With Table
|
31
|
+
Given the following table:
|
32
|
+
| column 1 | column 2 | column 3 |
|
33
|
+
| value 1 | value 2 | value 3 |
|
34
|
+
|
35
|
+
@sixth @text
|
36
|
+
Scenario: Scenario With Text
|
37
|
+
Given the following text:
|
38
|
+
"""
|
39
|
+
Oh what a bother!
|
40
|
+
"""
|
41
|
+
|
42
|
+
@seventh @comments
|
43
|
+
Scenario: Scenario with comments and
|
44
|
+
with multiple lines for the name
|
45
|
+
|
46
|
+
# First Comment
|
47
|
+
Given this first step
|
48
|
+
# Second Comment
|
49
|
+
And this second step
|
50
|
+
# Third Comment
|
51
|
+
And this third step
|
@@ -0,0 +1,60 @@
|
|
1
|
+
@scenario_outlines @bvt
|
2
|
+
Feature: Scenario Outline
|
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 |
|
@@ -1,6 +1,7 @@
|
|
1
|
-
CUSTOMER = /(?:(?:an?|the) customer|#{TEDDY_BEAR})/
|
2
1
|
|
3
|
-
|
2
|
+
Transform /^#{CUSTOMER}$/ do |customer|
|
3
|
+
"a transformed customer"
|
4
|
+
end
|
4
5
|
|
5
6
|
Transform /^an? customer$/ do |customer|
|
6
7
|
"a transformed customer"
|
@@ -10,6 +11,10 @@ Transform /^the customer$/ do |customer|
|
|
10
11
|
"the transformed customer"
|
11
12
|
end
|
12
13
|
|
14
|
+
Transform /^(#{ORDER}) customer$/ do |order|
|
15
|
+
"#{order} customer"
|
16
|
+
end
|
17
|
+
|
13
18
|
Transform /^#{TEDDY_BEAR}$/ do |teddy|
|
14
19
|
"the tranformed teddy bear"
|
15
20
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Transform /^#{ORDER}$/ do |order|
|
2
|
+
order
|
3
|
+
end
|
4
|
+
|
5
|
+
Transform /^background$/ do |background|
|
6
|
+
"background"
|
7
|
+
end
|
8
|
+
|
9
|
+
Transform /^scenario$/ do |scenario|
|
10
|
+
"scenario"
|
11
|
+
end
|
12
|
+
|
13
|
+
Given /^this (scenario|background|#{ORDER}) step$/ do |step|
|
14
|
+
pending "step #{order}"
|
15
|
+
end
|
@@ -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
|
data/lib/city.rb
CHANGED
@@ -6,7 +6,7 @@ require 'gherkin/formatter/tag_count_formatter'
|
|
6
6
|
require 'yard'
|
7
7
|
|
8
8
|
module CucumberInTheYARD
|
9
|
-
VERSION = '1.6.
|
9
|
+
VERSION = '1.6.3' unless defined?(CucumberInTheYARD::VERSION)
|
10
10
|
end
|
11
11
|
|
12
12
|
|
@@ -20,6 +20,7 @@ require File.dirname(__FILE__) + "/yard/code_objects/cucumber/tag.rb"
|
|
20
20
|
|
21
21
|
require File.dirname(__FILE__) + "/cucumber/city_builder.rb"
|
22
22
|
|
23
|
+
require File.dirname(__FILE__) + "/yard/code_objects/step_transformer.rb"
|
23
24
|
require File.dirname(__FILE__) + "/yard/code_objects/step_definition.rb"
|
24
25
|
require File.dirname(__FILE__) + "/yard/code_objects/step_transform.rb"
|
25
26
|
require File.dirname(__FILE__) + "/yard/code_objects/namespace_object.rb"
|
@@ -125,10 +125,15 @@ module Cucumber
|
|
125
125
|
s.keyword = step.keyword.dup
|
126
126
|
s.value = step.value.dup
|
127
127
|
s.add_file(@file,step.line_number)
|
128
|
+
|
129
|
+
s.text = step.text.dup if step.has_text?
|
130
|
+
s.table = clone_table(step.table) if step.has_table?
|
128
131
|
end
|
129
132
|
|
130
133
|
@step_container.example_values_for_row(row_index).each do |key,text|
|
131
134
|
step_instance.value.gsub!("<#{key}>",text)
|
135
|
+
step_instance.text.gsub!("<#{key}>",text) if step_instance.has_text?
|
136
|
+
step_instance.table.each{|row| row.each{|col| col.gsub!("<#{key}>",text)}} if step_instance.has_table?
|
132
137
|
end
|
133
138
|
|
134
139
|
step_instance.scenario = scenario
|
@@ -159,6 +164,7 @@ module Cucumber
|
|
159
164
|
when Gherkin::Formatter::Model::PyString
|
160
165
|
@table_owner.text = multiline_arg.value
|
161
166
|
when Array
|
167
|
+
#log.info "Matrix: #{matrix(multiline_arg).collect{|row| row.collect{|cell| cell.class } }.flatten.join("\n")}"
|
162
168
|
@table_owner.table = matrix(multiline_arg)
|
163
169
|
end
|
164
170
|
|
@@ -184,6 +190,10 @@ module Cucumber
|
|
184
190
|
row
|
185
191
|
end
|
186
192
|
end
|
193
|
+
|
194
|
+
def clone_table(base)
|
195
|
+
base.map {|row| row.map {|cell| cell.dup }}
|
196
|
+
end
|
187
197
|
end
|
188
198
|
end
|
189
199
|
end
|
@@ -1 +1 @@
|
|
1
|
-
<span>No Steps Defined</span>
|
1
|
+
<span class="none">No Steps Defined</span>
|
@@ -1,31 +1,38 @@
|
|
1
1
|
<% @scenario.scenarios.each_with_index do |scenario,example_index| %>
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
<div <%= "id='#{@id}Example#{example_index + 1}Step#{index}'" %> class="step <%= (index + 1) % 2 == 0 ? 'even' : 'odd' %>">
|
8
|
-
<span class="predicate"><%= step.keyword %></span>
|
9
|
-
|
10
|
-
<% if step.definition %>
|
11
|
-
<span class="defined">
|
12
|
-
<%= highlight_matches(step) %>
|
13
|
-
<div class="details">
|
14
|
-
<a href="<%= url_for step.definition %>">?</a>
|
15
|
-
</div>
|
16
|
-
</span>
|
17
|
-
<% else %>
|
18
|
-
<span class="undefined"><%= h step.value %></span>
|
19
|
-
<% end %>
|
20
|
-
|
21
|
-
</div>
|
2
|
+
<div id="<%= "#{@id}Example#{example_index + 1}Steps" %>" style="display: none;" class="steps">
|
3
|
+
<% scenario.steps.each_with_index do |step,index| %>
|
4
|
+
<% @step = step %>
|
22
5
|
|
23
|
-
<%= erb(:table) if step.has_table? %>
|
24
|
-
<%= erb(:pystring) if step.has_text? %>
|
25
6
|
|
7
|
+
<div <%= "id='#{@id}Example#{example_index + 1}Step#{index}'" %> class="step <%= (index + 1) % 2 == 0 ? 'even' : 'odd' %>">
|
8
|
+
<span class="predicate"><%= step.keyword %></span>
|
26
9
|
|
10
|
+
<% if step.definition %>
|
11
|
+
<span class="defined">
|
12
|
+
<%= highlight_matches(step) %>
|
13
|
+
<div class="details">
|
14
|
+
<a href="<%= url_for step.definition %>"><div class="valid"> </div></a>
|
15
|
+
</div>
|
16
|
+
</span>
|
17
|
+
<% else %>
|
18
|
+
<span class="undefined">
|
19
|
+
<%= h step.value %>
|
20
|
+
<div class="details">
|
21
|
+
<a href="<%= url_for YARD::CodeObjects::Cucumber::CUCUMBER_STEPTRANSFORM_NAMESPACE %>#undefined_steps">
|
22
|
+
<div class="invalid"> </div>
|
23
|
+
</a>
|
24
|
+
</div>
|
25
|
+
</span>
|
27
26
|
<% end %>
|
27
|
+
|
28
28
|
</div>
|
29
|
+
|
30
|
+
<%= erb(:table) if step.has_table? %>
|
31
|
+
<%= erb(:pystring) if step.has_text? %>
|
32
|
+
|
33
|
+
|
34
|
+
<% end %>
|
35
|
+
</div>
|
29
36
|
<% end %>
|
30
37
|
|
31
38
|
|
@@ -35,17 +42,17 @@
|
|
35
42
|
<thead>
|
36
43
|
<tr>
|
37
44
|
<% @scenario.example_headers.each_with_index do |header,header_index| %>
|
38
|
-
|
45
|
+
<th><%= h(header) %></th>
|
39
46
|
<% end %>
|
40
47
|
</tr>
|
41
48
|
</thead>
|
42
49
|
<% @scenario.example_data.each_with_index do |row,row_index| %>
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
50
|
+
<tr class="<%= (row_index + 1) % 2 == 0 ? 'even' : 'odd' %>"
|
51
|
+
onclick="<%= "toggleScenarioExample('#{@id}',#{row_index + 1});" %>">
|
52
|
+
<% row.each_with_index do |column,column_index| %>
|
53
|
+
<td><%= h(column.to_s.strip) %></td>
|
54
|
+
<% end %>
|
55
|
+
</tr>
|
49
56
|
<% end %>
|
50
57
|
</table>
|
51
58
|
</div>
|
@@ -34,7 +34,7 @@ $(function() {
|
|
34
34
|
<% end %>
|
35
35
|
|
36
36
|
<div id="<%= @id %>Steps" class="steps">
|
37
|
-
<%= @scenario.steps ? erb(:
|
37
|
+
<%= @scenario.steps.empty? ? erb(:no_steps_defined) : erb(:steps) %>
|
38
38
|
</div>
|
39
39
|
|
40
40
|
<%= erb(:outline) if @scenario.outline? %>
|
@@ -5,21 +5,33 @@
|
|
5
5
|
<div <%= "id='#{@id}Step#{index}'" %> class="step <%= (index + 1) % 2 == 0 ? 'even' : 'odd' %>">
|
6
6
|
<span class="predicate"><%= step.keyword %></span>
|
7
7
|
|
8
|
+
<% if @scenario.outline? %>
|
9
|
+
<%= step.value %>
|
10
|
+
<% else %>
|
11
|
+
|
8
12
|
<% if step.definition %>
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
<span class="defined">
|
14
|
+
<%= highlight_matches(step) %>
|
15
|
+
<div class="details">
|
16
|
+
<a href="<%= url_for step.definition %>"><div class="valid"> </div></a>
|
17
|
+
</div>
|
18
|
+
</span>
|
15
19
|
<% else %>
|
16
|
-
|
20
|
+
<span class="undefined">
|
21
|
+
<%= h step.value %>
|
22
|
+
<div class="details">
|
23
|
+
<a href="<%= url_for YARD::CodeObjects::Cucumber::CUCUMBER_STEPTRANSFORM_NAMESPACE %>#undefined_steps">
|
24
|
+
<div class="invalid"> </div>
|
25
|
+
</a>
|
26
|
+
</div>
|
27
|
+
</span>
|
17
28
|
<% end %>
|
18
29
|
|
30
|
+
<% end %>
|
19
31
|
</div>
|
20
32
|
|
21
33
|
<%= erb(:table) if step.has_table? %>
|
22
34
|
<%= erb(:pystring) if step.has_text? %>
|
23
35
|
|
24
36
|
|
25
|
-
<% end %>
|
37
|
+
<% end %>
|
@@ -1,20 +1,20 @@
|
|
1
1
|
<div class="multiline">
|
2
|
-
|
2
|
+
<table style="">
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
<thead>
|
5
|
+
<tr>
|
6
|
+
<% @step.table.first.each_with_index do |column,column_index| %>
|
7
|
+
<th class="<%= (column_index + 1) % 2 == 0 ? 'even' : 'odd' %>"><%= h(column.strip) %></th>
|
8
|
+
<% end %>
|
9
|
+
</tr>
|
10
|
+
</thead>
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
12
|
+
<% @step.table[1..-1].each_with_index do |row,row_index| %>
|
13
|
+
<tr class="<%= (row_index + 1) % 2 == 0 ? 'even' : 'odd' %>">
|
14
|
+
<% row.each_with_index do |column,column_index| %>
|
15
|
+
<td><%= h(column.strip) %></td>
|
16
|
+
<% end %>
|
17
|
+
</tr>
|
18
|
+
<% end %>
|
19
|
+
</table>
|
20
20
|
</div>
|
@@ -33,7 +33,7 @@ def highlight_matches(step)
|
|
33
33
|
value = h(step.value)
|
34
34
|
|
35
35
|
if step.definition
|
36
|
-
matches = step.value.match(
|
36
|
+
matches = step.value.match(step.definition.regex)
|
37
37
|
|
38
38
|
if matches
|
39
39
|
matches[1..-1].reverse.each_with_index do |match,index|
|