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,130 @@
1
+ Feature: Outputting background 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 background that does not have a name
8
+ Given a background element based on the following gherkin:
9
+ """
10
+ Background:
11
+ """
12
+ When it is outputted
13
+ Then the following text is provided:
14
+ """
15
+ Background:
16
+ """
17
+
18
+ Scenario: Output of a background that does have a name
19
+ Given a background element based on the following gherkin:
20
+ """
21
+ Background: with a name
22
+ """
23
+ When it is outputted
24
+ Then the following text is provided:
25
+ """
26
+ Background: with a name
27
+ """
28
+
29
+ Scenario: Output of a background that has a description, no first line buffer
30
+ Given a background element based on the following gherkin:
31
+ """
32
+ Background:
33
+ Some description.
34
+ Some more description.
35
+ """
36
+ When it is outputted
37
+ Then the following text is provided:
38
+ """
39
+ Background:
40
+
41
+ Some description.
42
+ Some more description.
43
+ """
44
+
45
+ Scenario: Output of a background that has a description, first line is blank
46
+ Given a background element based on the following gherkin:
47
+ """
48
+ Background:
49
+
50
+ Some description.
51
+ Some more description.
52
+ """
53
+ When it is outputted
54
+ Then the following text is provided:
55
+ """
56
+ Background:
57
+
58
+ Some description.
59
+ Some more description.
60
+ """
61
+
62
+ Scenario: Output of a background that has a description, first line is only whitespace
63
+ Given a background element based on the following gherkin:
64
+ """
65
+ Background:
66
+
67
+ Some description.
68
+ Some more description.
69
+ """
70
+ When it is outputted
71
+ Then the following text is provided:
72
+ """
73
+ Background:
74
+
75
+ Some description.
76
+ Some more description.
77
+ """
78
+
79
+ Scenario: Output of a background that has steps
80
+ Given a background element based on the following gherkin:
81
+ """
82
+ Background:
83
+ * a step
84
+ |value|
85
+ * another step
86
+ \"\"\"
87
+ some string
88
+ \"\"\"
89
+ """
90
+ When it is outputted
91
+ Then the following text is provided:
92
+ """
93
+ Background:
94
+ * a step
95
+ | value |
96
+ * another step
97
+ \"\"\"
98
+ some string
99
+ \"\"\"
100
+ """
101
+
102
+ Scenario: Output of a background that contains all possible parts
103
+ Given a background element based on the following gherkin:
104
+ """
105
+ Background: A background with everything it could have
106
+ Including a description
107
+ and then some.
108
+
109
+ * a step
110
+ |value|
111
+ * another step
112
+ \"\"\"
113
+ some string
114
+ \"\"\"
115
+ """
116
+ When it is outputted
117
+ Then the following text is provided:
118
+ """
119
+ Background: A background with everything it could have
120
+
121
+ Including a description
122
+ and then some.
123
+
124
+ * a step
125
+ | value |
126
+ * another step
127
+ \"\"\"
128
+ some string
129
+ \"\"\"
130
+ """
@@ -0,0 +1,120 @@
1
+ Feature: Directories can be modeled.
2
+
3
+
4
+ Acceptance criteria
5
+
6
+ 1. Directories containing feature files can be modeled:
7
+ - the directory's name
8
+ - the directory's full path
9
+ - all feature files contained
10
+ - all directories contained
11
+
12
+ 2. Directories can be outputted in a convenient form
13
+
14
+
15
+ Background: Setup test directories
16
+ Given a directory "feature_directory"
17
+ And the following feature file "test_file_1.feature":
18
+ """
19
+ Feature: The test feature 1.
20
+
21
+ Scenario: The first scenario's name.
22
+ Given the first step
23
+ When the second step
24
+ Then the third step
25
+ """
26
+ And the following feature file "test_file_2.feature":
27
+ """
28
+ Feature: The test feature 2.
29
+
30
+ Scenario: The first scenario's name.
31
+ Given the first step
32
+ When the second step
33
+ Then the third step
34
+ """
35
+ And the following feature file "test_file_3.feature":
36
+ """
37
+ Feature: The test feature 3.
38
+
39
+ Scenario: The first scenario's name.
40
+ Given the first step
41
+ When the second step
42
+ Then the third step
43
+ """
44
+ And the following file "random.file":
45
+ """
46
+ Not a .feature file.
47
+ """
48
+ Given a directory "feature_directory/nested_directory"
49
+ And the following feature file "test_file_4.feature":
50
+ """
51
+ Feature: The test feature 1.
52
+
53
+ Scenario: The first scenario's name.
54
+ Given the first step
55
+ When the second step
56
+ Then the third step
57
+ """
58
+ And the following feature file "test_file_5.feature":
59
+ """
60
+ Feature: The test feature 2.
61
+
62
+ Scenario: The first scenario's name.
63
+ Given the first step
64
+ When the second step
65
+ Then the third step
66
+ """
67
+ And the following file "another_random.file":
68
+ """
69
+ Not a .feature file.
70
+ """
71
+ When the directory "feature_directory" is read
72
+ And the directory "feature_directory/nested_directory" is read
73
+
74
+ Scenario: The directory's name is modeled.
75
+ Then directory "1" is found to have the following properties:
76
+ | name | feature_directory |
77
+ And directory "2" is found to have the following properties:
78
+ | name | nested_directory |
79
+
80
+ Scenario: The directory's full path is modeled.
81
+ Then directory "1" is found to have the following properties:
82
+ | path | path_to/feature_directory |
83
+ And directory "2" is found to have the following properties:
84
+ | path | path_to/feature_directory/nested_directory |
85
+
86
+ Scenario: The directory's feature files are modeled.
87
+ Then directory "1" is found to have the following properties:
88
+ | feature_file_count | 3 |
89
+ And directory "1" feature files are as follows:
90
+ | test_file_1.feature |
91
+ | test_file_2.feature |
92
+ | test_file_3.feature |
93
+ Then directory "2" is found to have the following properties:
94
+ | feature_file_count | 2 |
95
+ And directory "2" feature files are as follows:
96
+ | test_file_4.feature |
97
+ | test_file_5.feature |
98
+
99
+ Scenario: The directory's directories are modeled.
100
+ Then directory "1" is found to have the following properties:
101
+ | directory_count | 1 |
102
+ And directory "1" directories are as follows:
103
+ | nested_directory |
104
+ Then directory "2" is found to have the following properties:
105
+ | directory_count | 0 |
106
+ And directory "2" has no directories
107
+
108
+ Scenario: Convenient output of a directory
109
+ Then the directory has convenient output
110
+
111
+ @redundant
112
+ Scenario Outline: Directory models pass all other specifications
113
+ Exact specifications detailing the API for directory models.
114
+ Given that there are "<additional specifications>" detailing models
115
+ When the corresponding specifications are run
116
+ Then all of those specifications are met
117
+ Examples:
118
+ | additional specifications |
119
+ | directory_unit_spec.rb |
120
+ | directory_integration_spec.rb |
@@ -0,0 +1,13 @@
1
+ Feature: Outputting directory 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 directory
8
+ Given a directory element based on "some_directory"
9
+ When it is outputted
10
+ Then the following text is provided:
11
+ """
12
+ path_to/some_directory
13
+ """
@@ -0,0 +1,63 @@
1
+ Feature: Doc string elements can be modeled.
2
+
3
+
4
+ Acceptance criteria
5
+
6
+ 1. All conceptual pieces of a doc string can be modeled:
7
+ - the doc string's content type
8
+ - the doc string's contents
9
+ - the doc string's raw element
10
+
11
+ 2. Doc string 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 wordy step:
21
+ \"\"\" content type
22
+ some text
23
+
24
+ some more text
25
+
26
+ \"\"\"
27
+ * some wordy step:
28
+ \"\"\"
29
+ \"\"\"
30
+ """
31
+ When the file is read
32
+
33
+
34
+ Scenario: The raw doc string element is modeled.
35
+ Then the doc string correctly stores its underlying implementation
36
+
37
+ Scenario: The doc string's content type is modeled.
38
+ Then the step "1" doc string content type is "content type"
39
+ And the step "2" doc string has no content type
40
+
41
+ Scenario: The doc string's contents are modeled.
42
+ Then the step "1" doc string has the following contents:
43
+ """
44
+ some text
45
+
46
+ some more text
47
+
48
+ """
49
+ And the step "2" doc string contents are empty
50
+
51
+ Scenario: Convenient output of an a doc string
52
+ Then the doc string has convenient output
53
+
54
+ @redundant
55
+ Scenario Outline: Doc string models pass all other specifications
56
+ Exact specifications detailing the API for doc string models.
57
+ Given that there are "<additional specifications>" detailing models
58
+ When the corresponding specifications are run
59
+ Then all of those specifications are met
60
+ Examples:
61
+ | additional specifications |
62
+ | doc_string_unit_spec.rb |
63
+ | doc_string_integration_spec.rb |
@@ -0,0 +1,71 @@
1
+ Feature: Outputting doc string 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 an empty doc string
8
+ Given a doc string element based on the following gherkin:
9
+ """
10
+ \"\"\"
11
+ \"\"\"
12
+ """
13
+ When it is outputted
14
+ Then the following text is provided:
15
+ """
16
+ \"\"\"
17
+ \"\"\"
18
+ """
19
+
20
+ Scenario: Output of a doc string without a content type
21
+ Given a doc string element based on the following gherkin:
22
+ """
23
+ \"\"\"
24
+ Some text
25
+
26
+ some more text
27
+
28
+ \"\"\"
29
+ """
30
+ When it is outputted
31
+ Then the following text is provided:
32
+ """
33
+ \"\"\"
34
+ Some text
35
+
36
+ some more text
37
+
38
+ \"\"\"
39
+ """
40
+
41
+ Scenario: Output of a doc string with a content type
42
+ Given a doc string element based on the following gherkin:
43
+ """
44
+ \"\"\" the type
45
+ Some text
46
+
47
+ some more text
48
+
49
+ \"\"\"
50
+ """
51
+ When it is outputted
52
+ Then the following text is provided:
53
+ """
54
+ \"\"\" the type
55
+ Some text
56
+
57
+ some more text
58
+
59
+ \"\"\"
60
+ """
61
+
62
+ Scenario: Output of a doc string with a triple quotes in its contents
63
+
64
+ Since triple quotes mark the beginning and end of a doc string, any triple
65
+ quotes inside of the doc string (which would have had to have been escaped
66
+ to get inside in the first place) will be escaped when outputted so as to
67
+ retain the quality of being able to use the output directly as gherkin.
68
+
69
+ Given a doc string element based on the string """" the type\n* a step\n \"\"\"\n that also has a doc string\n \"\"\"\n""""
70
+ When it is outputted
71
+ Then the text provided is """" the type\n* a step\n \"\"\"\n that also has a doc string\n \"\"\"\n""""
@@ -0,0 +1,111 @@
1
+ Feature: Example elements can be modeled.
2
+
3
+
4
+ Acceptance criteria
5
+
6
+ 1. All conceptual pieces of an example block can be modeled:
7
+ - the example's name
8
+ - the example's description
9
+ - the example's parameters
10
+ - the example's rows
11
+ - the example's tags
12
+ - the example's applied tags
13
+ - the example's source line
14
+ - the example's raw element
15
+
16
+ 2. Example blocks 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
+ @outline_tag
26
+ Scenario Outline:
27
+ * a step
28
+
29
+ Examples: text describing the significance of the examples
30
+
31
+ Some example description.
32
+
33
+ Some more.
34
+ Even more.
35
+ |param1| param2 | extra param |
36
+ |x | y | ? |
37
+ |1 | 2 | 3 |
38
+ @example_tag @another_one
39
+ Examples: some examples with different significance and a tag
40
+ | param1 |
41
+ | a |
42
+ """
43
+ And parameter delimiters of "*" and "*"
44
+ When the file is read
45
+
46
+
47
+ Scenario: The raw example element is modeled.
48
+ Then the test example block correctly stores its underlying implementation
49
+
50
+ Scenario: The example's source line is modeled.
51
+ Then the test example block "1" is found to have the following properties:
52
+ | source_line | 8 |
53
+ And the test example block "2" is found to have the following properties:
54
+ | source_line | 18 |
55
+
56
+ Scenario: The examples' name is modeled.
57
+ Then the test example block "1" is found to have the following properties:
58
+ | name | text describing the significance of the examples |
59
+ And the test example block "2" is found to have the following properties:
60
+ | name | some examples with different significance and a tag |
61
+
62
+ Scenario: The examples' description is modeled.
63
+ Then the test example block "1" has the following description:
64
+ """
65
+
66
+ Some example description.
67
+
68
+ Some more.
69
+ Even more.
70
+ """
71
+ And the test example block "2" has no description
72
+
73
+ Scenario: The examples' tags are modeled.
74
+ Then the test example block "1" has no tags
75
+ And the test example block "2" is found to have the following tags:
76
+ | @example_tag |
77
+ | @another_one |
78
+
79
+ Scenario: The examples' applied tags are modeled.
80
+ Then the test example block "2" is found to have the following applied tags:
81
+ | @a_feature_level_tag |
82
+ | @outline_tag |
83
+
84
+ Scenario: The examples' parameters are modeled.
85
+ Then the test example block "1" parameters are as follows:
86
+ | param1 |
87
+ | param2 |
88
+ | extra param |
89
+ And the test example block "2" parameters are as follows:
90
+ | param1 |
91
+
92
+ Scenario: The examples' rows are modeled.
93
+ Then the test example block "1" rows are as follows:
94
+ | x,y,? |
95
+ | 1,2,3 |
96
+ And the test example block "2" rows are as follows:
97
+ | a |
98
+
99
+ Scenario: Convenient output of an example block
100
+ Then the example block has convenient output
101
+
102
+ @redundant
103
+ Scenario Outline: Example models pass all other specifications
104
+ Exact specifications detailing the API for example block models.
105
+ Given that there are "<additional specifications>" detailing models
106
+ When the corresponding specifications are run
107
+ Then all of those specifications are met
108
+ Examples:
109
+ | additional specifications |
110
+ | example_unit_spec.rb |
111
+ | example_integration_spec.rb |