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,68 @@
1
+ @gherkin3
2
+ Feature: Row elements can be modeled.
3
+
4
+
5
+ Acceptance criteria
6
+
7
+ 1. All conceptual pieces of a Row can be modeled:
8
+ - the row's source line
9
+ - the row's cells
10
+ - the row's raw element
11
+
12
+ 2. Rows can be outputted in a convenient form
13
+
14
+
15
+ Background: Test file setup.
16
+ Given the following feature file:
17
+ """
18
+ Feature:
19
+
20
+ Scenario Outline:
21
+ * a step
22
+ Examples:
23
+ | param1 | param2 | extra param |
24
+ | x | y | ? |
25
+ | 1 | 2 | 3 |
26
+ Examples:
27
+ | param1 |
28
+ | a |
29
+ """
30
+ And parameter delimiters of "*" and "*"
31
+ When the file is read
32
+
33
+
34
+ Scenario: The raw row element is modeled.
35
+ Then the test example block row correctly stores its underlying implementation
36
+
37
+ Scenario: The row's source line is modeled.
38
+ Then the test example block "1" row "1" is found to have the following properties:
39
+ | source_line | 6 |
40
+ And the test example block "1" row "2" is found to have the following properties:
41
+ | source_line | 7 |
42
+ And the test example block "1" row "3" is found to have the following properties:
43
+ | source_line | 8 |
44
+ And the test example block "2" row "1" is found to have the following properties:
45
+ | source_line | 10 |
46
+ And the test example block "2" row "2" is found to have the following properties:
47
+ | source_line | 11 |
48
+
49
+ Scenario: The row's cells are modeled.
50
+ Then the test example block "1" row "1" cells are as follows:
51
+ | param1 |
52
+ | param2 |
53
+ | extra param |
54
+ And the test example block "1" row "2" cells are as follows:
55
+ | x |
56
+ | y |
57
+ | ? |
58
+ And the test example block "1" row "3" cells are as follows:
59
+ | 1 |
60
+ | 2 |
61
+ | 3 |
62
+ And the test example block "2" row "1" cells are as follows:
63
+ | param1 |
64
+ And the test example block "2" row "2" cells are as follows:
65
+ | a |
66
+
67
+ Scenario: Convenient output of a row
68
+ Then the row has convenient output
@@ -0,0 +1,28 @@
1
+ @gherkin3
2
+ Feature: Outputting row 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 row that has one cell
9
+ Given a row element based on the following gherkin:
10
+ """
11
+ |value|
12
+ """
13
+ When it is outputted
14
+ Then the following text is provided:
15
+ """
16
+ | value |
17
+ """
18
+
19
+ Scenario: Output of a row that has multiple cells
20
+ Given a row element based on the following gherkin:
21
+ """
22
+ |value|another_value|
23
+ """
24
+ When it is outputted
25
+ Then the following text is provided:
26
+ """
27
+ | value | another_value |
28
+ """
@@ -0,0 +1,78 @@
1
+ @gherkin3
2
+ Feature: Scenario elements can be modeled.
3
+
4
+
5
+ Acceptance criteria
6
+
7
+ 1. All conceptual pieces of a scenario can be modeled:
8
+ - the scenario's name
9
+ - the scenario's description
10
+ - the scenario's steps
11
+ - the scenario's tags
12
+ - the scenario's applied tags
13
+ - the scenario's source line
14
+ - the scenario's raw element
15
+
16
+ 2. Scenarios can be outputted in a convenient form
17
+
18
+
19
+ Background: Test file setup.
20
+ Given the following feature file:
21
+ """
22
+ @a_feature_level_tag
23
+ Feature:
24
+
25
+ @a_tag
26
+ @another_tag
27
+ Scenario:The first scenario's name.
28
+
29
+ Some scenario 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
+ And parameter delimiters of "*" and "*"
39
+ When the file is read
40
+
41
+
42
+ Scenario: The raw scenario element is modeled.
43
+ Then the test correctly stores its underlying implementation
44
+
45
+ Scenario: The scenario source line is modeled.
46
+ Then the test is found to have the following properties:
47
+ | source_line | 6 |
48
+
49
+ Scenario: The scenario name is modeled.
50
+ Then the test is found to have the following properties:
51
+ | name | The first scenario's name. |
52
+
53
+ Scenario: The scenario description is modeled.
54
+ Then the test has the following description:
55
+ """
56
+ Some scenario description.
57
+
58
+ Some more.
59
+ Even more.
60
+ """
61
+
62
+ Scenario: The scenario steps are modeled.
63
+ Then the test steps are as follows:
64
+ | a setup step |
65
+ | an action step |
66
+ | a verification step |
67
+
68
+ Scenario: The scenario tags are modeled.
69
+ Then the test is found to have the following tags:
70
+ | @a_tag |
71
+ | @another_tag |
72
+
73
+ Scenario: The scenario applied tags are modeled.
74
+ Then the test is found to have the following applied tags:
75
+ | @a_feature_level_tag |
76
+
77
+ Scenario: Convenient output of a scenario
78
+ Then the scenario has convenient output
@@ -0,0 +1,148 @@
1
+ @gherkin3
2
+ Feature: Outputting scenario 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 scenario that does not have a name
9
+ Given a scenario element based on the following gherkin:
10
+ """
11
+ Scenario:
12
+ """
13
+ When it is outputted
14
+ Then the following text is provided:
15
+ """
16
+ Scenario:
17
+ """
18
+
19
+ Scenario: Output of a scenario that does have a name
20
+ Given a scenario element based on the following gherkin:
21
+ """
22
+ Scenario: with a name
23
+ """
24
+ When it is outputted
25
+ Then the following text is provided:
26
+ """
27
+ Scenario: with a name
28
+ """
29
+
30
+ Scenario: Output of a scenario that has tags
31
+ Given a scenario element based on the following gherkin:
32
+ """
33
+ @tag1@tag2
34
+ @tag3
35
+ Scenario:
36
+ """
37
+ When it is outputted
38
+ Then the following text is provided:
39
+ """
40
+ @tag1 @tag2 @tag3
41
+ Scenario:
42
+ """
43
+
44
+ Scenario: Output of a scenario that has a description, no first line buffer
45
+ Given a scenario element based on the following gherkin:
46
+ """
47
+ Scenario:
48
+ Some description.
49
+ Some more description.
50
+ """
51
+ When it is outputted
52
+ Then the following text is provided:
53
+ """
54
+ Scenario:
55
+
56
+ Some description.
57
+ Some more description.
58
+ """
59
+
60
+ Scenario: Output of a scenario that has a description, first line is blank
61
+ Given a scenario element based on the following gherkin:
62
+ """
63
+ Scenario:
64
+
65
+ Some description.
66
+ Some more description.
67
+ """
68
+ When it is outputted
69
+ Then the following text is provided:
70
+ """
71
+ Scenario:
72
+
73
+ Some description.
74
+ Some more description.
75
+ """
76
+
77
+ Scenario: Output of a scenario that has a description, first line is only whitespace
78
+ Given a scenario element based on the following gherkin:
79
+ """
80
+ Scenario:
81
+
82
+ Some description.
83
+ Some more description.
84
+ """
85
+ When it is outputted
86
+ Then the following text is provided:
87
+ """
88
+ Scenario:
89
+
90
+ Some description.
91
+ Some more description.
92
+ """
93
+
94
+ Scenario: Output of a scenario that has steps
95
+ Given a scenario element based on the following gherkin:
96
+ """
97
+ Scenario:
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:
109
+ * a step
110
+ | value |
111
+ * another step
112
+ \"\"\"
113
+ some string
114
+ \"\"\"
115
+ """
116
+
117
+ Scenario: Output of a scenario that contains all possible parts
118
+ Given a scenario element based on the following gherkin:
119
+ """
120
+ @tag1@tag2
121
+ @tag3
122
+ Scenario: A scenario with everything it could have
123
+ Including a description
124
+ and then some.
125
+
126
+ * a step
127
+ |value|
128
+ * another step
129
+ \"\"\"
130
+ some string
131
+ \"\"\"
132
+ """
133
+ When it is outputted
134
+ Then the following text is provided:
135
+ """
136
+ @tag1 @tag2 @tag3
137
+ Scenario: A scenario with everything it could have
138
+
139
+ Including a description
140
+ and then some.
141
+
142
+ * a step
143
+ | value |
144
+ * another step
145
+ \"\"\"
146
+ some string
147
+ \"\"\"
148
+ """
@@ -0,0 +1,75 @@
1
+ @gherkin3
2
+ Feature: Step elements can be modeled.
3
+
4
+
5
+ Acceptance criteria
6
+
7
+ 1. All conceptual pieces of a step can be modeled:
8
+ - the step's keyword
9
+ - the text of the step
10
+ - the step's arguments, if any
11
+ - the step's associated block, if any
12
+ - the step's source line
13
+ - the step's raw element
14
+
15
+ 2. Steps can be outputted in a convenient form
16
+
17
+
18
+ Background: Test file setup.
19
+ Given the following feature file:
20
+ """
21
+ Feature:
22
+
23
+ Scenario:
24
+ Given some setup step
25
+ And some big setup step:
26
+ \"\"\" content_type
27
+ some text
28
+ some more text
29
+ \"\"\"
30
+ When this *parameterized* step takes a table:
31
+ | data | a header |
32
+ | more data | a value |
33
+ Then a step with a *parameter*
34
+ """
35
+ And parameter delimiters of "*" and "*"
36
+ When the file is read
37
+
38
+
39
+ Scenario: The raw step element is modeled.
40
+ Then the test step correctly stores its underlying implementation
41
+
42
+ Scenario: The step's source line is modeled.
43
+ Then the test step "1" source line is "4"
44
+ And the test step "2" source line is "5"
45
+ And the test step "3" source line is "10"
46
+ And the test step "4" source line is "13"
47
+
48
+ Scenario: The step's keyword is modeled.
49
+ Then the test step "1" keyword is "Given"
50
+ And the test step "2" keyword is "And"
51
+ And the test step "3" keyword is "When"
52
+ And the test step "4" keyword is "Then"
53
+
54
+ Scenario: The text of the step is modeled.
55
+ Then test step "1" text is "some setup step"
56
+ And test step "2" text is "some big setup step:"
57
+ And test step "3" text is "this *parameterized* step takes a table:"
58
+ And test step "4" text is "a step with a *parameter*"
59
+
60
+ Scenario: The step's arguments are modeled.
61
+ Then test step "1" has no arguments
62
+ And test step "2" has no arguments
63
+ And test step "3" arguments are:
64
+ | parameterized |
65
+ And test step "4" arguments are:
66
+ | parameter |
67
+
68
+ Scenario: The steps's block is modeled.
69
+ Then step "1" has no block
70
+ Then step "2" has a "doc string"
71
+ And step "3" has a "table"
72
+ And step "4" has no block
73
+
74
+ Scenario: Convenient output of a step
75
+ Then the step has convenient output
@@ -0,0 +1,53 @@
1
+ @gherkin3
2
+ Feature: Outputting step 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 step without a block
9
+ Given a step element based on the following gherkin:
10
+ """
11
+ * a step
12
+ """
13
+ When it is outputted
14
+ Then the following text is provided:
15
+ """
16
+ * a step
17
+ """
18
+
19
+ Scenario: Output of a step with a doc string
20
+ Given a step element based on the following gherkin:
21
+ """
22
+ * a step
23
+ \"\"\"
24
+ Some text
25
+
26
+ some more text
27
+ \"\"\"
28
+ """
29
+ When it is outputted
30
+ Then the following text is provided:
31
+ """
32
+ * a step
33
+ \"\"\"
34
+ Some text
35
+
36
+ some more text
37
+ \"\"\"
38
+ """
39
+
40
+ Scenario: Output of a step with a table
41
+ Given a step element based on the following gherkin:
42
+ """
43
+ * a step
44
+ |value1|
45
+ |value2|
46
+ """
47
+ When it is outputted
48
+ Then the following text is provided:
49
+ """
50
+ * a step
51
+ | value1 |
52
+ | value2 |
53
+ """