cuke_modeler 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.simplecov +8 -0
  4. data/Gemfile +4 -0
  5. data/History.rdoc +3 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +73 -0
  8. data/Rakefile +38 -0
  9. data/cuke_modeler.gemspec +29 -0
  10. data/features/analysis/test_comparison.feature +123 -0
  11. data/features/analysis/test_manipulation.feature +37 -0
  12. data/features/modeling/background_modeling.feature +75 -0
  13. data/features/modeling/background_output.feature +130 -0
  14. data/features/modeling/directory_modeling.feature +120 -0
  15. data/features/modeling/directory_output.feature +13 -0
  16. data/features/modeling/doc_string_modeling.feature +63 -0
  17. data/features/modeling/doc_string_output.feature +71 -0
  18. data/features/modeling/example_modeling.feature +111 -0
  19. data/features/modeling/example_output.feature +192 -0
  20. data/features/modeling/feature_file_modeling.feature +64 -0
  21. data/features/modeling/feature_file_output.feature +13 -0
  22. data/features/modeling/feature_modeling.feature +164 -0
  23. data/features/modeling/feature_output.feature +244 -0
  24. data/features/modeling/outline_modeling.feature +100 -0
  25. data/features/modeling/outline_output.feature +197 -0
  26. data/features/modeling/row_modeling.feature +77 -0
  27. data/features/modeling/row_output.feature +27 -0
  28. data/features/modeling/scenario_modeling.feature +89 -0
  29. data/features/modeling/scenario_output.feature +147 -0
  30. data/features/modeling/step_modeling.feature +85 -0
  31. data/features/modeling/step_output.feature +52 -0
  32. data/features/modeling/table_modeling.feature +52 -0
  33. data/features/modeling/table_output.feature +42 -0
  34. data/features/modeling/table_row_modeling.feature +67 -0
  35. data/features/modeling/table_row_output.feature +27 -0
  36. data/features/modeling/tag_modeling.feature +58 -0
  37. data/features/modeling/tag_output.feature +16 -0
  38. data/features/step_definitions/action_steps.rb +3 -0
  39. data/features/step_definitions/background_steps.rb +81 -0
  40. data/features/step_definitions/directory_steps.rb +52 -0
  41. data/features/step_definitions/doc_string_steps.rb +63 -0
  42. data/features/step_definitions/feature_file_steps.rb +41 -0
  43. data/features/step_definitions/feature_steps.rb +96 -0
  44. data/features/step_definitions/outline_steps.rb +252 -0
  45. data/features/step_definitions/setup_steps.rb +50 -0
  46. data/features/step_definitions/spec_steps.rb +18 -0
  47. data/features/step_definitions/step_steps.rb +159 -0
  48. data/features/step_definitions/table_steps.rb +54 -0
  49. data/features/step_definitions/tag_steps.rb +61 -0
  50. data/features/step_definitions/test_steps.rb +114 -0
  51. data/features/step_definitions/verification_steps.rb +9 -0
  52. data/features/support/env.rb +27 -0
  53. data/features/support/transforms.rb +3 -0
  54. data/lib/cuke_modeler.rb +29 -0
  55. data/lib/cuke_modeler/background.rb +38 -0
  56. data/lib/cuke_modeler/containing.rb +18 -0
  57. data/lib/cuke_modeler/directory.rb +86 -0
  58. data/lib/cuke_modeler/doc_string.rb +87 -0
  59. data/lib/cuke_modeler/example.rb +184 -0
  60. data/lib/cuke_modeler/feature.rb +147 -0
  61. data/lib/cuke_modeler/feature_element.rb +73 -0
  62. data/lib/cuke_modeler/feature_file.rb +77 -0
  63. data/lib/cuke_modeler/nested.rb +34 -0
  64. data/lib/cuke_modeler/outline.rb +68 -0
  65. data/lib/cuke_modeler/parsing.rb +32 -0
  66. data/lib/cuke_modeler/raw.rb +20 -0
  67. data/lib/cuke_modeler/row.rb +64 -0
  68. data/lib/cuke_modeler/scenario.rb +45 -0
  69. data/lib/cuke_modeler/sourceable.rb +20 -0
  70. data/lib/cuke_modeler/step.rb +214 -0
  71. data/lib/cuke_modeler/table.rb +90 -0
  72. data/lib/cuke_modeler/table_row.rb +64 -0
  73. data/lib/cuke_modeler/tag.rb +62 -0
  74. data/lib/cuke_modeler/taggable.rb +54 -0
  75. data/lib/cuke_modeler/test_element.rb +77 -0
  76. data/lib/cuke_modeler/version.rb +3 -0
  77. data/lib/cuke_modeler/world.rb +113 -0
  78. data/spec/integration/background_integration_spec.rb +72 -0
  79. data/spec/integration/directory_integration_spec.rb +48 -0
  80. data/spec/integration/doc_string_integration_spec.rb +66 -0
  81. data/spec/integration/example_integration_spec.rb +94 -0
  82. data/spec/integration/feature_file_integration_spec.rb +44 -0
  83. data/spec/integration/feature_integration_spec.rb +152 -0
  84. data/spec/integration/outline_integration_spec.rb +92 -0
  85. data/spec/integration/scenario_integration_spec.rb +80 -0
  86. data/spec/integration/step_integration_spec.rb +184 -0
  87. data/spec/integration/table_integration_spec.rb +86 -0
  88. data/spec/integration/table_row_integration_spec.rb +68 -0
  89. data/spec/integration/tag_integration_spec.rb +67 -0
  90. data/spec/integration/world_integration_spec.rb +13 -0
  91. data/spec/spec_helper.rb +30 -0
  92. data/spec/unit/background_unit_spec.rb +55 -0
  93. data/spec/unit/bare_bones_unit_specs.rb +13 -0
  94. data/spec/unit/containing_element_unit_specs.rb +17 -0
  95. data/spec/unit/directory_unit_spec.rb +103 -0
  96. data/spec/unit/doc_string_unit_spec.rb +109 -0
  97. data/spec/unit/example_unit_spec.rb +251 -0
  98. data/spec/unit/feature_element_unit_spec.rb +19 -0
  99. data/spec/unit/feature_element_unit_specs.rb +46 -0
  100. data/spec/unit/feature_file_unit_spec.rb +94 -0
  101. data/spec/unit/feature_unit_spec.rb +135 -0
  102. data/spec/unit/nested_element_unit_specs.rb +36 -0
  103. data/spec/unit/nested_unit_spec.rb +37 -0
  104. data/spec/unit/outline_unit_spec.rb +91 -0
  105. data/spec/unit/parsing_unit_spec.rb +21 -0
  106. data/spec/unit/prepopulated_unit_specs.rb +13 -0
  107. data/spec/unit/raw_element_unit_specs.rb +24 -0
  108. data/spec/unit/raw_unit_spec.rb +25 -0
  109. data/spec/unit/row_unit_spec.rb +55 -0
  110. data/spec/unit/scenario_unit_spec.rb +71 -0
  111. data/spec/unit/sourceable_unit_spec.rb +17 -0
  112. data/spec/unit/sourced_element_unit_specs.rb +18 -0
  113. data/spec/unit/step_unit_spec.rb +259 -0
  114. data/spec/unit/table_row_unit_spec.rb +55 -0
  115. data/spec/unit/table_unit_spec.rb +96 -0
  116. data/spec/unit/tag_unit_spec.rb +51 -0
  117. data/spec/unit/taggable_unit_spec.rb +78 -0
  118. data/spec/unit/tagged_element_unit_specs.rb +63 -0
  119. data/spec/unit/test_element_unit_spec.rb +40 -0
  120. data/spec/unit/test_element_unit_specs.rb +31 -0
  121. data/spec/unit/world_unit_spec.rb +130 -0
  122. metadata +364 -0
@@ -0,0 +1,147 @@
1
+ Feature: Outputting scenario elements
2
+
3
+ The output of an element model is a representation of the element as it would
4
+ appear in gherkin.
5
+
6
+
7
+ Scenario: Output of a scenario that does not have a name
8
+ Given a scenario element based on the following gherkin:
9
+ """
10
+ Scenario:
11
+ """
12
+ When it is outputted
13
+ Then the following text is provided:
14
+ """
15
+ Scenario:
16
+ """
17
+
18
+ Scenario: Output of a scenario that does have a name
19
+ Given a scenario element based on the following gherkin:
20
+ """
21
+ Scenario: with a name
22
+ """
23
+ When it is outputted
24
+ Then the following text is provided:
25
+ """
26
+ Scenario: with a name
27
+ """
28
+
29
+ Scenario: Output of a scenario that has tags
30
+ Given a scenario element based on the following gherkin:
31
+ """
32
+ @tag1@tag2
33
+ @tag3
34
+ Scenario:
35
+ """
36
+ When it is outputted
37
+ Then the following text is provided:
38
+ """
39
+ @tag1 @tag2 @tag3
40
+ Scenario:
41
+ """
42
+
43
+ Scenario: Output of a scenario that has a description, no first line buffer
44
+ Given a scenario element based on the following gherkin:
45
+ """
46
+ Scenario:
47
+ Some description.
48
+ Some more description.
49
+ """
50
+ When it is outputted
51
+ Then the following text is provided:
52
+ """
53
+ Scenario:
54
+
55
+ Some description.
56
+ Some more description.
57
+ """
58
+
59
+ Scenario: Output of a scenario that has a description, first line is blank
60
+ Given a scenario element based on the following gherkin:
61
+ """
62
+ Scenario:
63
+
64
+ Some description.
65
+ Some more description.
66
+ """
67
+ When it is outputted
68
+ Then the following text is provided:
69
+ """
70
+ Scenario:
71
+
72
+ Some description.
73
+ Some more description.
74
+ """
75
+
76
+ Scenario: Output of a scenario that has a description, first line is only whitespace
77
+ Given a scenario element based on the following gherkin:
78
+ """
79
+ Scenario:
80
+
81
+ Some description.
82
+ Some more description.
83
+ """
84
+ When it is outputted
85
+ Then the following text is provided:
86
+ """
87
+ Scenario:
88
+
89
+ Some description.
90
+ Some more description.
91
+ """
92
+
93
+ Scenario: Output of a scenario that has steps
94
+ Given a scenario element based on the following gherkin:
95
+ """
96
+ Scenario:
97
+ * a step
98
+ |value|
99
+ * another step
100
+ \"\"\"
101
+ some string
102
+ \"\"\"
103
+ """
104
+ When it is outputted
105
+ Then the following text is provided:
106
+ """
107
+ Scenario:
108
+ * a step
109
+ | value |
110
+ * another step
111
+ \"\"\"
112
+ some string
113
+ \"\"\"
114
+ """
115
+
116
+ Scenario: Output of a scenario that contains all possible parts
117
+ Given a scenario element based on the following gherkin:
118
+ """
119
+ @tag1@tag2
120
+ @tag3
121
+ Scenario: A scenario with everything it could have
122
+ Including a description
123
+ and then some.
124
+
125
+ * a step
126
+ |value|
127
+ * another step
128
+ \"\"\"
129
+ some string
130
+ \"\"\"
131
+ """
132
+ When it is outputted
133
+ Then the following text is provided:
134
+ """
135
+ @tag1 @tag2 @tag3
136
+ Scenario: A scenario with everything it could have
137
+
138
+ Including a description
139
+ and then some.
140
+
141
+ * a step
142
+ | value |
143
+ * another step
144
+ \"\"\"
145
+ some string
146
+ \"\"\"
147
+ """
@@ -0,0 +1,85 @@
1
+ Feature: Step elements can be modeled.
2
+
3
+
4
+ Acceptance criteria
5
+
6
+ 1. All conceptual pieces of a step can be modeled:
7
+ - the step's keyword
8
+ - the text of the step
9
+ - the step's arguments, if any
10
+ - the step's associated block, if any
11
+ - the step's source line
12
+ - the step's raw element
13
+
14
+ 2. Steps can be outputted in a convenient form
15
+
16
+
17
+ Background: Test file setup.
18
+ Given the following feature file:
19
+ """
20
+ Feature:
21
+
22
+ Scenario:
23
+ Given some setup step
24
+ And some big setup step:
25
+ \"\"\" content_type
26
+ some text
27
+ some more text
28
+ \"\"\"
29
+ When this *parameterized* step takes a table:
30
+ | data | a header |
31
+ | more data | a value |
32
+ Then a step with a *parameter*
33
+ """
34
+ And parameter delimiters of "*" and "*"
35
+ When the file is read
36
+
37
+
38
+ Scenario: The raw step element is modeled.
39
+ Then the test step correctly stores its underlying implementation
40
+
41
+ Scenario: The step's source line is modeled.
42
+ Then the test step "1" source line is "4"
43
+ And the test step "2" source line is "5"
44
+ And the test step "3" source line is "10"
45
+ And the test step "4" source line is "13"
46
+
47
+ Scenario: The step's keyword is modeled.
48
+ Then the test step "1" keyword is "Given"
49
+ And the test step "2" keyword is "And"
50
+ And the test step "3" keyword is "When"
51
+ And the test step "4" keyword is "Then"
52
+
53
+ Scenario: The text of the step is modeled.
54
+ Then test step "1" text is "some setup step"
55
+ And test step "2" text is "some big setup step:"
56
+ And test step "3" text is "this *parameterized* step takes a table:"
57
+ And test step "4" text is "a step with a *parameter*"
58
+
59
+ Scenario: The step's arguments are modeled.
60
+ Then test step "1" has no arguments
61
+ And test step "2" has no arguments
62
+ And test step "3" arguments are:
63
+ | parameterized |
64
+ And test step "4" arguments are:
65
+ | parameter |
66
+
67
+ Scenario: The steps's block is modeled.
68
+ Then step "1" has no block
69
+ Then step "2" has a "doc string"
70
+ And step "3" has a "table"
71
+ And step "4" has no block
72
+
73
+ Scenario: Convenient output of a step
74
+ Then the step has convenient output
75
+
76
+ @redundant
77
+ Scenario Outline: Step models pass all other specifications
78
+ Exact specifications detailing the API for step models.
79
+ Given that there are "<additional specifications>" detailing models
80
+ When the corresponding specifications are run
81
+ Then all of those specifications are met
82
+ Examples:
83
+ | additional specifications |
84
+ | step_unit_spec.rb |
85
+ | step_integration_spec.rb |
@@ -0,0 +1,52 @@
1
+ Feature: Outputting step elements
2
+
3
+ The output of an element model is a representation of the element as it would
4
+ appear in gherkin.
5
+
6
+
7
+ Scenario: Output of a step without a block
8
+ Given a step element based on the following gherkin:
9
+ """
10
+ * a step
11
+ """
12
+ When it is outputted
13
+ Then the following text is provided:
14
+ """
15
+ * a step
16
+ """
17
+
18
+ Scenario: Output of a step with a doc string
19
+ Given a step element based on the following gherkin:
20
+ """
21
+ * a step
22
+ \"\"\"
23
+ Some text
24
+
25
+ some more text
26
+ \"\"\"
27
+ """
28
+ When it is outputted
29
+ Then the following text is provided:
30
+ """
31
+ * a step
32
+ \"\"\"
33
+ Some text
34
+
35
+ some more text
36
+ \"\"\"
37
+ """
38
+
39
+ Scenario: Output of a step with a table
40
+ Given a step element based on the following gherkin:
41
+ """
42
+ * a step
43
+ |value1|
44
+ |value2|
45
+ """
46
+ When it is outputted
47
+ Then the following text is provided:
48
+ """
49
+ * a step
50
+ | value1 |
51
+ | value2 |
52
+ """
@@ -0,0 +1,52 @@
1
+ Feature: Table elements can be modeled.
2
+
3
+
4
+ Acceptance criteria
5
+
6
+ 1. All conceptual pieces of a table can be modeled:
7
+ - the table's contents
8
+ - the table's raw element
9
+
10
+ 2. Tables can be outputted in a convenient form
11
+
12
+
13
+ Background: Test file setup.
14
+ Given the following feature file:
15
+ """
16
+ Feature:
17
+
18
+ Scenario:
19
+ * some data filled step:
20
+ | value 1 | value 2 |
21
+ | value 3 | value 4 |
22
+ * some data filled step:
23
+ | value 1 |
24
+ | value 2 |
25
+ """
26
+ When the file is read
27
+
28
+
29
+ Scenario: The table's contents are modeled.
30
+ Then the step "1" table has the following contents:
31
+ | value 1 | value 2 |
32
+ | value 3 | value 4 |
33
+ And the step "2" table has the following contents:
34
+ | value 1 |
35
+ | value 2 |
36
+
37
+ Scenario: The raw table element is modeled.
38
+ Then the table correctly stores its underlying implementation
39
+
40
+ Scenario: Convenient output of a table
41
+ Then the table has convenient output
42
+
43
+ @redundant
44
+ Scenario Outline: Table models pass all other specifications
45
+ Exact specifications detailing the API for table models.
46
+ Given that there are "<additional specifications>" detailing models
47
+ When the corresponding specifications are run
48
+ Then all of those specifications are met
49
+ Examples:
50
+ | additional specifications |
51
+ | table_unit_spec.rb |
52
+ | table_integration_spec.rb |
@@ -0,0 +1,42 @@
1
+ Feature: Outputting table elements
2
+
3
+ The output of an element model is a representation of the element as it would
4
+ appear in gherkin.
5
+
6
+
7
+ Scenario: Output of a table that has one row
8
+ Given a table element based on the following gherkin:
9
+ """
10
+ |value|
11
+ """
12
+ When it is outputted
13
+ Then the following text is provided:
14
+ """
15
+ | value |
16
+ """
17
+
18
+ Scenario: Output of a table that has multiple rows
19
+ Given a table element based on the following gherkin:
20
+ """
21
+ |value1|
22
+ |value2|
23
+ """
24
+ When it is outputted
25
+ Then the following text is provided:
26
+ """
27
+ | value1 |
28
+ | value2 |
29
+ """
30
+
31
+ Scenario: Whitespace buffers are based on the longest value in a column
32
+ Given a table element based on the following gherkin:
33
+ """
34
+ |value|x|
35
+ |y|another_value|
36
+ """
37
+ When it is outputted
38
+ Then the following text is provided:
39
+ """
40
+ | value | x |
41
+ | y | another_value |
42
+ """
@@ -0,0 +1,67 @@
1
+ Feature: Table Row elements can be modeled.
2
+
3
+
4
+ Acceptance criteria
5
+
6
+ 1. All conceptual pieces of a table row can be modeled:
7
+ - the row's source line
8
+ - the row's cells
9
+ - the row's raw element
10
+
11
+ 2. Rows can be outputted in a convenient form
12
+
13
+
14
+ Background: Test file setup.
15
+ Given the following feature file:
16
+ """
17
+ Feature:
18
+
19
+ Scenario:
20
+ * some data filled step:
21
+ | value 1 | value 2 |
22
+ | value 3 | value 4 |
23
+ * some data filled step:
24
+ | value 1 |
25
+ | value 2 |
26
+ """
27
+ When the file is read
28
+
29
+
30
+ Scenario: The raw table row element is modeled.
31
+ Then the step table row correctly stores its underlying implementation
32
+
33
+ Scenario: The table row's source line is modeled.
34
+ Then step "1" table row "1" is found to have the following properties:
35
+ | source_line | 5 |
36
+ And step "1" table row "2" is found to have the following properties:
37
+ | source_line | 6 |
38
+ And step "2" table row "1" is found to have the following properties:
39
+ | source_line | 8 |
40
+ And step "2" table row "2" is found to have the following properties:
41
+ | source_line | 9 |
42
+
43
+ Scenario: The table row's cells are modeled.
44
+ Then step "1" table row "1" cells are as follows:
45
+ | value 1 |
46
+ | value 2 |
47
+ And step "1" table row "2" cells are as follows:
48
+ | value 3 |
49
+ | value 4 |
50
+ And step "2" table row "1" cells are as follows:
51
+ | value 1 |
52
+ And step "2" table row "2" cells are as follows:
53
+ | value 2 |
54
+
55
+ Scenario: Convenient output of a table row
56
+ Then the table row has convenient output
57
+
58
+ @redundant
59
+ Scenario Outline: Table row models pass all other specifications
60
+ Exact specifications detailing the API for table table row models.
61
+ Given that there are "<additional specifications>" detailing models
62
+ When the corresponding specifications are run
63
+ Then all of those specifications are met
64
+ Examples:
65
+ | additional specifications |
66
+ | table_row_unit_spec.rb |
67
+ | table_row_integration_spec.rb |