cuke_modeler 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. data/.travis.yml +23 -0
  2. data/Gemfile +22 -4
  3. data/History.rdoc +6 -0
  4. data/Rakefile +26 -26
  5. data/cuke_modeler.gemspec +3 -1
  6. data/features/modeling/{background_modeling.feature → gherkin/background_modeling.feature} +1 -11
  7. data/features/modeling/{background_output.feature → gherkin/background_output.feature} +1 -0
  8. data/features/modeling/{directory_modeling.feature → gherkin/directory_modeling.feature} +1 -11
  9. data/features/modeling/{directory_output.feature → gherkin/directory_output.feature} +1 -0
  10. data/features/modeling/{doc_string_modeling.feature → gherkin/doc_string_modeling.feature} +1 -11
  11. data/features/modeling/{doc_string_output.feature → gherkin/doc_string_output.feature} +1 -0
  12. data/features/modeling/{example_modeling.feature → gherkin/example_modeling.feature} +1 -11
  13. data/features/modeling/{example_output.feature → gherkin/example_output.feature} +1 -0
  14. data/features/modeling/{feature_file_modeling.feature → gherkin/feature_file_modeling.feature} +1 -11
  15. data/features/modeling/{feature_file_output.feature → gherkin/feature_file_output.feature} +1 -0
  16. data/features/modeling/{feature_modeling.feature → gherkin/feature_modeling.feature} +1 -11
  17. data/features/modeling/{feature_output.feature → gherkin/feature_output.feature} +1 -0
  18. data/features/modeling/{outline_modeling.feature → gherkin/outline_modeling.feature} +1 -11
  19. data/features/modeling/{outline_output.feature → gherkin/outline_output.feature} +1 -0
  20. data/features/modeling/{row_modeling.feature → gherkin/row_modeling.feature} +1 -10
  21. data/features/modeling/{row_output.feature → gherkin/row_output.feature} +1 -0
  22. data/features/modeling/{scenario_modeling.feature → gherkin/scenario_modeling.feature} +1 -11
  23. data/features/modeling/{scenario_output.feature → gherkin/scenario_output.feature} +1 -0
  24. data/features/modeling/{step_modeling.feature → gherkin/step_modeling.feature} +1 -11
  25. data/features/modeling/{step_output.feature → gherkin/step_output.feature} +1 -0
  26. data/features/modeling/{table_modeling.feature → gherkin/table_modeling.feature} +1 -11
  27. data/features/modeling/{table_output.feature → gherkin/table_output.feature} +1 -0
  28. data/features/modeling/{table_row_modeling.feature → gherkin/table_row_modeling.feature} +1 -11
  29. data/features/modeling/{table_row_output.feature → gherkin/table_row_output.feature} +1 -0
  30. data/features/modeling/{tag_modeling.feature → gherkin/tag_modeling.feature} +1 -11
  31. data/features/modeling/{tag_output.feature → gherkin/tag_output.feature} +1 -0
  32. data/features/modeling/gherkin3/background_modeling.feature +64 -0
  33. data/features/modeling/gherkin3/background_output.feature +131 -0
  34. data/features/modeling/gherkin3/directory_modeling.feature +110 -0
  35. data/features/modeling/gherkin3/directory_output.feature +14 -0
  36. data/features/modeling/gherkin3/doc_string_modeling.feature +53 -0
  37. data/features/modeling/gherkin3/doc_string_output.feature +72 -0
  38. data/features/modeling/gherkin3/example_modeling.feature +100 -0
  39. data/features/modeling/gherkin3/example_output.feature +207 -0
  40. data/features/modeling/gherkin3/feature_file_modeling.feature +54 -0
  41. data/features/modeling/gherkin3/feature_file_output.feature +14 -0
  42. data/features/modeling/gherkin3/feature_modeling.feature +155 -0
  43. data/features/modeling/gherkin3/feature_output.feature +249 -0
  44. data/features/modeling/gherkin3/outline_modeling.feature +89 -0
  45. data/features/modeling/gherkin3/outline_output.feature +255 -0
  46. data/features/modeling/gherkin3/row_modeling.feature +68 -0
  47. data/features/modeling/gherkin3/row_output.feature +28 -0
  48. data/features/modeling/gherkin3/scenario_modeling.feature +78 -0
  49. data/features/modeling/gherkin3/scenario_output.feature +148 -0
  50. data/features/modeling/gherkin3/step_modeling.feature +75 -0
  51. data/features/modeling/gherkin3/step_output.feature +53 -0
  52. data/features/modeling/gherkin3/table_modeling.feature +42 -0
  53. data/features/modeling/gherkin3/table_output.feature +43 -0
  54. data/features/modeling/gherkin3/table_row_modeling.feature +57 -0
  55. data/features/modeling/gherkin3/table_row_output.feature +28 -0
  56. data/features/modeling/gherkin3/tag_modeling.feature +49 -0
  57. data/features/modeling/gherkin3/tag_output.feature +17 -0
  58. data/features/step_definitions/background_steps.rb +5 -1
  59. data/features/step_definitions/doc_string_steps.rb +5 -1
  60. data/features/step_definitions/feature_steps.rb +5 -1
  61. data/features/step_definitions/outline_steps.rb +10 -4
  62. data/features/step_definitions/step_steps.rb +10 -2
  63. data/features/step_definitions/table_steps.rb +6 -2
  64. data/features/step_definitions/tag_steps.rb +15 -3
  65. data/features/step_definitions/test_steps.rb +7 -2
  66. data/features/support/env.rb +21 -9
  67. data/gemfiles/gherkin.gemfile +17 -0
  68. data/gemfiles/gherkin3.gemfile +15 -0
  69. data/lib/cuke_modeler/adapters/gherkin_2_adapter.rb +146 -0
  70. data/lib/cuke_modeler/adapters/gherkin_3_adapter.rb +206 -0
  71. data/lib/cuke_modeler/parsing.rb +61 -20
  72. data/lib/cuke_modeler/raw.rb +1 -1
  73. data/lib/cuke_modeler/row.rb +2 -2
  74. data/lib/cuke_modeler/table.rb +2 -2
  75. data/lib/cuke_modeler/table_row.rb +1 -1
  76. data/lib/cuke_modeler/version.rb +1 -1
  77. data/spec/integration/example_integration_spec.rb +2 -1
  78. data/spec/integration/feature_integration_spec.rb +7 -4
  79. data/spec/integration/outline_integration_spec.rb +4 -2
  80. data/spec/integration/tag_integration_spec.rb +2 -1
  81. data/spec/spec_helper.rb +6 -0
  82. data/spec/unit/background_unit_spec.rb +17 -0
  83. data/spec/unit/doc_string_unit_spec.rb +17 -0
  84. data/spec/unit/example_unit_spec.rb +18 -1
  85. data/spec/unit/feature_file_unit_spec.rb +2 -2
  86. data/spec/unit/feature_unit_spec.rb +16 -0
  87. data/spec/unit/outline_unit_spec.rb +20 -1
  88. data/spec/unit/row_unit_spec.rb +18 -0
  89. data/spec/unit/scenario_unit_spec.rb +17 -0
  90. data/spec/unit/step_unit_spec.rb +17 -0
  91. data/spec/unit/table_row_unit_spec.rb +18 -0
  92. data/spec/unit/table_unit_spec.rb +16 -0
  93. data/spec/unit/tag_unit_spec.rb +17 -0
  94. metadata +147 -60
  95. data/features/step_definitions/spec_steps.rb +0 -18
@@ -0,0 +1,249 @@
1
+ @gherkin3
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
+ |value|
143
+ """
144
+ When it is outputted
145
+ Then the following text is provided:
146
+ """
147
+ Feature:
148
+
149
+ Scenario Outline:
150
+ * a step
151
+ * another step
152
+
153
+ Examples:
154
+ | param |
155
+ | value |
156
+ """
157
+
158
+ Scenario: Output of a feature that contains all possible parts
159
+ Given a feature element based on the following gherkin:
160
+ """
161
+ @tag1@tag2
162
+ @tag3
163
+ Feature: A feature with everything it could have
164
+ Including a description
165
+ and then some.
166
+ Background:
167
+ Background
168
+ description
169
+ * a step
170
+ |value1|
171
+ * another step
172
+ @scenario_tag
173
+ Scenario:
174
+ Scenario
175
+ description
176
+ * a step
177
+ * another step
178
+ \"\"\"
179
+ some text
180
+ \"\"\"
181
+ @outline_tag
182
+ Scenario Outline:
183
+ Outline
184
+ description
185
+ * a step
186
+ |value2|
187
+ * another step
188
+ \"\"\"
189
+ some text
190
+ \"\"\"
191
+ @example_tag
192
+ Examples:
193
+ Example
194
+ description
195
+ |param|
196
+ |value|
197
+ """
198
+ When it is outputted
199
+ Then the following text is provided:
200
+ """
201
+ @tag1 @tag2 @tag3
202
+ Feature: A feature with everything it could have
203
+
204
+ Including a description
205
+ and then some.
206
+
207
+ Background:
208
+
209
+ Background
210
+ description
211
+
212
+ * a step
213
+ | value1 |
214
+ * another step
215
+
216
+ @scenario_tag
217
+ Scenario:
218
+
219
+ Scenario
220
+ description
221
+
222
+ * a step
223
+ * another step
224
+ \"\"\"
225
+ some text
226
+ \"\"\"
227
+
228
+ @outline_tag
229
+ Scenario Outline:
230
+
231
+ Outline
232
+ description
233
+
234
+ * a step
235
+ | value2 |
236
+ * another step
237
+ \"\"\"
238
+ some text
239
+ \"\"\"
240
+
241
+ @example_tag
242
+ Examples:
243
+
244
+ Example
245
+ description
246
+
247
+ | param |
248
+ | value |
249
+ """
@@ -0,0 +1,89 @@
1
+ @gherkin3
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,255 @@
1
+ @gherkin3
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
+ Examples:
13
+ | param |
14
+ | y |
15
+ """
16
+ When it is outputted
17
+ Then the following text is provided:
18
+ """
19
+ Scenario Outline:
20
+
21
+ Examples:
22
+ | param |
23
+ | y |
24
+ """
25
+
26
+ Scenario: Output of an outline that does have a name
27
+ Given an outline element based on the following gherkin:
28
+ """
29
+ Scenario Outline: with a name
30
+
31
+ Examples:
32
+ | param |
33
+ | y |
34
+ """
35
+ When it is outputted
36
+ Then the following text is provided:
37
+ """
38
+ Scenario Outline: with a name
39
+
40
+ Examples:
41
+ | param |
42
+ | y |
43
+ """
44
+
45
+ Scenario: Output of an outline that does have tags
46
+ Given an outline element based on the following gherkin:
47
+ """
48
+ @tag1@tag2
49
+ @tag3
50
+ Scenario Outline:
51
+
52
+ Examples:
53
+ | param |
54
+ | y |
55
+ """
56
+ When it is outputted
57
+ Then the following text is provided:
58
+ """
59
+ @tag1 @tag2 @tag3
60
+ Scenario Outline:
61
+
62
+ Examples:
63
+ | param |
64
+ | y |
65
+ """
66
+
67
+ Scenario: Output of an outline that has a description, no first line buffer
68
+ Given an outline element based on the following gherkin:
69
+ """
70
+ Scenario Outline:
71
+ Some description.
72
+ Some more description.
73
+
74
+ Examples:
75
+ | param |
76
+ | y |
77
+ """
78
+ When it is outputted
79
+ Then the following text is provided:
80
+ """
81
+ Scenario Outline:
82
+
83
+ Some description.
84
+ Some more description.
85
+
86
+ Examples:
87
+ | param |
88
+ | y |
89
+ """
90
+
91
+ Scenario: Output of an outline that has a description, first line is blank
92
+ Given an outline element based on the following gherkin:
93
+ """
94
+ Scenario Outline:
95
+
96
+ Some description.
97
+ Some more description.
98
+
99
+
100
+ Examples:
101
+ | param |
102
+ | y |
103
+ """
104
+ When it is outputted
105
+ Then the following text is provided:
106
+ """
107
+ Scenario Outline:
108
+
109
+ Some description.
110
+ Some more description.
111
+
112
+ Examples:
113
+ | param |
114
+ | y |
115
+ """
116
+
117
+ Scenario: Output of an outline that has a description, first line is only whitespace
118
+ Given an outline element based on the following gherkin:
119
+ """
120
+ Scenario Outline:
121
+
122
+ Some description.
123
+ Some more description.
124
+
125
+
126
+ Examples:
127
+ | param |
128
+ | y |
129
+ """
130
+ When it is outputted
131
+ Then the following text is provided:
132
+ """
133
+ Scenario Outline:
134
+
135
+ Some description.
136
+ Some more description.
137
+
138
+ Examples:
139
+ | param |
140
+ | y |
141
+ """
142
+
143
+ Scenario: Output of an outline that has steps
144
+ Given an outline element based on the following gherkin:
145
+ """
146
+ Scenario Outline:
147
+ * a step
148
+ |value|
149
+ * another step
150
+ \"\"\"
151
+ some string
152
+ \"\"\"
153
+
154
+ Examples:
155
+ | param |
156
+ | y |
157
+ """
158
+ When it is outputted
159
+ Then the following text is provided:
160
+ """
161
+ Scenario Outline:
162
+ * a step
163
+ | value |
164
+ * another step
165
+ \"\"\"
166
+ some string
167
+ \"\"\"
168
+
169
+ Examples:
170
+ | param |
171
+ | y |
172
+ """
173
+
174
+ Scenario: Output of an outline that has examples
175
+ Given an outline element based on the following gherkin:
176
+ """
177
+ Scenario Outline:
178
+ * a <value> step
179
+ Examples:
180
+ | value |
181
+ | x |
182
+ @example_tag
183
+ Examples:
184
+ | value |
185
+ | y |
186
+ """
187
+ When it is outputted
188
+ Then the following text is provided:
189
+ """
190
+ Scenario Outline:
191
+ * a <value> step
192
+
193
+ Examples:
194
+ | value |
195
+ | x |
196
+
197
+ @example_tag
198
+ Examples:
199
+ | value |
200
+ | y |
201
+ """
202
+
203
+ Scenario: Output of an outline that contains all possible parts
204
+ Given an outline element based on the following gherkin:
205
+ """
206
+ @tag1@tag2
207
+ @tag3
208
+ Scenario Outline: An outline with everything it could have
209
+ Some description.
210
+ Some more description.
211
+ * a step
212
+ |value|
213
+ * a <value> step
214
+ \"\"\"
215
+ some string
216
+ \"\"\"
217
+ Examples:
218
+ Some description.
219
+ Some more description.
220
+ | value |
221
+ | x |
222
+ @example_tag
223
+ Examples:
224
+ | value |
225
+ | y |
226
+ """
227
+ When it is outputted
228
+ Then the following text is provided:
229
+ """
230
+ @tag1 @tag2 @tag3
231
+ Scenario Outline: An outline with everything it could have
232
+
233
+ Some description.
234
+ Some more description.
235
+
236
+ * a step
237
+ | value |
238
+ * a <value> step
239
+ \"\"\"
240
+ some string
241
+ \"\"\"
242
+
243
+ Examples:
244
+
245
+ Some description.
246
+ Some more description.
247
+
248
+ | value |
249
+ | x |
250
+
251
+ @example_tag
252
+ Examples:
253
+ | value |
254
+ | y |
255
+ """