cuke_modeler 1.5.1 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +60 -1
  3. data/LICENSE.txt +1 -1
  4. data/README.md +13 -15
  5. data/cuke_modeler.gemspec +12 -9
  6. data/lib/cuke_modeler.rb +1 -0
  7. data/lib/cuke_modeler/adapters/gherkin_10_adapter.rb +12 -0
  8. data/lib/cuke_modeler/adapters/gherkin_11_adapter.rb +12 -0
  9. data/lib/cuke_modeler/adapters/gherkin_12_adapter.rb +12 -0
  10. data/lib/cuke_modeler/adapters/gherkin_13_adapter.rb +12 -0
  11. data/lib/cuke_modeler/adapters/gherkin_14_adapter.rb +12 -0
  12. data/lib/cuke_modeler/adapters/{gherkin_6_adapter.rb → gherkin_9_adapter.rb} +105 -69
  13. data/lib/cuke_modeler/containing.rb +16 -5
  14. data/lib/cuke_modeler/described.rb +1 -0
  15. data/lib/cuke_modeler/models/background.rb +1 -1
  16. data/lib/cuke_modeler/models/cell.rb +1 -1
  17. data/lib/cuke_modeler/models/comment.rb +1 -1
  18. data/lib/cuke_modeler/models/directory.rb +2 -2
  19. data/lib/cuke_modeler/models/doc_string.rb +1 -1
  20. data/lib/cuke_modeler/models/example.rb +1 -1
  21. data/lib/cuke_modeler/models/feature.rb +16 -5
  22. data/lib/cuke_modeler/models/feature_file.rb +2 -2
  23. data/lib/cuke_modeler/models/outline.rb +1 -1
  24. data/lib/cuke_modeler/models/row.rb +1 -1
  25. data/lib/cuke_modeler/models/rule.rb +99 -0
  26. data/lib/cuke_modeler/models/scenario.rb +1 -1
  27. data/lib/cuke_modeler/models/step.rb +32 -3
  28. data/lib/cuke_modeler/models/table.rb +1 -1
  29. data/lib/cuke_modeler/models/tag.rb +1 -1
  30. data/lib/cuke_modeler/named.rb +1 -0
  31. data/lib/cuke_modeler/nested.rb +1 -0
  32. data/lib/cuke_modeler/parsed.rb +1 -0
  33. data/lib/cuke_modeler/parsing.rb +89 -102
  34. data/lib/cuke_modeler/sourceable.rb +1 -0
  35. data/lib/cuke_modeler/stepped.rb +1 -0
  36. data/lib/cuke_modeler/taggable.rb +1 -0
  37. data/lib/cuke_modeler/version.rb +1 -1
  38. data/testing/cucumber/features/analysis/step_comparison.feature +25 -0
  39. data/testing/cucumber/features/analysis/test_comparison.feature +1 -1
  40. data/testing/cucumber/features/modeling/feature_modeling.feature +28 -7
  41. data/testing/cucumber/features/modeling/feature_output.feature +45 -23
  42. data/testing/cucumber/features/modeling/rule_modeling.feature +108 -0
  43. data/testing/cucumber/features/modeling/rule_output.feature +111 -0
  44. metadata +39 -140
  45. data/.gitignore +0 -18
  46. data/.simplecov +0 -7
  47. data/.travis.yml +0 -60
  48. data/Gemfile +0 -37
  49. data/Rakefile +0 -73
  50. data/appveyor.yml +0 -61
  51. data/lib/cuke_modeler/adapters/gherkin_2_adapter.rb +0 -273
  52. data/lib/cuke_modeler/adapters/gherkin_3_adapter.rb +0 -296
  53. data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +0 -308
  54. data/testing/cucumber/step_definitions/action_steps.rb +0 -13
  55. data/testing/cucumber/step_definitions/background_steps.rb +0 -1
  56. data/testing/cucumber/step_definitions/directory_steps.rb +0 -6
  57. data/testing/cucumber/step_definitions/doc_string_steps.rb +0 -1
  58. data/testing/cucumber/step_definitions/feature_file_steps.rb +0 -16
  59. data/testing/cucumber/step_definitions/feature_steps.rb +0 -7
  60. data/testing/cucumber/step_definitions/modeling_steps.rb +0 -44
  61. data/testing/cucumber/step_definitions/setup_steps.rb +0 -32
  62. data/testing/cucumber/step_definitions/step_steps.rb +0 -3
  63. data/testing/cucumber/step_definitions/table_steps.rb +0 -1
  64. data/testing/cucumber/step_definitions/tag_steps.rb +0 -3
  65. data/testing/cucumber/step_definitions/verification_steps.rb +0 -173
  66. data/testing/cucumber/support/env.rb +0 -30
  67. data/testing/dialect_helper.rb +0 -48
  68. data/testing/file_helper.rb +0 -47
  69. data/testing/gemfiles/gherkin2.gemfile +0 -33
  70. data/testing/gemfiles/gherkin3.gemfile +0 -26
  71. data/testing/gemfiles/gherkin4.gemfile +0 -27
  72. data/testing/gemfiles/gherkin5.gemfile +0 -27
  73. data/testing/gemfiles/gherkin6.gemfile +0 -10
  74. data/testing/rspec/spec/integration/adapters/gherkin_2_adapter_spec.rb +0 -166
  75. data/testing/rspec/spec/integration/adapters/gherkin_3_adapter_spec.rb +0 -166
  76. data/testing/rspec/spec/integration/adapters/gherkin_4_adapter_spec.rb +0 -165
  77. data/testing/rspec/spec/integration/adapters/gherkin_6_adapter_spec.rb +0 -166
  78. data/testing/rspec/spec/integration/models/background_integration_spec.rb +0 -442
  79. data/testing/rspec/spec/integration/models/cell_integration_spec.rb +0 -335
  80. data/testing/rspec/spec/integration/models/comment_integration_spec.rb +0 -177
  81. data/testing/rspec/spec/integration/models/directory_integration_spec.rb +0 -218
  82. data/testing/rspec/spec/integration/models/doc_string_integration_spec.rb +0 -402
  83. data/testing/rspec/spec/integration/models/example_integration_spec.rb +0 -741
  84. data/testing/rspec/spec/integration/models/feature_file_integration_spec.rb +0 -272
  85. data/testing/rspec/spec/integration/models/feature_integration_spec.rb +0 -650
  86. data/testing/rspec/spec/integration/models/model_integration_spec.rb +0 -15
  87. data/testing/rspec/spec/integration/models/outline_integration_spec.rb +0 -624
  88. data/testing/rspec/spec/integration/models/row_integration_spec.rb +0 -291
  89. data/testing/rspec/spec/integration/models/scenario_integration_spec.rb +0 -479
  90. data/testing/rspec/spec/integration/models/step_integration_spec.rb +0 -475
  91. data/testing/rspec/spec/integration/models/table_integration_spec.rb +0 -337
  92. data/testing/rspec/spec/integration/models/tag_integration_spec.rb +0 -259
  93. data/testing/rspec/spec/integration/nested_integration_spec.rb +0 -91
  94. data/testing/rspec/spec/integration/parsing_integration_spec.rb +0 -122
  95. data/testing/rspec/spec/integration/shared/models_integration_specs.rb +0 -18
  96. data/testing/rspec/spec/spec_helper.rb +0 -125
  97. data/testing/rspec/spec/unit/cuke_modeler_unit_spec.rb +0 -25
  98. data/testing/rspec/spec/unit/described_unit_spec.rb +0 -23
  99. data/testing/rspec/spec/unit/models/background_unit_spec.rb +0 -83
  100. data/testing/rspec/spec/unit/models/cell_unit_spec.rb +0 -68
  101. data/testing/rspec/spec/unit/models/comment_unit_spec.rb +0 -68
  102. data/testing/rspec/spec/unit/models/directory_unit_spec.rb +0 -127
  103. data/testing/rspec/spec/unit/models/doc_string_unit_spec.rb +0 -100
  104. data/testing/rspec/spec/unit/models/example_unit_spec.rb +0 -133
  105. data/testing/rspec/spec/unit/models/feature_file_unit_spec.rb +0 -125
  106. data/testing/rspec/spec/unit/models/feature_unit_spec.rb +0 -157
  107. data/testing/rspec/spec/unit/models/model_unit_spec.rb +0 -15
  108. data/testing/rspec/spec/unit/models/outline_unit_spec.rb +0 -117
  109. data/testing/rspec/spec/unit/models/row_unit_spec.rb +0 -68
  110. data/testing/rspec/spec/unit/models/scenario_unit_spec.rb +0 -86
  111. data/testing/rspec/spec/unit/models/step_unit_spec.rb +0 -109
  112. data/testing/rspec/spec/unit/models/table_unit_spec.rb +0 -77
  113. data/testing/rspec/spec/unit/models/tag_unit_spec.rb +0 -68
  114. data/testing/rspec/spec/unit/named_unit_spec.rb +0 -23
  115. data/testing/rspec/spec/unit/nested_unit_spec.rb +0 -43
  116. data/testing/rspec/spec/unit/parsed_unit_spec.rb +0 -27
  117. data/testing/rspec/spec/unit/parsing_unit_spec.rb +0 -54
  118. data/testing/rspec/spec/unit/shared/bare_bones_models_unit_specs.rb +0 -14
  119. data/testing/rspec/spec/unit/shared/containing_models_unit_specs.rb +0 -127
  120. data/testing/rspec/spec/unit/shared/described_models_unit_specs.rb +0 -38
  121. data/testing/rspec/spec/unit/shared/keyworded_models_unit_specs.rb +0 -58
  122. data/testing/rspec/spec/unit/shared/models_unit_specs.rb +0 -15
  123. data/testing/rspec/spec/unit/shared/named_models_unit_specs.rb +0 -39
  124. data/testing/rspec/spec/unit/shared/nested_models_unit_specs.rb +0 -51
  125. data/testing/rspec/spec/unit/shared/parsed_models_unit_specs.rb +0 -39
  126. data/testing/rspec/spec/unit/shared/prepopulated_models_unit_specs.rb +0 -18
  127. data/testing/rspec/spec/unit/shared/sourced_models_unit_specs.rb +0 -39
  128. data/testing/rspec/spec/unit/shared/stepped_models_unit_specs.rb +0 -46
  129. data/testing/rspec/spec/unit/shared/stringifiable_models_unit_specs.rb +0 -18
  130. data/testing/rspec/spec/unit/shared/tagged_models_unit_specs.rb +0 -72
  131. data/testing/rspec/spec/unit/sourceable_unit_spec.rb +0 -27
  132. data/testing/rspec/spec/unit/stepped_unit_spec.rb +0 -23
  133. data/testing/rspec/spec/unit/taggable_unit_spec.rb +0 -69
  134. data/testing/test_languages.json +0 -45
  135. data/todo.txt +0 -24
@@ -1,5 +1,6 @@
1
1
  module CukeModeler
2
2
 
3
+ # NOT A PART OF THE PUBLIC API
3
4
  # A mix-in module containing methods used by models that know from which line of
4
5
  # source code they originate.
5
6
 
@@ -1,5 +1,6 @@
1
1
  module CukeModeler
2
2
 
3
+ # NOT A PART OF THE PUBLIC API
3
4
  # A mix-in module containing methods used by models that represent an element that has steps.
4
5
 
5
6
  module Stepped
@@ -1,5 +1,6 @@
1
1
  module CukeModeler
2
2
 
3
+ # NOT A PART OF THE PUBLIC API
3
4
  # A mix-in module containing methods used by models that represent an element that can be tagged.
4
5
 
5
6
  module Taggable
@@ -1,4 +1,4 @@
1
1
  module CukeModeler
2
2
  # The gem version
3
- VERSION = '1.5.1'
3
+ VERSION = '3.2.0'
4
4
  end
@@ -0,0 +1,25 @@
1
+ Feature: Step comparison
2
+
3
+ Step comparison using `==` is done based on 'significant' properties. Keywords, being completely interchangeable, do not affect step equality.
4
+
5
+
6
+ Scenario: Comparison of steps
7
+ Given a model for the following step:
8
+ """
9
+ Given a step
10
+ """
11
+ And a model for the following step:
12
+ """
13
+ When a step
14
+ """
15
+ And a model for the following step:
16
+ """
17
+ Then a step
18
+ """
19
+ When the models are compared
20
+ Then all of them are equivalent
21
+ But none of the models are equivalent with a model for the following step:
22
+ """
23
+ And a step
24
+ | plus this table |
25
+ """
@@ -1,6 +1,6 @@
1
1
  Feature: Test comparison
2
2
 
3
- Gherkin elements that contain steps (i.e. backgrounds, scenarios, and outlines) can be compared with one another in order to determine equality. Elements are considered equal if the base text of their steps match. That is, the keyword used for the step and any table or doc string that may be associated with that step are ignored for the purposes of comparison.
3
+ Gherkin elements that contain steps (i.e. backgrounds, scenarios, and outlines) can be compared with one another in order to determine equality. Elements are considered equal if their steps match (see step comparison). Properties that do not affect what a test *does* (e.g. name, description, tags) are ignored for the purposes of comparison.
4
4
 
5
5
 
6
6
  Scenario: Comparing tests
@@ -1,6 +1,8 @@
1
1
  Feature: Feature modeling
2
2
 
3
- Feature models are the top level element of the gherkin portion of the model tree. They expose several attributes of the feature that they represent, as well as containing models for any background, scenarios, or outlines that are present in that feature.
3
+ Feature models are the top level element of the Gherkin portion of the model tree. They expose several attributes of the
4
+ feature that they represent, as well as containing models for any background, scenarios, or outlines that are present in
5
+ that feature.
4
6
 
5
7
 
6
8
  Background:
@@ -29,11 +31,18 @@ Feature models are the top level element of the gherkin portion of the model tre
29
31
  Scenario: Scenario 2
30
32
  * a step
31
33
 
32
- Scenario Outline: Outline 2
33
- * a step
34
- Examples:
35
- | param |
36
- | value |
34
+ Rule: a rule
35
+
36
+ Scenario: Scenario 3
37
+ * a step
38
+
39
+ Rule: another rule
40
+
41
+ Scenario Outline: Outline 2
42
+ * a step
43
+ Examples:
44
+ | param |
45
+ | value |
37
46
  """
38
47
  And a feature model based on that gherkin
39
48
  """
@@ -75,7 +84,18 @@ Feature models are the top level element of the gherkin portion of the model tre
75
84
  """
76
85
  Then the model returns a model for the background "The background"
77
86
 
87
+ Scenario: Modeling a feature's rules
88
+ When the feature's rules are requested
89
+ """
90
+ @model.rules
91
+ """
92
+ Then the model returns models for the following rules:
93
+ | a rule |
94
+ | another rule |
95
+
78
96
  Scenario: Modeling a feature's scenarios
97
+ Note: Scenarios under a Rule keyword are included in the corresponding Rule model instead of the Feature model
98
+
79
99
  When the feature's scenarios are requested
80
100
  """
81
101
  @model.scenarios
@@ -85,13 +105,14 @@ Feature models are the top level element of the gherkin portion of the model tre
85
105
  | Scenario 2 |
86
106
 
87
107
  Scenario: Modeling a feature's outlines
108
+ Note: Outlines under a Rule keyword are included in the corresponding Rule model instead of the Feature model
109
+
88
110
  When the feature's outlines are requested
89
111
  """
90
112
  @model.outlines
91
113
  """
92
114
  Then the model returns models for the following outlines:
93
115
  | Outline 1 |
94
- | Outline 2 |
95
116
 
96
117
  Scenario: Modeling a feature's tags
97
118
 
@@ -11,23 +11,28 @@ Feature: Feature output
11
11
  Feature: A feature with everything it could have
12
12
  Including a description
13
13
  and then some.
14
- Background:
14
+ Background: non-nested background
15
15
  Background
16
16
  description
17
17
  * a step
18
18
  |value1|
19
+ |value2|
19
20
  * another step
20
21
  @scenario_tag
21
- Scenario:
22
+ Scenario: non-nested scenario
22
23
  Scenario
23
24
  description
24
25
  * a step
25
26
  * another step
26
- \"\"\"
27
+ \"\"\" with content type
27
28
  some text
28
29
  \"\"\"
30
+ Rule: a rule
31
+ Rule description
32
+ Background: nested background
33
+ * a step
29
34
  @outline_tag
30
- Scenario Outline:
35
+ Scenario Outline: nested outline
31
36
  Outline
32
37
  description
33
38
  * a step
@@ -42,6 +47,9 @@ Feature: Feature output
42
47
  description
43
48
  |param|
44
49
  |value|
50
+ Examples: additional example
51
+ Rule: another rule
52
+ Which is empty
45
53
  """
46
54
  And a feature model based on that gherkin
47
55
  """
@@ -59,48 +67,62 @@ Feature: Feature output
59
67
  Including a description
60
68
  and then some.
61
69
 
62
- Background:
70
+ Background: non-nested background
63
71
 
64
72
  Background
65
73
  description
66
74
 
67
75
  * a step
68
76
  | value1 |
77
+ | value2 |
69
78
  * another step
70
79
 
71
80
  @scenario_tag
72
- Scenario:
81
+ Scenario: non-nested scenario
73
82
 
74
83
  Scenario
75
84
  description
76
85
 
77
86
  * a step
78
87
  * another step
79
- \"\"\"
88
+ \"\"\" with content type
80
89
  some text
81
90
  \"\"\"
82
91
 
83
- @outline_tag
84
- Scenario Outline:
92
+ Rule: a rule
85
93
 
86
- Outline
87
- description
94
+ Rule description
88
95
 
89
- * a step
90
- | value2 |
91
- * another step
92
- \"\"\"
93
- some text
94
- \"\"\"
96
+ Background: nested background
97
+ * a step
95
98
 
96
- @example_tag
97
- Examples:
99
+ @outline_tag
100
+ Scenario Outline: nested outline
98
101
 
99
- Example
100
- description
102
+ Outline
103
+ description
104
+
105
+ * a step
106
+ | value2 |
107
+ * another step
108
+ \"\"\"
109
+ some text
110
+ \"\"\"
111
+
112
+ @example_tag
113
+ Examples:
114
+
115
+ Example
116
+ description
117
+
118
+ | param |
119
+ | value |
120
+
121
+ Examples: additional example
122
+
123
+ Rule: another rule
101
124
 
102
- | param |
103
- | value |
125
+ Which is empty
104
126
  """
105
127
  And the output can be used to make an equivalent model
106
128
  """
@@ -0,0 +1,108 @@
1
+ Feature: Rule modeling
2
+
3
+ Rule models Scenario portion of a feature. They expose several attributes of the rule that they represent, as well as
4
+ containing models for any background, scenarios, or outlines that are present in that rule.
5
+
6
+
7
+ Background:
8
+ Given the following gherkin:
9
+ """
10
+ Rule: Rule Foo
11
+
12
+ Some rule description.
13
+
14
+ Some more.
15
+ And some more.
16
+
17
+ Background: The background
18
+ * some setup step
19
+
20
+ Scenario: Scenario 1
21
+ * a step
22
+
23
+ Scenario Outline: Outline 1
24
+ * a step
25
+ Examples:
26
+ | param |
27
+ | value |
28
+
29
+ Scenario: Scenario 2
30
+ * a step
31
+ """
32
+ And a feature model based on that gherkin
33
+ """
34
+ @model = CukeModeler::Rule.new(<source_text>)
35
+ """
36
+
37
+
38
+ Scenario: Modeling a rule's keyword
39
+ When the rule's keyword is requested
40
+ """
41
+ @model.keyword
42
+ """
43
+ Then the model returns "Rule"
44
+
45
+ Scenario: Modeling a rule's name
46
+ When the rule's name is requested
47
+ """
48
+ @model.name
49
+ """
50
+ Then the model returns "Rule Foo"
51
+
52
+ Scenario: Modeling a rule's description
53
+ When the rule's description is requested
54
+ """
55
+ @model.description
56
+ """
57
+ Then the model returns
58
+ """
59
+ Some rule description.
60
+
61
+ Some more.
62
+ And some more.
63
+ """
64
+
65
+ Scenario: Modeling a rule's background
66
+ When the rule's background is requested
67
+ """
68
+ @model.background
69
+ """
70
+ Then the model returns a model for the background "The background"
71
+
72
+ Scenario: Modeling a rule's scenarios
73
+ When the rule's scenarios are requested
74
+ """
75
+ @model.scenarios
76
+ """
77
+ Then the model returns models for the following scenarios:
78
+ | Scenario 1 |
79
+ | Scenario 2 |
80
+
81
+ Scenario: Modeling a rule's outlines
82
+ When the rule's outlines are requested
83
+ """
84
+ @model.outlines
85
+ """
86
+ Then the model returns models for the following outlines:
87
+ | Outline 1 |
88
+
89
+ Scenario: Modeling a rule's source line
90
+ Given the following gherkin:
91
+ """
92
+ Feature:
93
+
94
+ Rule:
95
+ """
96
+ And a feature model based on that gherkin
97
+ """
98
+ @model = CukeModeler::Feature.new(<source_text>)
99
+ """
100
+ And the rule model of that feature model
101
+ """
102
+ @model = @model.rules.first
103
+ """
104
+ When the rule's source line is requested
105
+ """
106
+ @model.source_line
107
+ """
108
+ Then the model returns "3"
@@ -0,0 +1,111 @@
1
+ Feature: Rule output
2
+
3
+ A rule model's string output is a Gherkin representation of itself. As such, output from a rule model can be used as
4
+ input for the same kind of model.
5
+
6
+
7
+ Scenario: Outputting a rule model
8
+ Given the following gherkin:
9
+ """
10
+ Rule: A rule with everything it could have
11
+ Including a description
12
+ and then some.
13
+ Background: a background
14
+ Background
15
+ description
16
+ * a step
17
+ |value1|
18
+ |value2|
19
+ * another step
20
+ @scenario_tag
21
+ Scenario: a scenario
22
+ Scenario
23
+ description
24
+ * a step
25
+ * another step
26
+ \"\"\" with content type
27
+ some text
28
+ \"\"\"
29
+ @outline_tag
30
+ Scenario Outline: an outline
31
+ Outline
32
+ description
33
+ * a step
34
+ |value2|
35
+ * another step
36
+ \"\"\"
37
+ some text
38
+ \"\"\"
39
+ @example_tag
40
+ Examples:
41
+ Example
42
+ description
43
+ |param|
44
+ |value|
45
+ Examples: additional example
46
+ """
47
+ And a rule model based on that gherkin
48
+ """
49
+ @model = CukeModeler::Rule.new(<source_text>)
50
+ """
51
+ When the model is output as a string
52
+ """
53
+ @model.to_s
54
+ """
55
+ Then the following text is provided:
56
+ """
57
+ Rule: A rule with everything it could have
58
+
59
+ Including a description
60
+ and then some.
61
+
62
+ Background: a background
63
+
64
+ Background
65
+ description
66
+
67
+ * a step
68
+ | value1 |
69
+ | value2 |
70
+ * another step
71
+
72
+ @scenario_tag
73
+ Scenario: a scenario
74
+
75
+ Scenario
76
+ description
77
+
78
+ * a step
79
+ * another step
80
+ \"\"\" with content type
81
+ some text
82
+ \"\"\"
83
+
84
+ @outline_tag
85
+ Scenario Outline: an outline
86
+
87
+ Outline
88
+ description
89
+
90
+ * a step
91
+ | value2 |
92
+ * another step
93
+ \"\"\"
94
+ some text
95
+ \"\"\"
96
+
97
+ @example_tag
98
+ Examples:
99
+
100
+ Example
101
+ description
102
+
103
+ | param |
104
+ | value |
105
+
106
+ Examples: additional example
107
+ """
108
+ And the output can be used to make an equivalent model
109
+ """
110
+ CukeModeler::Rule.new(@model.to_s)
111
+ """