cuke_modeler 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +3 -0
  3. data/Gemfile +2 -1
  4. data/History.rdoc +9 -2
  5. data/Rakefile +10 -1
  6. data/cuke_modeler.gemspec +1 -1
  7. data/features/modeling/gherkin4/background_modeling.feature +64 -0
  8. data/features/modeling/gherkin4/background_output.feature +131 -0
  9. data/features/modeling/gherkin4/directory_modeling.feature +110 -0
  10. data/features/modeling/gherkin4/directory_output.feature +14 -0
  11. data/features/modeling/gherkin4/doc_string_modeling.feature +53 -0
  12. data/features/modeling/gherkin4/doc_string_output.feature +72 -0
  13. data/features/modeling/gherkin4/example_modeling.feature +100 -0
  14. data/features/modeling/gherkin4/example_output.feature +193 -0
  15. data/features/modeling/gherkin4/feature_file_modeling.feature +54 -0
  16. data/features/modeling/gherkin4/feature_file_output.feature +14 -0
  17. data/features/modeling/gherkin4/feature_modeling.feature +153 -0
  18. data/features/modeling/gherkin4/feature_output.feature +245 -0
  19. data/features/modeling/gherkin4/outline_modeling.feature +89 -0
  20. data/features/modeling/gherkin4/outline_output.feature +198 -0
  21. data/features/modeling/gherkin4/row_modeling.feature +68 -0
  22. data/features/modeling/gherkin4/row_output.feature +28 -0
  23. data/features/modeling/gherkin4/scenario_modeling.feature +78 -0
  24. data/features/modeling/gherkin4/scenario_output.feature +148 -0
  25. data/features/modeling/gherkin4/step_modeling.feature +75 -0
  26. data/features/modeling/gherkin4/step_output.feature +53 -0
  27. data/features/modeling/gherkin4/table_modeling.feature +42 -0
  28. data/features/modeling/gherkin4/table_output.feature +43 -0
  29. data/features/modeling/gherkin4/table_row_modeling.feature +57 -0
  30. data/features/modeling/gherkin4/table_row_output.feature +28 -0
  31. data/features/modeling/gherkin4/tag_modeling.feature +48 -0
  32. data/features/modeling/gherkin4/tag_output.feature +17 -0
  33. data/features/step_definitions/background_steps.rb +1 -1
  34. data/features/step_definitions/doc_string_steps.rb +1 -1
  35. data/features/step_definitions/feature_steps.rb +7 -4
  36. data/features/step_definitions/outline_steps.rb +2 -2
  37. data/features/step_definitions/step_steps.rb +2 -2
  38. data/features/step_definitions/table_steps.rb +1 -1
  39. data/features/step_definitions/tag_steps.rb +3 -3
  40. data/features/step_definitions/test_steps.rb +1 -1
  41. data/gemfiles/gherkin.gemfile +1 -0
  42. data/gemfiles/gherkin3.gemfile +2 -1
  43. data/gemfiles/gherkin4.gemfile +16 -0
  44. data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +220 -0
  45. data/lib/cuke_modeler/example.rb +1 -1
  46. data/lib/cuke_modeler/parsing.rb +73 -44
  47. data/lib/cuke_modeler/version.rb +1 -1
  48. data/spec/spec_helper.rb +10 -4
  49. data/spec/unit/background_unit_spec.rb +17 -9
  50. data/spec/unit/bare_bones_unit_specs.rb +3 -1
  51. data/spec/unit/containing_element_unit_specs.rb +3 -1
  52. data/spec/unit/directory_unit_spec.rb +5 -5
  53. data/spec/unit/doc_string_unit_spec.rb +13 -5
  54. data/spec/unit/example_unit_spec.rb +44 -9
  55. data/spec/unit/feature_element_unit_spec.rb +5 -5
  56. data/spec/unit/feature_element_unit_specs.rb +3 -1
  57. data/spec/unit/feature_file_unit_spec.rb +5 -5
  58. data/spec/unit/feature_unit_spec.rb +17 -9
  59. data/spec/unit/nested_element_unit_specs.rb +3 -1
  60. data/spec/unit/outline_unit_spec.rb +18 -10
  61. data/spec/unit/parsing_unit_spec.rb +2 -2
  62. data/spec/unit/prepopulated_unit_specs.rb +3 -1
  63. data/spec/unit/raw_element_unit_specs.rb +3 -1
  64. data/spec/unit/row_unit_spec.rb +15 -8
  65. data/spec/unit/scenario_unit_spec.rb +19 -11
  66. data/spec/unit/sourced_element_unit_specs.rb +3 -1
  67. data/spec/unit/step_unit_spec.rb +14 -6
  68. data/spec/unit/table_row_unit_spec.rb +15 -8
  69. data/spec/unit/table_unit_spec.rb +13 -5
  70. data/spec/unit/tag_unit_spec.rb +14 -6
  71. data/spec/unit/tagged_element_unit_specs.rb +3 -1
  72. data/spec/unit/test_element_unit_spec.rb +6 -6
  73. data/spec/unit/test_element_unit_specs.rb +3 -1
  74. metadata +86 -55
@@ -0,0 +1,245 @@
1
+ @gherkin4
2
+ Feature: Outputting feature elements
3
+
4
+ The output of an element model is a representation of the element as it would
5
+ appear in gherkin.
6
+
7
+
8
+ Scenario: Output of a feature that does not have a name
9
+ Given a feature element based on the following gherkin:
10
+ """
11
+ Feature:
12
+ """
13
+ When it is outputted
14
+ Then the following text is provided:
15
+ """
16
+ Feature:
17
+ """
18
+
19
+ Scenario: Output of a feature that does have a name
20
+ Given a feature element based on the following gherkin:
21
+ """
22
+ Feature: with a name
23
+ """
24
+ When it is outputted
25
+ Then the following text is provided:
26
+ """
27
+ Feature: with a name
28
+ """
29
+
30
+ Scenario: Output of a feature that has tags
31
+ Given a feature element based on the following gherkin:
32
+ """
33
+ @tag1@tag2
34
+ @tag3
35
+ Feature:
36
+ """
37
+ When it is outputted
38
+ Then the following text is provided:
39
+ """
40
+ @tag1 @tag2 @tag3
41
+ Feature:
42
+ """
43
+
44
+ Scenario: Output of a feature that has a description, no first line buffer
45
+ Given a feature element based on the following gherkin:
46
+ """
47
+ Feature:
48
+ Some description.
49
+ Some more description.
50
+ """
51
+ When it is outputted
52
+ Then the following text is provided:
53
+ """
54
+ Feature:
55
+
56
+ Some description.
57
+ Some more description.
58
+ """
59
+
60
+ Scenario: Output of a feature that has a description, first line is blank
61
+ Given a feature element based on the following gherkin:
62
+ """
63
+ Feature:
64
+
65
+ Some description.
66
+ Some more description.
67
+ """
68
+ When it is outputted
69
+ Then the following text is provided:
70
+ """
71
+ Feature:
72
+
73
+ Some description.
74
+ Some more description.
75
+ """
76
+
77
+ Scenario: Output of a feature that has a description, first line is only whitespace
78
+ Given a feature element based on the following gherkin:
79
+ """
80
+ Feature:
81
+
82
+ Some description.
83
+ Some more description.
84
+ """
85
+ When it is outputted
86
+ Then the following text is provided:
87
+ """
88
+ Feature:
89
+
90
+ Some description.
91
+ Some more description.
92
+ """
93
+
94
+ Scenario: Output of a feature that has a background
95
+ Given a feature element based on the following gherkin:
96
+ """
97
+ Feature:
98
+
99
+ Background:
100
+ * a step
101
+ * another step
102
+ """
103
+ When it is outputted
104
+ Then the following text is provided:
105
+ """
106
+ Feature:
107
+
108
+ Background:
109
+ * a step
110
+ * another step
111
+ """
112
+
113
+ Scenario: Output of a feature that has a scenario
114
+ Given a feature element based on the following gherkin:
115
+ """
116
+ Feature:
117
+
118
+ Scenario:
119
+ * a step
120
+ * another step
121
+ """
122
+ When it is outputted
123
+ Then the following text is provided:
124
+ """
125
+ Feature:
126
+
127
+ Scenario:
128
+ * a step
129
+ * another step
130
+ """
131
+
132
+ Scenario: Output of a feature that has an outline
133
+ Given a feature element based on the following gherkin:
134
+ """
135
+ Feature:
136
+
137
+ Scenario Outline:
138
+ * a step
139
+ * another step
140
+ Examples:
141
+ |param|
142
+ """
143
+ When it is outputted
144
+ Then the following text is provided:
145
+ """
146
+ Feature:
147
+
148
+ Scenario Outline:
149
+ * a step
150
+ * another step
151
+
152
+ Examples:
153
+ | param |
154
+ """
155
+
156
+ Scenario: Output of a feature that contains all possible parts
157
+ Given a feature element based on the following gherkin:
158
+ """
159
+ @tag1@tag2
160
+ @tag3
161
+ Feature: A feature with everything it could have
162
+ Including a description
163
+ and then some.
164
+ Background:
165
+ Background
166
+ description
167
+ * a step
168
+ |value1|
169
+ * another step
170
+ @scenario_tag
171
+ Scenario:
172
+ Scenario
173
+ description
174
+ * a step
175
+ * another step
176
+ \"\"\"
177
+ some text
178
+ \"\"\"
179
+ @outline_tag
180
+ Scenario Outline:
181
+ Outline
182
+ description
183
+ * a step
184
+ |value2|
185
+ * another step
186
+ \"\"\"
187
+ some text
188
+ \"\"\"
189
+ @example_tag
190
+ Examples:
191
+ Example
192
+ description
193
+ |param|
194
+ """
195
+ When it is outputted
196
+ Then the following text is provided:
197
+ """
198
+ @tag1 @tag2 @tag3
199
+ Feature: A feature with everything it could have
200
+
201
+ Including a description
202
+ and then some.
203
+
204
+ Background:
205
+
206
+ Background
207
+ description
208
+
209
+ * a step
210
+ | value1 |
211
+ * another step
212
+
213
+ @scenario_tag
214
+ Scenario:
215
+
216
+ Scenario
217
+ description
218
+
219
+ * a step
220
+ * another step
221
+ \"\"\"
222
+ some text
223
+ \"\"\"
224
+
225
+ @outline_tag
226
+ Scenario Outline:
227
+
228
+ Outline
229
+ description
230
+
231
+ * a step
232
+ | value2 |
233
+ * another step
234
+ \"\"\"
235
+ some text
236
+ \"\"\"
237
+
238
+ @example_tag
239
+ Examples:
240
+
241
+ Example
242
+ description
243
+
244
+ | param |
245
+ """
@@ -0,0 +1,89 @@
1
+ @gherkin4
2
+ Feature: Outline elements can be modeled.
3
+
4
+
5
+ Acceptance criteria
6
+
7
+ 1. All conceptual pieces of an outline can be modeled:
8
+ - the outline's name
9
+ - the outline's description
10
+ - the outline's steps
11
+ - the outline's tags
12
+ - the outline's applied tags
13
+ - the outline's example blocks
14
+ - the outline's source line
15
+ - the outline's raw element
16
+
17
+ 2. Outlines can be outputted in a convenient form
18
+
19
+
20
+ Background: Test file setup.
21
+ Given the following feature file:
22
+ """
23
+ @a_feature_level_tag
24
+ Feature:
25
+
26
+ @outline_tag
27
+ Scenario Outline: The scenario outline's name.
28
+
29
+ Some outline description.
30
+
31
+ Some more.
32
+ Even more.
33
+
34
+ Given a <setup> step
35
+ When an action step
36
+ Then a <verification> step
37
+
38
+ Examples: example 1
39
+ | setup | verification |
40
+ | x | y |
41
+ Examples: example 2
42
+ | setup | verification |
43
+ | a | b |
44
+ """
45
+ And parameter delimiters of "*" and "*"
46
+ When the file is read
47
+
48
+
49
+ Scenario: The raw outline element is modeled.
50
+ Then the test correctly stores its underlying implementation
51
+
52
+ Scenario: The outline source line is modeled.
53
+ Then the test is found to have the following properties:
54
+ | source_line | 5 |
55
+
56
+ Scenario: The outline name is modeled.
57
+ Then the test is found to have the following properties:
58
+ | name | The scenario outline's name. |
59
+
60
+ Scenario: The outline description is modeled.
61
+ Then the test has the following description:
62
+ """
63
+ Some outline description.
64
+
65
+ Some more.
66
+ Even more.
67
+ """
68
+
69
+ Scenario: The outline steps are modeled.
70
+ Then the test steps are as follows:
71
+ | a <setup> step |
72
+ | an action step |
73
+ | a <verification> step |
74
+
75
+ Scenario: The outline tags are modeled.
76
+ Then the test is found to have the following tags:
77
+ | @outline_tag |
78
+
79
+ Scenario: The outline applied tags are modeled.
80
+ Then the test is found to have the following applied tags:
81
+ | @a_feature_level_tag |
82
+
83
+ Scenario: The outline example blocks are modeled.
84
+ And the test example blocks are as follows:
85
+ | example 1 |
86
+ | example 2 |
87
+
88
+ Scenario: Convenient output of an an outline
89
+ Then the outline has convenient output
@@ -0,0 +1,198 @@
1
+ @gherkin4
2
+ Feature: Outputting outline elements
3
+
4
+ The output of an element model is a representation of the element as it would
5
+ appear in gherkin.
6
+
7
+
8
+ Scenario: Output of an outline that does not have a name
9
+ Given an outline element based on the following gherkin:
10
+ """
11
+ Scenario Outline:
12
+ """
13
+ When it is outputted
14
+ Then the following text is provided:
15
+ """
16
+ Scenario Outline:
17
+ """
18
+
19
+ Scenario: Output of an outline that does have a name
20
+ Given an outline element based on the following gherkin:
21
+ """
22
+ Scenario Outline: with a name
23
+ """
24
+ When it is outputted
25
+ Then the following text is provided:
26
+ """
27
+ Scenario Outline: with a name
28
+ """
29
+
30
+ Scenario: Output of an outline that does have tags
31
+ Given an outline element based on the following gherkin:
32
+ """
33
+ @tag1@tag2
34
+ @tag3
35
+ Scenario Outline:
36
+ """
37
+ When it is outputted
38
+ Then the following text is provided:
39
+ """
40
+ @tag1 @tag2 @tag3
41
+ Scenario Outline:
42
+ """
43
+
44
+ Scenario: Output of an outline that has a description, no first line buffer
45
+ Given an outline element based on the following gherkin:
46
+ """
47
+ Scenario Outline:
48
+ Some description.
49
+ Some more description.
50
+ """
51
+ When it is outputted
52
+ Then the following text is provided:
53
+ """
54
+ Scenario Outline:
55
+
56
+ Some description.
57
+ Some more description.
58
+ """
59
+
60
+ Scenario: Output of an outline that has a description, first line is blank
61
+ Given an outline element based on the following gherkin:
62
+ """
63
+ Scenario Outline:
64
+
65
+ Some description.
66
+ Some more description.
67
+ """
68
+ When it is outputted
69
+ Then the following text is provided:
70
+ """
71
+ Scenario Outline:
72
+
73
+ Some description.
74
+ Some more description.
75
+ """
76
+
77
+ Scenario: Output of an outline that has a description, first line is only whitespace
78
+ Given an outline element based on the following gherkin:
79
+ """
80
+ Scenario Outline:
81
+
82
+ Some description.
83
+ Some more description.
84
+ """
85
+ When it is outputted
86
+ Then the following text is provided:
87
+ """
88
+ Scenario Outline:
89
+
90
+ Some description.
91
+ Some more description.
92
+ """
93
+
94
+ Scenario: Output of an outline that has steps
95
+ Given an outline element based on the following gherkin:
96
+ """
97
+ Scenario Outline:
98
+ * a step
99
+ |value|
100
+ * another step
101
+ \"\"\"
102
+ some string
103
+ \"\"\"
104
+ """
105
+ When it is outputted
106
+ Then the following text is provided:
107
+ """
108
+ Scenario Outline:
109
+ * a step
110
+ | value |
111
+ * another step
112
+ \"\"\"
113
+ some string
114
+ \"\"\"
115
+ """
116
+
117
+ Scenario: Output of an outline that has examples
118
+ Given an outline element based on the following gherkin:
119
+ """
120
+ Scenario Outline:
121
+ * a <value> step
122
+ Examples:
123
+ | value |
124
+ | x |
125
+ @example_tag
126
+ Examples:
127
+ | value |
128
+ | y |
129
+ """
130
+ When it is outputted
131
+ Then the following text is provided:
132
+ """
133
+ Scenario Outline:
134
+ * a <value> step
135
+
136
+ Examples:
137
+ | value |
138
+ | x |
139
+
140
+ @example_tag
141
+ Examples:
142
+ | value |
143
+ | y |
144
+ """
145
+
146
+ Scenario: Output of an outline that contains all possible parts
147
+ Given an outline element based on the following gherkin:
148
+ """
149
+ @tag1@tag2
150
+ @tag3
151
+ Scenario Outline: An outline with everything it could have
152
+ Some description.
153
+ Some more description.
154
+ * a step
155
+ |value|
156
+ * a <value> step
157
+ \"\"\"
158
+ some string
159
+ \"\"\"
160
+ Examples:
161
+ Some description.
162
+ Some more description.
163
+ | value |
164
+ | x |
165
+ @example_tag
166
+ Examples:
167
+ | value |
168
+ | y |
169
+ """
170
+ When it is outputted
171
+ Then the following text is provided:
172
+ """
173
+ @tag1 @tag2 @tag3
174
+ Scenario Outline: An outline with everything it could have
175
+
176
+ Some description.
177
+ Some more description.
178
+
179
+ * a step
180
+ | value |
181
+ * a <value> step
182
+ \"\"\"
183
+ some string
184
+ \"\"\"
185
+
186
+ Examples:
187
+
188
+ Some description.
189
+ Some more description.
190
+
191
+ | value |
192
+ | x |
193
+
194
+ @example_tag
195
+ Examples:
196
+ | value |
197
+ | y |
198
+ """