cuke_modeler 0.4.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (252) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +17 -17
  3. data/.travis.yml +1 -1
  4. data/Gemfile +4 -0
  5. data/History.rdoc +71 -3
  6. data/LICENSE.txt +22 -22
  7. data/README.md +24 -10
  8. data/Rakefile +2 -12
  9. data/cuke_modeler.gemspec +1 -1
  10. data/features/analysis/test_comparison.feature +37 -122
  11. data/features/modeling/background_modeling.feature +77 -0
  12. data/features/modeling/background_output.feature +42 -0
  13. data/features/modeling/cell_modeling.feature +23 -0
  14. data/features/modeling/cell_output.feature +22 -0
  15. data/features/modeling/directory_modeling.feature +65 -0
  16. data/features/modeling/directory_output.feature +12 -0
  17. data/features/modeling/doc_string_modeling.feature +61 -0
  18. data/features/modeling/doc_string_output.feature +32 -0
  19. data/features/modeling/example_modeling.feature +125 -0
  20. data/features/modeling/example_output.feature +39 -0
  21. data/features/modeling/feature_file_modeling.feature +40 -0
  22. data/features/modeling/feature_file_output.feature +12 -0
  23. data/features/modeling/feature_modeling.feature +109 -0
  24. data/features/modeling/feature_output.feature +104 -0
  25. data/features/modeling/model_output.feature +22 -0
  26. data/features/modeling/model_structure.feature +48 -0
  27. data/features/modeling/outline_modeling.feature +144 -0
  28. data/features/modeling/outline_output.feature +69 -0
  29. data/features/modeling/row_modeling.feature +48 -0
  30. data/features/modeling/row_output.feature +22 -0
  31. data/features/modeling/scenario_modeling.feature +118 -0
  32. data/features/modeling/scenario_output.feature +45 -0
  33. data/features/modeling/step_modeling.feature +84 -0
  34. data/features/modeling/step_output.feature +29 -0
  35. data/features/modeling/table_modeling.feature +50 -0
  36. data/features/modeling/table_output.feature +24 -0
  37. data/features/modeling/tag_modeling.feature +43 -0
  38. data/features/modeling/tag_output.feature +22 -0
  39. data/features/step_definitions/action_steps.rb +11 -1
  40. data/features/step_definitions/background_steps.rb +1 -85
  41. data/features/step_definitions/directory_steps.rb +2 -48
  42. data/features/step_definitions/doc_string_steps.rb +1 -67
  43. data/features/step_definitions/feature_file_steps.rb +2 -37
  44. data/features/step_definitions/feature_steps.rb +4 -100
  45. data/features/step_definitions/modeling_steps.rb +44 -0
  46. data/features/step_definitions/setup_steps.rb +19 -41
  47. data/features/step_definitions/step_steps.rb +2 -166
  48. data/features/step_definitions/table_steps.rb +1 -58
  49. data/features/step_definitions/tag_steps.rb +2 -72
  50. data/features/step_definitions/verification_steps.rb +152 -4
  51. data/features/support/env.rb +4 -6
  52. data/gemfiles/{gherkin.gemfile → gherkin2.gemfile} +4 -0
  53. data/gemfiles/gherkin3.gemfile +4 -0
  54. data/gemfiles/gherkin4.gemfile +4 -0
  55. data/lib/cuke_modeler.rb +24 -22
  56. data/lib/cuke_modeler/adapters/gherkin_2_adapter.rb +103 -31
  57. data/lib/cuke_modeler/adapters/gherkin_3_adapter.rb +103 -40
  58. data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +111 -50
  59. data/lib/cuke_modeler/containing.rb +255 -4
  60. data/lib/cuke_modeler/described.rb +28 -0
  61. data/lib/cuke_modeler/models/background.rb +66 -0
  62. data/lib/cuke_modeler/models/cell.rb +48 -0
  63. data/lib/cuke_modeler/models/directory.rb +95 -0
  64. data/lib/cuke_modeler/models/doc_string.rb +59 -0
  65. data/lib/cuke_modeler/models/example.rb +167 -0
  66. data/lib/cuke_modeler/models/feature.rb +106 -0
  67. data/lib/cuke_modeler/models/feature_file.rb +64 -0
  68. data/lib/cuke_modeler/models/model.rb +32 -0
  69. data/lib/cuke_modeler/models/outline.rb +79 -0
  70. data/lib/cuke_modeler/models/row.rb +49 -0
  71. data/lib/cuke_modeler/models/scenario.rb +69 -0
  72. data/lib/cuke_modeler/models/step.rb +68 -0
  73. data/lib/cuke_modeler/models/table.rb +67 -0
  74. data/lib/cuke_modeler/models/tag.rb +46 -0
  75. data/lib/cuke_modeler/named.rb +19 -0
  76. data/lib/cuke_modeler/nested.rb +22 -15
  77. data/lib/cuke_modeler/parsed.rb +11 -0
  78. data/lib/cuke_modeler/parsing.rb +66 -83
  79. data/lib/cuke_modeler/sourceable.rb +3 -11
  80. data/lib/cuke_modeler/stepped.rb +24 -0
  81. data/lib/cuke_modeler/taggable.rb +6 -29
  82. data/lib/cuke_modeler/version.rb +2 -1
  83. data/spec/integration/background_integration_spec.rb +332 -7
  84. data/spec/integration/cell_integration_spec.rb +321 -0
  85. data/spec/integration/directory_integration_spec.rb +175 -9
  86. data/spec/integration/doc_string_integration_spec.rb +318 -7
  87. data/spec/integration/example_integration_spec.rb +602 -19
  88. data/spec/integration/feature_file_integration_spec.rb +98 -3
  89. data/spec/integration/feature_integration_spec.rb +445 -27
  90. data/spec/integration/gherkin_2_adapter_spec.rb +122 -0
  91. data/spec/integration/gherkin_3_adapter_spec.rb +125 -0
  92. data/spec/integration/gherkin_4_adapter_spec.rb +123 -0
  93. data/spec/integration/model_integration_spec.rb +15 -0
  94. data/spec/integration/nested_integration_spec.rb +91 -0
  95. data/spec/integration/outline_integration_spec.rb +485 -12
  96. data/spec/integration/parsing_integration_spec.rb +85 -0
  97. data/spec/integration/row_integration_spec.rb +221 -18
  98. data/spec/integration/scenario_integration_spec.rb +368 -14
  99. data/spec/integration/shared/models_integration_specs.rb +18 -0
  100. data/spec/integration/step_integration_spec.rb +328 -77
  101. data/spec/integration/table_integration_spec.rb +242 -20
  102. data/spec/integration/tag_integration_spec.rb +178 -13
  103. data/spec/spec_helper.rb +32 -18
  104. data/spec/unit/background_unit_spec.rb +24 -44
  105. data/spec/unit/cell_unit_spec.rb +73 -0
  106. data/spec/unit/described_unit_spec.rb +23 -0
  107. data/spec/unit/directory_unit_spec.rb +52 -62
  108. data/spec/unit/doc_string_unit_spec.rb +47 -100
  109. data/spec/unit/example_unit_spec.rb +50 -296
  110. data/spec/unit/feature_file_unit_spec.rb +53 -52
  111. data/spec/unit/feature_unit_spec.rb +39 -83
  112. data/spec/unit/model_unit_spec.rb +15 -0
  113. data/spec/unit/named_unit_spec.rb +23 -0
  114. data/spec/unit/nested_unit_spec.rb +24 -21
  115. data/spec/unit/outline_unit_spec.rb +46 -69
  116. data/spec/unit/parsed_unit_spec.rb +27 -0
  117. data/spec/unit/parsing_unit_spec.rb +2 -70
  118. data/spec/unit/row_unit_spec.rb +22 -51
  119. data/spec/unit/scenario_unit_spec.rb +27 -59
  120. data/spec/unit/{bare_bones_unit_specs.rb → shared/bare_bones_models_unit_specs.rb} +2 -2
  121. data/spec/unit/shared/containing_models_unit_specs.rb +18 -0
  122. data/spec/unit/shared/described_models_unit_specs.rb +38 -0
  123. data/spec/unit/shared/models_unit_specs.rb +15 -0
  124. data/spec/unit/shared/named_models_unit_specs.rb +39 -0
  125. data/spec/unit/shared/nested_models_unit_specs.rb +51 -0
  126. data/spec/unit/shared/parsed_models_unit_specs.rb +39 -0
  127. data/spec/unit/shared/prepopulated_models_unit_specs.rb +18 -0
  128. data/spec/unit/shared/sourced_models_unit_specs.rb +39 -0
  129. data/spec/unit/shared/stepped_models_unit_specs.rb +46 -0
  130. data/spec/unit/shared/stringifiable_models_unit_specs.rb +18 -0
  131. data/spec/unit/shared/tagged_models_unit_specs.rb +72 -0
  132. data/spec/unit/sourceable_unit_spec.rb +12 -4
  133. data/spec/unit/step_unit_spec.rb +40 -231
  134. data/spec/unit/stepped_unit_spec.rb +23 -0
  135. data/spec/unit/table_unit_spec.rb +27 -89
  136. data/spec/unit/tag_unit_spec.rb +30 -53
  137. data/spec/unit/taggable_unit_spec.rb +26 -42
  138. data/todo.txt +32 -0
  139. metadata +135 -217
  140. data/features/analysis/test_manipulation.feature +0 -37
  141. data/features/modeling/gherkin/background_modeling.feature +0 -65
  142. data/features/modeling/gherkin/background_output.feature +0 -131
  143. data/features/modeling/gherkin/directory_modeling.feature +0 -110
  144. data/features/modeling/gherkin/directory_output.feature +0 -14
  145. data/features/modeling/gherkin/doc_string_modeling.feature +0 -53
  146. data/features/modeling/gherkin/doc_string_output.feature +0 -72
  147. data/features/modeling/gherkin/example_modeling.feature +0 -101
  148. data/features/modeling/gherkin/example_output.feature +0 -193
  149. data/features/modeling/gherkin/feature_file_modeling.feature +0 -54
  150. data/features/modeling/gherkin/feature_file_output.feature +0 -14
  151. data/features/modeling/gherkin/feature_modeling.feature +0 -154
  152. data/features/modeling/gherkin/feature_output.feature +0 -245
  153. data/features/modeling/gherkin/outline_modeling.feature +0 -90
  154. data/features/modeling/gherkin/outline_output.feature +0 -198
  155. data/features/modeling/gherkin/row_modeling.feature +0 -68
  156. data/features/modeling/gherkin/row_output.feature +0 -28
  157. data/features/modeling/gherkin/scenario_modeling.feature +0 -79
  158. data/features/modeling/gherkin/scenario_output.feature +0 -148
  159. data/features/modeling/gherkin/step_modeling.feature +0 -75
  160. data/features/modeling/gherkin/step_output.feature +0 -53
  161. data/features/modeling/gherkin/table_modeling.feature +0 -42
  162. data/features/modeling/gherkin/table_output.feature +0 -43
  163. data/features/modeling/gherkin/table_row_modeling.feature +0 -57
  164. data/features/modeling/gherkin/table_row_output.feature +0 -28
  165. data/features/modeling/gherkin/tag_modeling.feature +0 -48
  166. data/features/modeling/gherkin/tag_output.feature +0 -17
  167. data/features/modeling/gherkin3/background_modeling.feature +0 -64
  168. data/features/modeling/gherkin3/background_output.feature +0 -131
  169. data/features/modeling/gherkin3/directory_modeling.feature +0 -110
  170. data/features/modeling/gherkin3/directory_output.feature +0 -14
  171. data/features/modeling/gherkin3/doc_string_modeling.feature +0 -53
  172. data/features/modeling/gherkin3/doc_string_output.feature +0 -72
  173. data/features/modeling/gherkin3/example_modeling.feature +0 -100
  174. data/features/modeling/gherkin3/example_output.feature +0 -207
  175. data/features/modeling/gherkin3/feature_file_modeling.feature +0 -54
  176. data/features/modeling/gherkin3/feature_file_output.feature +0 -14
  177. data/features/modeling/gherkin3/feature_modeling.feature +0 -155
  178. data/features/modeling/gherkin3/feature_output.feature +0 -249
  179. data/features/modeling/gherkin3/outline_modeling.feature +0 -89
  180. data/features/modeling/gherkin3/outline_output.feature +0 -255
  181. data/features/modeling/gherkin3/row_modeling.feature +0 -68
  182. data/features/modeling/gherkin3/row_output.feature +0 -28
  183. data/features/modeling/gherkin3/scenario_modeling.feature +0 -78
  184. data/features/modeling/gherkin3/scenario_output.feature +0 -148
  185. data/features/modeling/gherkin3/step_modeling.feature +0 -75
  186. data/features/modeling/gherkin3/step_output.feature +0 -53
  187. data/features/modeling/gherkin3/table_modeling.feature +0 -42
  188. data/features/modeling/gherkin3/table_output.feature +0 -43
  189. data/features/modeling/gherkin3/table_row_modeling.feature +0 -57
  190. data/features/modeling/gherkin3/table_row_output.feature +0 -28
  191. data/features/modeling/gherkin3/tag_modeling.feature +0 -49
  192. data/features/modeling/gherkin3/tag_output.feature +0 -17
  193. data/features/modeling/gherkin4/background_modeling.feature +0 -64
  194. data/features/modeling/gherkin4/background_output.feature +0 -131
  195. data/features/modeling/gherkin4/directory_modeling.feature +0 -110
  196. data/features/modeling/gherkin4/directory_output.feature +0 -14
  197. data/features/modeling/gherkin4/doc_string_modeling.feature +0 -53
  198. data/features/modeling/gherkin4/doc_string_output.feature +0 -72
  199. data/features/modeling/gherkin4/example_modeling.feature +0 -100
  200. data/features/modeling/gherkin4/example_output.feature +0 -193
  201. data/features/modeling/gherkin4/feature_file_modeling.feature +0 -54
  202. data/features/modeling/gherkin4/feature_file_output.feature +0 -14
  203. data/features/modeling/gherkin4/feature_modeling.feature +0 -153
  204. data/features/modeling/gherkin4/feature_output.feature +0 -245
  205. data/features/modeling/gherkin4/outline_modeling.feature +0 -89
  206. data/features/modeling/gherkin4/outline_output.feature +0 -198
  207. data/features/modeling/gherkin4/row_modeling.feature +0 -68
  208. data/features/modeling/gherkin4/row_output.feature +0 -28
  209. data/features/modeling/gherkin4/scenario_modeling.feature +0 -78
  210. data/features/modeling/gherkin4/scenario_output.feature +0 -148
  211. data/features/modeling/gherkin4/step_modeling.feature +0 -75
  212. data/features/modeling/gherkin4/step_output.feature +0 -53
  213. data/features/modeling/gherkin4/table_modeling.feature +0 -42
  214. data/features/modeling/gherkin4/table_output.feature +0 -43
  215. data/features/modeling/gherkin4/table_row_modeling.feature +0 -57
  216. data/features/modeling/gherkin4/table_row_output.feature +0 -28
  217. data/features/modeling/gherkin4/tag_modeling.feature +0 -48
  218. data/features/modeling/gherkin4/tag_output.feature +0 -17
  219. data/features/step_definitions/outline_steps.rb +0 -258
  220. data/features/step_definitions/test_steps.rb +0 -123
  221. data/lib/cuke_modeler/background.rb +0 -38
  222. data/lib/cuke_modeler/directory.rb +0 -83
  223. data/lib/cuke_modeler/doc_string.rb +0 -87
  224. data/lib/cuke_modeler/example.rb +0 -195
  225. data/lib/cuke_modeler/feature.rb +0 -147
  226. data/lib/cuke_modeler/feature_element.rb +0 -73
  227. data/lib/cuke_modeler/feature_file.rb +0 -77
  228. data/lib/cuke_modeler/outline.rb +0 -68
  229. data/lib/cuke_modeler/raw.rb +0 -20
  230. data/lib/cuke_modeler/row.rb +0 -64
  231. data/lib/cuke_modeler/scenario.rb +0 -45
  232. data/lib/cuke_modeler/step.rb +0 -216
  233. data/lib/cuke_modeler/table.rb +0 -90
  234. data/lib/cuke_modeler/table_row.rb +0 -64
  235. data/lib/cuke_modeler/tag.rb +0 -62
  236. data/lib/cuke_modeler/test_element.rb +0 -79
  237. data/lib/cuke_modeler/world.rb +0 -113
  238. data/spec/integration/table_row_integration_spec.rb +0 -76
  239. data/spec/integration/world_integration_spec.rb +0 -14
  240. data/spec/unit/containing_element_unit_specs.rb +0 -18
  241. data/spec/unit/feature_element_unit_spec.rb +0 -19
  242. data/spec/unit/feature_element_unit_specs.rb +0 -52
  243. data/spec/unit/nested_element_unit_specs.rb +0 -39
  244. data/spec/unit/prepopulated_unit_specs.rb +0 -14
  245. data/spec/unit/raw_element_unit_specs.rb +0 -27
  246. data/spec/unit/raw_unit_spec.rb +0 -28
  247. data/spec/unit/sourced_element_unit_specs.rb +0 -18
  248. data/spec/unit/table_row_unit_spec.rb +0 -102
  249. data/spec/unit/tagged_element_unit_specs.rb +0 -67
  250. data/spec/unit/test_element_unit_spec.rb +0 -54
  251. data/spec/unit/test_element_unit_specs.rb +0 -34
  252. data/spec/unit/world_unit_spec.rb +0 -140
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 414503e25b096ba139b0585a57db358e5874c263
4
- data.tar.gz: c982a0ae8247c086de6a8af77fef5552bc744184
3
+ metadata.gz: 3d45c74a6f723c171dac766c39700fe913bb5780
4
+ data.tar.gz: e75f758bd4197d5ba5894c1c147d8a9e8a393d0e
5
5
  SHA512:
6
- metadata.gz: e3e67445b91027baa77694302656394837fce4e384cc213c4f1ba8127b5826a5d6d6c6105998030b1e429c7c71a26522df26e5cae044f0a1f62cf089aeaa7b9a
7
- data.tar.gz: 499a61bbd3f475f9ad9cfb0f3f00903eaec01895b68eed7496c89404e2a1c8c4ef7fb8eda54deeaff9b49e1c8e0acc11d335fd0b54ea55c56711f55a7be034e2
6
+ metadata.gz: d1be16e1d99e64f661d87b22fa5efce4feb84444b7c498628ee964ef491a621c1c041b1437c1e6c265abf784bfb6ac80ee2048433402c40889be9555761c4cd4
7
+ data.tar.gz: f9866720e77b5d436b5e88dbeb791bc7b92384bd39ceb3c55cd201570c2868b09de93eec85f260940da0f98de32ce162b0bcb1899b9db9545b133d5041f5066e
data/.gitignore CHANGED
@@ -1,17 +1,17 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.travis.yml CHANGED
@@ -7,7 +7,7 @@ rvm:
7
7
  - 2.2.2
8
8
 
9
9
  gemfile:
10
- - gemfiles/gherkin.gemfile
10
+ - gemfiles/gherkin2.gemfile
11
11
  - gemfiles/gherkin3.gemfile
12
12
  - gemfiles/gherkin4.gemfile
13
13
 
data/Gemfile CHANGED
@@ -14,6 +14,10 @@ elsif RUBY_VERSION =~ /^1\./
14
14
  gem 'cucumber', '<2.0.0'
15
15
  end
16
16
 
17
+ if RUBY_VERSION =~ /^1\./
18
+ gem 'tins', '< 1.7' # The 'tins' gem requires Ruby 2.x on/after this version
19
+ end
20
+
17
21
  if RUBY_VERSION =~ /^2\./
18
22
  gem 'gherkin', '~> 4.0'
19
23
  end
data/History.rdoc CHANGED
@@ -1,6 +1,71 @@
1
+ === Version 1.0.0 / 2016-09-08
2
+
3
+ * All modeled elements of a Cucumber test suite are now modeled with actual classes. Previously, some elements (such as
4
+ tags or rows in an example table) were modeled with simple strings.
5
+
6
+ * A base model class has been added in order to simplify adding new element models. Other classes and modules used for
7
+ organizing common model behavior have been created/removed/renamed.
8
+
9
+ * Feature file models now only have a single feature model instead of a collection of them (that would only ever have
10
+ one item in it).
11
+
12
+ * Rows in an example table and rows in a step table no longer use two different classes for modeling.
13
+
14
+ * Background models can now be compared to other models that have steps (i.e. scenarios and outlines).
15
+
16
+ * All models for Gherkin elements now track the line number from which they originate in a source file.
17
+
18
+ * The source line of a model is now a mutable attribute instead of being read only.
19
+
20
+ * The file path of a feature file is now a mutable attribute instead of being read only.
21
+
22
+ * Standardized the initial values of the attributes of abstractly created models so that they are consistent across
23
+ model types.
24
+
25
+ * Added specific ancestor types for scenario, outline, and background models as alternatives to the generic 'test'
26
+ ancestor type.
27
+
28
+ * Extra whitespace around parsed element descriptions is now trimmed away before being stored in a model.
29
+
30
+ * Adding rows to examples via hashes can now be done without regard to the order of the keys in the hash. The correct
31
+ order can be determined by the model.
32
+
33
+ * The saved parsing data that is generated by the 'gherkin' gem is no longer duplicated for each model, resulting in
34
+ significantly less memory usage.
35
+
36
+ * String output of models has been improved. More special characters in Gherkin (e.g. vertical bars in rows) are
37
+ appropriately escaped in the string output of a model and several minor bugs related to using model string output as
38
+ the input text for new models have been fixed.
39
+
40
+ * Removed the backdoor used to pass around model data during the model creation process. Model input can now only be
41
+ text.
42
+
43
+ * Simple counting methods have been removed. Ruby's collection methods are just as easy to use directly when dealing
44
+ with classes that contain collections and the removal of these counting methods simplifies the codebase.
45
+
46
+ * The 'World' module has been removed. The scope of this gem is to model files written in Gherkin. Concepts like
47
+ 'step definitions' and 'hooks' are better left to libraries that include (possibly programming language specific)
48
+ test execution logic within their scope of concern.
49
+
50
+ * Step models no longer have 'arguments' because they require the concept of step definitions, which are no longer
51
+ within the scope of this gem.
52
+
53
+ * Removed deprecated behavior
54
+ - Marked
55
+ - Doc strings no longer use an array of strings to model their content
56
+ - Tables no longer use nested arrays of strings to model their rows
57
+ - Models that have descriptions no longer use an array of strings to model their description
58
+ - The convenient (read: awkward) #step_text has been removed.
59
+ - Unmarked
60
+ - Examples no longer use an array of hashes to model their rows
61
+
62
+ * Various methods have been renamed.
63
+
64
+
1
65
  === Version 0.4.1 / 2016-05-12
2
66
 
3
- * Increased the flexibility of input when adding rows to an Example object.
67
+ * Increased the flexibility of input when adding rows to an Example object. Non-string values can now be used as input
68
+ and they will be converted into strings. Original input objects are not modified.
4
69
  * Added some error checking around adding value rows to an Example object without adding a parameter row as well.
5
70
 
6
71
 
@@ -8,7 +73,7 @@
8
73
 
9
74
  * The path of a Directory object is now a changeable attribute instead of only being populated if the instance was
10
75
  given a diretory to model.
11
- * Bug fix - Fixed a bug that occurred if a Directory object was asked for its #name when it was created 'empty'
76
+ * Bug fix - Fixed a bug that occurred if a Directory object was asked for its #name when it was created as 'abstract'
12
77
  instead of modeling an existing directory.
13
78
 
14
79
 
@@ -21,12 +86,15 @@
21
86
 
22
87
  === Version 0.2.0 / 2016-02-21
23
88
 
24
- * Better error feedback when parsing errors are encountered.
89
+ * Better error feedback when parsing errors are encountered. It is now easier to tell which file contained invalid
90
+ Gherkin.
25
91
 
26
92
 
27
93
  === Version 0.1.0 / 2016-02-10
28
94
 
29
95
  * Support for version 3.x of the 'gherkin' gem added.
96
+ * Bug fix - The saved parsing data that is generated by the 'gherkin' gem is no longer modified by the rest of the
97
+ model creation process.
30
98
 
31
99
 
32
100
  === Version 0.0.2 / 2015-11-22
data/LICENSE.txt CHANGED
@@ -1,22 +1,22 @@
1
- Copyright (c) 2014 Eric Kessler
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright (c) 2014 Eric Kessler
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,9 +1,14 @@
1
1
  # CukeModeler
2
2
 
3
- The intention of this gem is to provide the ability to model a Cucumber test
4
- suite. It provides a foundation upon which to build other useful tools for
5
- interacting with a test suite that is written in Gherkin (and written with
6
- Cucumber in particular).
3
+ There comes a time in every programmer's adventures with Cucumber when they want to do Really Cool
4
+ Stuff with their tests. This usually necessitates scanning all of their feature files and playing
5
+ with the output. While the **[gherkin](https://github.com/cucumber/gherkin)** gem does a fine job of parsing feature files, reading or even
6
+ manipulating the resulting Abstract Syntax Tree is not always fun. **cuke_modeler** comes to the
7
+ rescue by providing a modeling layer that is easier to work with.
8
+
9
+ Whether you just want something that will let you easily inspect your test suite or you are looking
10
+ for a foundation tool upon which to build something Really Neat, this gem has you covered.
11
+
7
12
 
8
13
  ## Installation
9
14
 
@@ -23,7 +28,7 @@ Or install it yourself as:
23
28
 
24
29
  First, load up the gem code.
25
30
 
26
- require 'cuke_modeler'
31
+ require 'cuke_modeler'
27
32
 
28
33
  Next, choose what you want to model. Directories and feature files are the most
29
34
  common thing to model but smaller portions of a test suite can be modeled as well.
@@ -46,7 +51,7 @@ and setting their attributes afterward.
46
51
 
47
52
  step = CukeModeler::Step.new
48
53
  step.keyword = 'Given'
49
- step.base = 'some step'
54
+ step.text = 'some step'
50
55
 
51
56
  test = CukeModeler::Scenario.new
52
57
  test.steps = [step]
@@ -54,7 +59,15 @@ and setting their attributes afterward.
54
59
  test.to_s #=> "Scenario:\n Given some step"
55
60
 
56
61
  One could, if so inclined, use this method to dynamically edit or even create an
57
- entire test suite.
62
+ entire test suite!
63
+
64
+
65
+ ## Modeling other versions of Cucumber
66
+
67
+ Although this gem is written in Ruby and requires it to run, the modeling capabilities provided are for
68
+ the feature file layer of a Cucumber test suite. As such, any feature file that is written in Gherkin can
69
+ be modeled, even if that feature is ultimately run with SpecFlow (Cucumber for C#), Lettuce (Cucumber for
70
+ Python), or some other flavor of Cucumber.
58
71
 
59
72
 
60
73
  ### Other gems that are (or soon will be) powered by cuke_modeler
@@ -64,10 +77,11 @@ entire test suite.
64
77
  * https://github.com/enkessler/cuke_cataloger
65
78
  * https://github.com/grange-insurance/cuke_slicer
66
79
 
80
+
67
81
  ## Contributing
68
82
 
69
83
  1. Fork it
70
- 2. Create your feature branch (`git checkout -b my-new-feature`)
71
- 3. Commit your changes (`git commit -am 'Add some feature'`)
72
- 4. Push to the branch (`git push origin my-new-feature`)
84
+ 2. Create your feature branch (off of the development branch): `git checkout -b my-new-feature`
85
+ 3. Commit your changes: `git commit -am 'Add some feature'`
86
+ 4. Push to the branch: `git push origin my-new-feature`
73
87
  5. Create new Pull Request
data/Rakefile CHANGED
@@ -25,18 +25,8 @@ namespace 'cuke_modeler' do
25
25
 
26
26
  desc 'Test gem based on Ruby/dependency versions'
27
27
  task :smart_test do |t, args|
28
- rspec_args = ''
29
-
30
- case
31
- when Gem.loaded_specs['gherkin'].version.version[/^4/]
32
- cucumber_args = '-t ~@gherkin -t ~@gherkin3'
33
- when Gem.loaded_specs['gherkin'].version.version[/^3/]
34
- cucumber_args = '-t ~@gherkin -t ~@gherkin4'
35
- else
36
- cucumber_args = '-t ~@gherkin3 -t ~@gherkin4'
37
- end
38
-
39
- cucumber_args += ' -f progress'
28
+ rspec_args = '--tag ~@wip'
29
+ cucumber_args = '-f progress -t ~@wip'
40
30
 
41
31
  Rake::Task['cuke_modeler:test_everything'].invoke(rspec_args, cucumber_args)
42
32
  end
data/cuke_modeler.gemspec CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "bundler", "~> 1.5"
25
25
  spec.add_development_dependency "rake"
26
26
  spec.add_development_dependency 'cucumber'
27
- spec.add_development_dependency 'rspec', '~> 2.14.0'
27
+ spec.add_development_dependency 'rspec', '~> 3.0'
28
28
  spec.add_development_dependency 'simplecov'
29
29
  spec.add_development_dependency 'racatt', '~> 1.0'
30
30
  spec.add_development_dependency 'coveralls'
@@ -1,123 +1,38 @@
1
- Feature: Test equality can be determined.
2
-
3
-
4
- Acceptance criteria
5
-
6
- Tests can be compared for equality.
7
- 1. tests whose steps are the same except for arguments and keywords (i.e.
8
- they match the same step definition) are equal
9
-
10
-
11
- Background: Test file setup.
12
- Given the following feature file:
13
- """
14
- Feature: A feature with duplicate tests.
15
-
16
- Scenario: A test
17
- Given this *parameterized* step takes a table:
18
- | data 1 |
19
- | data 2 |
20
- And some setup step
21
- When a step with a *parameter*
22
- And a big step:
23
- \"\"\"
24
- little doc block
25
- \"\"\"
26
- Then *lots* *of* *parameters*
27
-
28
- Scenario: Same test, different arguments and keywords
29
- Given this *similarly parameterized* step takes a table:
30
- | data 3 |
31
- | data 4 |
32
- Given some setup step
33
- When a step with a *parameter*
34
- * a big step:
35
- \"\"\"
36
- A little
37
- bigger doc block
38
- \"\"\"
39
- Then *lots* *of* *parameters*
40
-
41
- Scenario Outline: This is the same test as an outline
42
- Given this *parameterized* step takes a table:
43
- | <param1> |
44
- | <param2> |
45
- And some setup step
46
- When a step with a *parameter*
47
- And a big step:
48
- \"\"\"
49
- little doc block
50
- \"\"\"
51
- Then *lots* *of* *parameters*
52
- Examples:
53
- | param1 | param2 |
54
- | x | y |
55
- Examples:
56
- | param1 | param2 |
57
- | a | b |
58
-
59
- Scenario Outline: Same outline, different arguments and keywords
60
- Given this *similarly parameterized* step takes a table:
61
- | <param3> |
62
- | <param4> |
63
- Given some setup step
64
- When a step with a *slightly different parameter*
65
- * a big step:
66
- \"\"\"
67
- A little
68
- bigger doc block
69
- \"\"\"
70
- Then *lots* *of effectively the same* *parameters*
71
- Examples:
72
- | param1 | param2 |
73
- | h | k |
74
- Examples:
75
- | param1 | param2 |
76
- | i | j |
77
-
78
- Scenario: A different test
79
- Given this *parameterized* step takes a table:
80
- | data 1 |
81
- | data 2 |
82
- And not the same setup step as before
83
- When a step with a *parameter*
84
- And a big step:
85
- \"\"\"
86
- little doc block
87
- \"\"\"
88
- Then *lots* *of* *parameters*
89
-
90
- Scenario Outline: This is the same different test as an outline
91
- Given this *similarly parameterized* step takes a table:
92
- | <param1> |
93
- | <param2> |
94
- And not the same setup step as before
95
- When a step with a *slightly different parameter*
96
- And a big step:
97
- \"\"\"
98
- A little
99
- bigger doc block
100
- \"\"\"
101
- Then *lots* *of effectively the same* *parameters*
1
+ Feature: Test comparison
2
+
3
+ Gherkin elements that contain steps (i.e. backgrounds, scenarios, and outlines) can be compared with one another
4
+ in order to determine equality. Elements are considered equal if the base text of their steps match. That is, the
5
+ keyword used for the step and any table or doc string that may be associated with that step are ignored for the
6
+ purposes of comparison.
7
+
8
+
9
+ Scenario: Comparing tests
10
+ Given a model for the following background:
11
+ """
12
+ Background:
13
+ * step 1
14
+ * step 2
15
+ """
16
+ And a model for the following scenario:
17
+ """
18
+ Scenario:
19
+ * step 1
20
+ * step 2
21
+ """
22
+ And a model for the following outline:
23
+ """
24
+ Scenario Outline:
25
+ * step 1
26
+ * step 2
102
27
  Examples:
103
- | param1 | param2 |
104
- | x | y |
105
- Examples:
106
- | param1 | param2 |
107
- | a | b |
108
- """
109
- And parameter delimiters of "*" and "*"
110
- When the file is read
111
-
112
-
113
- Scenario: Scenario to Scenario comparison
114
- Then test "1" is equal to test "2"
115
- And test "1" is not equal to test "5"
116
-
117
- Scenario: Outline to Outline comparison
118
- Then test "3" is equal to test "4"
119
- And test "3" is not equal to test "6"
120
-
121
- Scenario: Scenario to Outline comparison
122
- Then test "1" is equal to test "3"
123
- And test "1" is not equal to test "6"
28
+ | param |
29
+ | value |
30
+ """
31
+ When the models are compared
32
+ Then all of them are equivalent
33
+ But none of the models are equivalent with a model for the following scenario:
34
+ """
35
+ Scenario:
36
+ * step 1
37
+ * step 3
38
+ """