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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +60 -1
- data/LICENSE.txt +1 -1
- data/README.md +13 -15
- data/cuke_modeler.gemspec +12 -9
- data/lib/cuke_modeler.rb +1 -0
- data/lib/cuke_modeler/adapters/gherkin_10_adapter.rb +12 -0
- data/lib/cuke_modeler/adapters/gherkin_11_adapter.rb +12 -0
- data/lib/cuke_modeler/adapters/gherkin_12_adapter.rb +12 -0
- data/lib/cuke_modeler/adapters/gherkin_13_adapter.rb +12 -0
- data/lib/cuke_modeler/adapters/gherkin_14_adapter.rb +12 -0
- data/lib/cuke_modeler/adapters/{gherkin_6_adapter.rb → gherkin_9_adapter.rb} +105 -69
- data/lib/cuke_modeler/containing.rb +16 -5
- data/lib/cuke_modeler/described.rb +1 -0
- data/lib/cuke_modeler/models/background.rb +1 -1
- data/lib/cuke_modeler/models/cell.rb +1 -1
- data/lib/cuke_modeler/models/comment.rb +1 -1
- data/lib/cuke_modeler/models/directory.rb +2 -2
- data/lib/cuke_modeler/models/doc_string.rb +1 -1
- data/lib/cuke_modeler/models/example.rb +1 -1
- data/lib/cuke_modeler/models/feature.rb +16 -5
- data/lib/cuke_modeler/models/feature_file.rb +2 -2
- data/lib/cuke_modeler/models/outline.rb +1 -1
- data/lib/cuke_modeler/models/row.rb +1 -1
- data/lib/cuke_modeler/models/rule.rb +99 -0
- data/lib/cuke_modeler/models/scenario.rb +1 -1
- data/lib/cuke_modeler/models/step.rb +32 -3
- data/lib/cuke_modeler/models/table.rb +1 -1
- data/lib/cuke_modeler/models/tag.rb +1 -1
- data/lib/cuke_modeler/named.rb +1 -0
- data/lib/cuke_modeler/nested.rb +1 -0
- data/lib/cuke_modeler/parsed.rb +1 -0
- data/lib/cuke_modeler/parsing.rb +89 -102
- data/lib/cuke_modeler/sourceable.rb +1 -0
- data/lib/cuke_modeler/stepped.rb +1 -0
- data/lib/cuke_modeler/taggable.rb +1 -0
- data/lib/cuke_modeler/version.rb +1 -1
- data/testing/cucumber/features/analysis/step_comparison.feature +25 -0
- data/testing/cucumber/features/analysis/test_comparison.feature +1 -1
- data/testing/cucumber/features/modeling/feature_modeling.feature +28 -7
- data/testing/cucumber/features/modeling/feature_output.feature +45 -23
- data/testing/cucumber/features/modeling/rule_modeling.feature +108 -0
- data/testing/cucumber/features/modeling/rule_output.feature +111 -0
- metadata +39 -140
- data/.gitignore +0 -18
- data/.simplecov +0 -7
- data/.travis.yml +0 -60
- data/Gemfile +0 -37
- data/Rakefile +0 -73
- data/appveyor.yml +0 -61
- data/lib/cuke_modeler/adapters/gherkin_2_adapter.rb +0 -273
- data/lib/cuke_modeler/adapters/gherkin_3_adapter.rb +0 -296
- data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +0 -308
- data/testing/cucumber/step_definitions/action_steps.rb +0 -13
- data/testing/cucumber/step_definitions/background_steps.rb +0 -1
- data/testing/cucumber/step_definitions/directory_steps.rb +0 -6
- data/testing/cucumber/step_definitions/doc_string_steps.rb +0 -1
- data/testing/cucumber/step_definitions/feature_file_steps.rb +0 -16
- data/testing/cucumber/step_definitions/feature_steps.rb +0 -7
- data/testing/cucumber/step_definitions/modeling_steps.rb +0 -44
- data/testing/cucumber/step_definitions/setup_steps.rb +0 -32
- data/testing/cucumber/step_definitions/step_steps.rb +0 -3
- data/testing/cucumber/step_definitions/table_steps.rb +0 -1
- data/testing/cucumber/step_definitions/tag_steps.rb +0 -3
- data/testing/cucumber/step_definitions/verification_steps.rb +0 -173
- data/testing/cucumber/support/env.rb +0 -30
- data/testing/dialect_helper.rb +0 -48
- data/testing/file_helper.rb +0 -47
- data/testing/gemfiles/gherkin2.gemfile +0 -33
- data/testing/gemfiles/gherkin3.gemfile +0 -26
- data/testing/gemfiles/gherkin4.gemfile +0 -27
- data/testing/gemfiles/gherkin5.gemfile +0 -27
- data/testing/gemfiles/gherkin6.gemfile +0 -10
- data/testing/rspec/spec/integration/adapters/gherkin_2_adapter_spec.rb +0 -166
- data/testing/rspec/spec/integration/adapters/gherkin_3_adapter_spec.rb +0 -166
- data/testing/rspec/spec/integration/adapters/gherkin_4_adapter_spec.rb +0 -165
- data/testing/rspec/spec/integration/adapters/gherkin_6_adapter_spec.rb +0 -166
- data/testing/rspec/spec/integration/models/background_integration_spec.rb +0 -442
- data/testing/rspec/spec/integration/models/cell_integration_spec.rb +0 -335
- data/testing/rspec/spec/integration/models/comment_integration_spec.rb +0 -177
- data/testing/rspec/spec/integration/models/directory_integration_spec.rb +0 -218
- data/testing/rspec/spec/integration/models/doc_string_integration_spec.rb +0 -402
- data/testing/rspec/spec/integration/models/example_integration_spec.rb +0 -741
- data/testing/rspec/spec/integration/models/feature_file_integration_spec.rb +0 -272
- data/testing/rspec/spec/integration/models/feature_integration_spec.rb +0 -650
- data/testing/rspec/spec/integration/models/model_integration_spec.rb +0 -15
- data/testing/rspec/spec/integration/models/outline_integration_spec.rb +0 -624
- data/testing/rspec/spec/integration/models/row_integration_spec.rb +0 -291
- data/testing/rspec/spec/integration/models/scenario_integration_spec.rb +0 -479
- data/testing/rspec/spec/integration/models/step_integration_spec.rb +0 -475
- data/testing/rspec/spec/integration/models/table_integration_spec.rb +0 -337
- data/testing/rspec/spec/integration/models/tag_integration_spec.rb +0 -259
- data/testing/rspec/spec/integration/nested_integration_spec.rb +0 -91
- data/testing/rspec/spec/integration/parsing_integration_spec.rb +0 -122
- data/testing/rspec/spec/integration/shared/models_integration_specs.rb +0 -18
- data/testing/rspec/spec/spec_helper.rb +0 -125
- data/testing/rspec/spec/unit/cuke_modeler_unit_spec.rb +0 -25
- data/testing/rspec/spec/unit/described_unit_spec.rb +0 -23
- data/testing/rspec/spec/unit/models/background_unit_spec.rb +0 -83
- data/testing/rspec/spec/unit/models/cell_unit_spec.rb +0 -68
- data/testing/rspec/spec/unit/models/comment_unit_spec.rb +0 -68
- data/testing/rspec/spec/unit/models/directory_unit_spec.rb +0 -127
- data/testing/rspec/spec/unit/models/doc_string_unit_spec.rb +0 -100
- data/testing/rspec/spec/unit/models/example_unit_spec.rb +0 -133
- data/testing/rspec/spec/unit/models/feature_file_unit_spec.rb +0 -125
- data/testing/rspec/spec/unit/models/feature_unit_spec.rb +0 -157
- data/testing/rspec/spec/unit/models/model_unit_spec.rb +0 -15
- data/testing/rspec/spec/unit/models/outline_unit_spec.rb +0 -117
- data/testing/rspec/spec/unit/models/row_unit_spec.rb +0 -68
- data/testing/rspec/spec/unit/models/scenario_unit_spec.rb +0 -86
- data/testing/rspec/spec/unit/models/step_unit_spec.rb +0 -109
- data/testing/rspec/spec/unit/models/table_unit_spec.rb +0 -77
- data/testing/rspec/spec/unit/models/tag_unit_spec.rb +0 -68
- data/testing/rspec/spec/unit/named_unit_spec.rb +0 -23
- data/testing/rspec/spec/unit/nested_unit_spec.rb +0 -43
- data/testing/rspec/spec/unit/parsed_unit_spec.rb +0 -27
- data/testing/rspec/spec/unit/parsing_unit_spec.rb +0 -54
- data/testing/rspec/spec/unit/shared/bare_bones_models_unit_specs.rb +0 -14
- data/testing/rspec/spec/unit/shared/containing_models_unit_specs.rb +0 -127
- data/testing/rspec/spec/unit/shared/described_models_unit_specs.rb +0 -38
- data/testing/rspec/spec/unit/shared/keyworded_models_unit_specs.rb +0 -58
- data/testing/rspec/spec/unit/shared/models_unit_specs.rb +0 -15
- data/testing/rspec/spec/unit/shared/named_models_unit_specs.rb +0 -39
- data/testing/rspec/spec/unit/shared/nested_models_unit_specs.rb +0 -51
- data/testing/rspec/spec/unit/shared/parsed_models_unit_specs.rb +0 -39
- data/testing/rspec/spec/unit/shared/prepopulated_models_unit_specs.rb +0 -18
- data/testing/rspec/spec/unit/shared/sourced_models_unit_specs.rb +0 -39
- data/testing/rspec/spec/unit/shared/stepped_models_unit_specs.rb +0 -46
- data/testing/rspec/spec/unit/shared/stringifiable_models_unit_specs.rb +0 -18
- data/testing/rspec/spec/unit/shared/tagged_models_unit_specs.rb +0 -72
- data/testing/rspec/spec/unit/sourceable_unit_spec.rb +0 -27
- data/testing/rspec/spec/unit/stepped_unit_spec.rb +0 -23
- data/testing/rspec/spec/unit/taggable_unit_spec.rb +0 -69
- data/testing/test_languages.json +0 -45
- data/todo.txt +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b152c6307169c73e75c9e2b4798d29cab2c7b8ad7ed086c12a854739940d2eb
|
4
|
+
data.tar.gz: a50e43b9e28d514d22c0a756be7197e9a5395cdf38fcde50d34e8b1c0c41df53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 627d1c76575e4c2ed4b97ac2ee2db83c920997bc1296bdf6ecfc530ba92250d585c011fa9e315b2c52c28cd9c1f219da7cf1e79fe44e23d0ba868db3de48ffda
|
7
|
+
data.tar.gz: 3f1c554b800ed1a194d800d13ce9b39e5e4dd5655780e6e3ef007e7e2480d3139d5d8feec128d9db470cf3b8d0a996a5116af0a0770e80e20ee1899cbf661b3a
|
data/CHANGELOG.md
CHANGED
@@ -8,6 +8,60 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
8
8
|
|
9
9
|
Nothing yet...
|
10
10
|
|
11
|
+
## [3.2.0] - 2020-07-27
|
12
|
+
|
13
|
+
### Added
|
14
|
+
- The `Rule` keyword is now a modeled element.
|
15
|
+
|
16
|
+
### Deprecated
|
17
|
+
- `Feature#test_case_count` will be removed on the next major release. It's a random analysis method in what is
|
18
|
+
otherwise a purely abstraction layer library. The [CQL](https://github.com/enkessler/cql) gem is better suited to such tasks.
|
19
|
+
|
20
|
+
## [3.1.0] - 2020-06-28
|
21
|
+
|
22
|
+
### Added
|
23
|
+
- Support added for more versions of the `cucumber-gherkin` gem
|
24
|
+
- 14.x
|
25
|
+
|
26
|
+
### Fixed
|
27
|
+
- Text is converted to UTF-8 encoding before being passed to the underlying Gherkin gem. This is due to UTF-8 being
|
28
|
+
the only encoding supported by Gherkin. The `gherkin` gem did the conversion automatically and so this conversion
|
29
|
+
was not necessary previously but the `cucumber-gherkin` gem does not do any automatic conversion.
|
30
|
+
|
31
|
+
## [3.0.0] - 2020-06-08
|
32
|
+
|
33
|
+
### Changed
|
34
|
+
- This gem now wraps the `cucumber-gherkin` gem instead of the `gherkin` gem, now that `cucumber-gherkin` has superseded `gherkin`.
|
35
|
+
- Support for versions of Ruby earlier than 2.3 has been dropped due to that being the minimum required version of Ruby required by the `cucumber-gherkin` gem.
|
36
|
+
- When using the parsing functionality provided by this gem, the standardized AST returned when parsing Gherkin text is now returned directly as a Hash instead of also being wrapped in an array. The array was an artifact of basing the AST on the earliest versions of `gherkin` that were supported.
|
37
|
+
- No longer including every file in the Git repository as part of the gem. Only the files needed for using the gem (and the informative ones like the README) will be packaged into the released gem.
|
38
|
+
|
39
|
+
### Added
|
40
|
+
- Support added for more versions of the `cucumber-gherkin` gem
|
41
|
+
- 13.x
|
42
|
+
- 12.x
|
43
|
+
- 11.x
|
44
|
+
- 10.x
|
45
|
+
- 9.x
|
46
|
+
|
47
|
+
## [2.1.0] - 2020-05-27
|
48
|
+
|
49
|
+
### Added
|
50
|
+
- Support added for more versions of the `gherkin` gem
|
51
|
+
- 9.x
|
52
|
+
- 8.x
|
53
|
+
- 7.x
|
54
|
+
|
55
|
+
### Fixed
|
56
|
+
- Parsing errors are now correctly bubbled up when using Gherkin 6.x
|
57
|
+
|
58
|
+
## [2.0.0] - 2020-02-11
|
59
|
+
|
60
|
+
### Changed
|
61
|
+
|
62
|
+
- Step models now include doc strings and tables when determining their equality with other steps. Previously, only the base text of the step was included and the doc string/table was explicitly ignored.
|
63
|
+
|
64
|
+
|
11
65
|
## [1.5.1] - 2019-04-14
|
12
66
|
|
13
67
|
### Added
|
@@ -269,7 +323,12 @@ Nothing yet...
|
|
269
323
|
- Initial release
|
270
324
|
|
271
325
|
|
272
|
-
[Unreleased]: https://github.com/enkessler/cuke_modeler/compare/
|
326
|
+
[Unreleased]: https://github.com/enkessler/cuke_modeler/compare/v3.2.0...HEAD
|
327
|
+
[3.2.0]: https://github.com/enkessler/cuke_modeler/compare/v3.1.0...v3.2.0
|
328
|
+
[3.1.0]: https://github.com/enkessler/cuke_modeler/compare/v3.0.0...v3.1.0
|
329
|
+
[3.0.0]: https://github.com/enkessler/cuke_modeler/compare/v2.1.0...v3.0.0
|
330
|
+
[2.1.0]: https://github.com/enkessler/cuke_modeler/compare/v2.0.0...v2.1.0
|
331
|
+
[2.0.0]: https://github.com/enkessler/cuke_modeler/compare/v1.5.1...v2.0.0
|
273
332
|
[1.5.1]: https://github.com/enkessler/cuke_modeler/compare/v1.5.0...v1.5.1
|
274
333
|
[1.5.0]: https://github.com/enkessler/cuke_modeler/compare/v1.4.0...v1.5.0
|
275
334
|
[1.4.0]: https://github.com/enkessler/cuke_modeler/compare/v1.3.0...v1.4.0
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -8,11 +8,11 @@ User stuff:
|
|
8
8
|
[![Yard Docs](http://img.shields.io/badge/Documentation-API-blue.svg)](https://www.rubydoc.info/gems/cuke_modeler)
|
9
9
|
|
10
10
|
Developer stuff:
|
11
|
-
[![Build Status](https://travis-ci.org/enkessler/cuke_modeler.svg
|
12
|
-
[![Build status](https://ci.appveyor.com/api/projects/status/is8xqvoqn3pjh9l0
|
13
|
-
[![Coverage Status](https://coveralls.io/repos/github/enkessler/cuke_modeler/badge.svg
|
11
|
+
[![Build Status](https://travis-ci.org/enkessler/cuke_modeler.svg)](https://travis-ci.org/enkessler/cuke_modeler)
|
12
|
+
[![Build status](https://ci.appveyor.com/api/projects/status/is8xqvoqn3pjh9l0?svg=true)](https://ci.appveyor.com/project/enkessler/cuke-modeler)
|
13
|
+
[![Coverage Status](https://coveralls.io/repos/github/enkessler/cuke_modeler/badge.svg)](https://coveralls.io/github/enkessler/cuke_modeler)
|
14
14
|
[![Maintainability](https://api.codeclimate.com/v1/badges/83986d8f7a918fed9707/maintainability)](https://codeclimate.com/github/enkessler/cuke_modeler/maintainability)
|
15
|
-
[![Inline docs](http://inch-ci.org/github/enkessler/cuke_modeler.svg
|
15
|
+
[![Inline docs](http://inch-ci.org/github/enkessler/cuke_modeler.svg)](https://inch-ci.org/github/enkessler/cuke_modeler)
|
16
16
|
|
17
17
|
---
|
18
18
|
|
@@ -21,7 +21,7 @@ Developer stuff:
|
|
21
21
|
There comes a time in every programmer's adventures with Cucumber when they
|
22
22
|
want to do Really Cool Stuff with their tests. This usually necessitates
|
23
23
|
scanning all of their feature files and playing with the output. While the
|
24
|
-
**[gherkin](https://github.com/cucumber/gherkin)** gem does a fine job of parsing feature files, reading or even manipulating
|
24
|
+
**[cucumber-gherkin](https://github.com/cucumber/cucumber/tree/master/gherkin)** gem does a fine job of parsing feature files, reading or even manipulating
|
25
25
|
the resulting Abstract Syntax Tree is not always fun. **cuke_modeler** comes to
|
26
26
|
the rescue by providing a modeling layer that is easier to work with.
|
27
27
|
|
@@ -82,7 +82,8 @@ and setting their attributes afterward.
|
|
82
82
|
One could, if so inclined, use this method to dynamically edit or even create
|
83
83
|
an entire test suite!
|
84
84
|
|
85
|
-
For more information on the different models
|
85
|
+
For more information on the different models (which more or less have the same relation
|
86
|
+
to each other as described in the AST [here](https://github.com/cucumber/cucumber/tree/master/gherkin#ast)) and how to use them, see the
|
86
87
|
[documentation](https://app.cucumber.pro/projects/cuke_modeler).
|
87
88
|
|
88
89
|
## Modeling dialects other than English
|
@@ -126,13 +127,10 @@ that feature is ultimately run with SpecFlow (Cucumber for C#), Lettuce
|
|
126
127
|
* [cuke_linter](https://github.com/enkessler/cuke_linter)
|
127
128
|
|
128
129
|
|
129
|
-
## Contributing
|
130
|
+
## Development and Contributing
|
130
131
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
4. Push to the branch
|
137
|
-
`git push origin my-new-feature`
|
138
|
-
5. Create new Pull Request
|
132
|
+
See [CONTRIBUTING.md](https://github.com/enkessler/cuke_modeler/blob/master/CONTRIBUTING.md)
|
133
|
+
|
134
|
+
## License
|
135
|
+
|
136
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/cuke_modeler.gemspec
CHANGED
@@ -9,27 +9,30 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Eric Kessler"]
|
10
10
|
spec.email = ["morrow748@gmail.com"]
|
11
11
|
spec.summary = %q{A gem providing functionality to model Gherkin based test suites.}
|
12
|
-
spec.description = %q{This gem facilitates modeling a test suite that is written in Gherkin (e.g. Cucumber, SpecFlow, Lettuce, etc.). It does this by providing an abstraction layer on top of the Abstract Syntax Tree that the 'gherkin' gem generates when parsing features, as well as providing models for feature files and directories in order to be able to have a fully traversable model tree of a test suite's structure. These models can then be analyzed or manipulated more easily than the underlying AST layer.}
|
12
|
+
spec.description = %q{This gem facilitates modeling a test suite that is written in Gherkin (e.g. Cucumber, SpecFlow, Lettuce, etc.). It does this by providing an abstraction layer on top of the Abstract Syntax Tree that the 'cucumber-gherkin' gem generates when parsing features, as well as providing models for feature files and directories in order to be able to have a fully traversable model tree of a test suite's structure. These models can then be analyzed or manipulated more easily than the underlying AST layer.}
|
13
13
|
spec.homepage = 'https://github.com/enkessler/cuke_modeler'
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
spec.
|
16
|
+
# Specify which files should be added to the gem when it is released.
|
17
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
+
spec.files = Dir.chdir(File.expand_path('', __dir__)) do
|
19
|
+
source_controlled_files = `git ls-files -z`.split("\x0")
|
20
|
+
source_controlled_files.keep_if { |file| file =~ %r{^(lib|testing/cucumber/features)} }
|
21
|
+
source_controlled_files + ['README.md', 'LICENSE.txt', 'CHANGELOG.md', 'cuke_modeler.gemspec']
|
22
|
+
end
|
19
23
|
spec.require_paths = ["lib"]
|
20
24
|
|
21
|
-
spec.required_ruby_version = '>=
|
25
|
+
spec.required_ruby_version = '>= 2.3', '< 3.0'
|
22
26
|
|
23
|
-
spec.add_runtime_dependency 'gherkin', '<
|
24
|
-
spec.add_runtime_dependency('json', '>= 1.0', '< 3.0')
|
25
|
-
spec.add_runtime_dependency('multi_json', '~> 1.0')
|
27
|
+
spec.add_runtime_dependency 'cucumber-gherkin', '< 15.0'
|
26
28
|
|
27
29
|
spec.add_development_dependency 'bundler', '< 3.0'
|
28
30
|
spec.add_development_dependency "rake", '< 13.0.0'
|
29
31
|
spec.add_development_dependency 'cucumber', '< 5.0.0'
|
30
32
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
31
|
-
spec.add_development_dependency 'simplecov', '
|
33
|
+
spec.add_development_dependency 'simplecov', '<= 0.16.1'
|
32
34
|
spec.add_development_dependency 'racatt', '~> 1.0'
|
33
35
|
spec.add_development_dependency 'coveralls', '< 1.0.0'
|
34
36
|
spec.add_development_dependency 'rainbow', '< 4.0.0'
|
37
|
+
spec.add_development_dependency 'test-unit', '< 4.0.0'
|
35
38
|
end
|
data/lib/cuke_modeler.rb
CHANGED
@@ -19,6 +19,7 @@ require 'cuke_modeler/models/model'
|
|
19
19
|
require 'cuke_modeler/models/feature_file'
|
20
20
|
require 'cuke_modeler/models/directory'
|
21
21
|
require 'cuke_modeler/models/feature'
|
22
|
+
require 'cuke_modeler/models/rule'
|
22
23
|
require 'cuke_modeler/models/background'
|
23
24
|
require 'cuke_modeler/models/scenario'
|
24
25
|
require 'cuke_modeler/models/outline'
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require_relative 'gherkin_9_adapter'
|
2
|
+
|
3
|
+
|
4
|
+
module CukeModeler
|
5
|
+
|
6
|
+
# NOT A PART OF THE PUBLIC API
|
7
|
+
# An adapter that can convert the output of version 10.x of the *cucumber-gherkin* gem into input that is consumable by this gem.
|
8
|
+
|
9
|
+
class Gherkin10Adapter < Gherkin9Adapter
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require_relative 'gherkin_9_adapter'
|
2
|
+
|
3
|
+
|
4
|
+
module CukeModeler
|
5
|
+
|
6
|
+
# NOT A PART OF THE PUBLIC API
|
7
|
+
# An adapter that can convert the output of version 11.x of the *cucumber-gherkin* gem into input that is consumable by this gem.
|
8
|
+
|
9
|
+
class Gherkin11Adapter < Gherkin9Adapter
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require_relative 'gherkin_9_adapter'
|
2
|
+
|
3
|
+
|
4
|
+
module CukeModeler
|
5
|
+
|
6
|
+
# NOT A PART OF THE PUBLIC API
|
7
|
+
# An adapter that can convert the output of version 12.x of the *cucumber-gherkin* gem into input that is consumable by this gem.
|
8
|
+
|
9
|
+
class Gherkin12Adapter < Gherkin9Adapter
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require_relative 'gherkin_9_adapter'
|
2
|
+
|
3
|
+
|
4
|
+
module CukeModeler
|
5
|
+
|
6
|
+
# NOT A PART OF THE PUBLIC API
|
7
|
+
# An adapter that can convert the output of version 13.x of the *cucumber-gherkin* gem into input that is consumable by this gem.
|
8
|
+
|
9
|
+
class Gherkin13Adapter < Gherkin9Adapter
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require_relative 'gherkin_9_adapter'
|
2
|
+
|
3
|
+
|
4
|
+
module CukeModeler
|
5
|
+
|
6
|
+
# NOT A PART OF THE PUBLIC API
|
7
|
+
# An adapter that can convert the output of version 14.x of the *cucumber-gherkin* gem into input that is consumable by this gem.
|
8
|
+
|
9
|
+
class Gherkin14Adapter < Gherkin9Adapter
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
@@ -1,8 +1,9 @@
|
|
1
1
|
module CukeModeler
|
2
2
|
|
3
|
-
#
|
3
|
+
# NOT A PART OF THE PUBLIC API
|
4
|
+
# An adapter that can convert the output of version 9.x of the *cucumber-gherkin* gem into input that is consumable by this gem.
|
4
5
|
|
5
|
-
class
|
6
|
+
class Gherkin9Adapter
|
6
7
|
|
7
8
|
# Adapts the given AST into the shape that this gem expects
|
8
9
|
def adapt(parsed_ast)
|
@@ -10,20 +11,21 @@ module CukeModeler
|
|
10
11
|
parsed_ast['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_ast))
|
11
12
|
|
12
13
|
# Removing parsed data for child elements in order to avoid duplicating data
|
13
|
-
parsed_ast['cuke_modeler_parsing_data'][:feature] = nil
|
14
|
-
parsed_ast['cuke_modeler_parsing_data'][:comments] = nil
|
14
|
+
parsed_ast['cuke_modeler_parsing_data'][:feature] = nil if parsed_ast['cuke_modeler_parsing_data'][:feature]
|
15
|
+
parsed_ast['cuke_modeler_parsing_data'][:comments] = nil if parsed_ast['cuke_modeler_parsing_data'][:comments]
|
15
16
|
|
16
|
-
# Comments are stored on the feature file in gherkin 4.x
|
17
17
|
parsed_ast['comments'] = []
|
18
|
-
parsed_ast[:comments]
|
19
|
-
|
18
|
+
if parsed_ast[:comments]
|
19
|
+
parsed_ast[:comments].each do |comment|
|
20
|
+
adapt_comment!(comment)
|
21
|
+
end
|
22
|
+
parsed_ast['comments'].concat(parsed_ast.delete(:comments))
|
20
23
|
end
|
21
|
-
parsed_ast['comments'].concat(parsed_ast.delete(:comments))
|
22
24
|
|
23
25
|
adapt_feature!(parsed_ast[:feature]) if parsed_ast[:feature]
|
24
26
|
parsed_ast['feature'] = parsed_ast.delete(:feature)
|
25
27
|
|
26
|
-
|
28
|
+
parsed_ast
|
27
29
|
end
|
28
30
|
|
29
31
|
# Adapts the AST sub-tree that is rooted at the given feature node.
|
@@ -32,23 +34,27 @@ module CukeModeler
|
|
32
34
|
parsed_feature['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_feature))
|
33
35
|
|
34
36
|
# Removing parsed data for child elements in order to avoid duplicating data
|
35
|
-
parsed_feature['cuke_modeler_parsing_data'][:tags] = nil
|
36
|
-
parsed_feature['cuke_modeler_parsing_data'][:children] = nil
|
37
|
+
parsed_feature['cuke_modeler_parsing_data'][:tags] = nil if parsed_feature['cuke_modeler_parsing_data'][:tags]
|
38
|
+
parsed_feature['cuke_modeler_parsing_data'][:children] = nil if parsed_feature['cuke_modeler_parsing_data'][:children]
|
37
39
|
|
38
40
|
parsed_feature['keyword'] = parsed_feature.delete(:keyword)
|
39
41
|
parsed_feature['name'] = parsed_feature.delete(:name)
|
40
|
-
parsed_feature['description'] = parsed_feature.delete(:description)
|
42
|
+
parsed_feature['description'] = parsed_feature.delete(:description) || ''
|
41
43
|
parsed_feature['line'] = parsed_feature.delete(:location)[:line]
|
42
44
|
|
43
45
|
parsed_feature['elements'] = []
|
44
|
-
|
45
|
-
|
46
|
+
if parsed_feature[:children]
|
47
|
+
adapt_child_elements!(parsed_feature[:children])
|
48
|
+
parsed_feature['elements'].concat(parsed_feature.delete(:children))
|
49
|
+
end
|
46
50
|
|
47
51
|
parsed_feature['tags'] = []
|
48
|
-
parsed_feature[:tags]
|
49
|
-
|
52
|
+
if parsed_feature[:tags]
|
53
|
+
parsed_feature[:tags].each do |tag|
|
54
|
+
adapt_tag!(tag)
|
55
|
+
end
|
56
|
+
parsed_feature['tags'].concat(parsed_feature.delete(:tags))
|
50
57
|
end
|
51
|
-
parsed_feature['tags'].concat(parsed_feature.delete(:tags))
|
52
58
|
end
|
53
59
|
|
54
60
|
# Adapts the AST sub-tree that is rooted at the given background node.
|
@@ -57,76 +63,109 @@ module CukeModeler
|
|
57
63
|
parsed_background['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_background))
|
58
64
|
|
59
65
|
# Removing parsed data for child elements in order to avoid duplicating data
|
60
|
-
parsed_background['cuke_modeler_parsing_data'][:background][:steps] = nil
|
66
|
+
parsed_background['cuke_modeler_parsing_data'][:background][:steps] = nil if parsed_background['cuke_modeler_parsing_data'][:background][:steps]
|
61
67
|
|
62
68
|
parsed_background['type'] = 'Background'
|
63
69
|
parsed_background['keyword'] = parsed_background[:background].delete(:keyword)
|
64
70
|
parsed_background['name'] = parsed_background[:background].delete(:name)
|
65
|
-
parsed_background['description'] = parsed_background[:background].delete(:description)
|
71
|
+
parsed_background['description'] = parsed_background[:background].delete(:description) || ''
|
66
72
|
parsed_background['line'] = parsed_background[:background].delete(:location)[:line]
|
67
73
|
|
68
74
|
parsed_background['steps'] = []
|
69
|
-
parsed_background[:background][:steps]
|
70
|
-
|
75
|
+
if parsed_background[:background][:steps]
|
76
|
+
parsed_background[:background][:steps].each do |step|
|
77
|
+
adapt_step!(step)
|
78
|
+
end
|
79
|
+
parsed_background['steps'].concat(parsed_background[:background].delete(:steps))
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# Adapts the AST sub-tree that is rooted at the given rule node.
|
84
|
+
def adapt_rule!(parsed_rule)
|
85
|
+
# Saving off the original data
|
86
|
+
parsed_rule['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_rule))
|
87
|
+
|
88
|
+
# Removing parsed data for child elements in order to avoid duplicating data
|
89
|
+
parsed_rule['cuke_modeler_parsing_data'][:rule][:children] = nil if parsed_rule['cuke_modeler_parsing_data'][:rule][:children]
|
90
|
+
|
91
|
+
parsed_rule['type'] = 'Rule'
|
92
|
+
parsed_rule['keyword'] = parsed_rule[:rule].delete(:keyword)
|
93
|
+
parsed_rule['name'] = parsed_rule[:rule].delete(:name)
|
94
|
+
parsed_rule['description'] = parsed_rule[:rule].delete(:description) || ''
|
95
|
+
parsed_rule['line'] = parsed_rule[:rule].delete(:location)[:line]
|
96
|
+
|
97
|
+
parsed_rule['elements'] = []
|
98
|
+
if parsed_rule[:rule][:children]
|
99
|
+
adapt_child_elements!(parsed_rule[:rule][:children])
|
100
|
+
parsed_rule['elements'].concat(parsed_rule[:rule].delete(:children))
|
71
101
|
end
|
72
|
-
parsed_background['steps'].concat(parsed_background[:background].delete(:steps))
|
73
102
|
end
|
74
103
|
|
75
104
|
# Adapts the AST sub-tree that is rooted at the given scenario node.
|
76
105
|
def adapt_scenario!(parsed_test)
|
77
106
|
# Removing parsed data for child elements in order to avoid duplicating data
|
78
|
-
parsed_test['cuke_modeler_parsing_data'][:scenario][:tags] = nil
|
79
|
-
parsed_test['cuke_modeler_parsing_data'][:scenario][:steps] = nil
|
107
|
+
parsed_test['cuke_modeler_parsing_data'][:scenario][:tags] = nil if parsed_test['cuke_modeler_parsing_data'][:scenario][:tags]
|
108
|
+
parsed_test['cuke_modeler_parsing_data'][:scenario][:steps] = nil if parsed_test['cuke_modeler_parsing_data'][:scenario][:steps]
|
80
109
|
|
81
110
|
parsed_test['type'] = 'Scenario'
|
82
111
|
parsed_test['keyword'] = parsed_test[:scenario].delete(:keyword)
|
83
112
|
parsed_test['name'] = parsed_test[:scenario].delete(:name)
|
84
|
-
parsed_test['description'] = parsed_test[:scenario].delete(:description)
|
113
|
+
parsed_test['description'] = parsed_test[:scenario].delete(:description) || ''
|
85
114
|
parsed_test['line'] = parsed_test[:scenario].delete(:location)[:line]
|
86
115
|
|
87
116
|
parsed_test['tags'] = []
|
88
|
-
parsed_test[:scenario][:tags]
|
89
|
-
|
117
|
+
if parsed_test[:scenario][:tags]
|
118
|
+
parsed_test[:scenario][:tags].each do |tag|
|
119
|
+
adapt_tag!(tag)
|
120
|
+
end
|
121
|
+
parsed_test['tags'].concat(parsed_test[:scenario].delete(:tags))
|
90
122
|
end
|
91
|
-
parsed_test['tags'].concat(parsed_test[:scenario].delete(:tags))
|
92
123
|
|
93
124
|
parsed_test['steps'] = []
|
94
|
-
parsed_test[:scenario][:steps]
|
95
|
-
|
125
|
+
if parsed_test[:scenario][:steps]
|
126
|
+
parsed_test[:scenario][:steps].each do |step|
|
127
|
+
adapt_step!(step)
|
128
|
+
end
|
129
|
+
parsed_test['steps'].concat(parsed_test[:scenario].delete(:steps))
|
96
130
|
end
|
97
|
-
parsed_test['steps'].concat(parsed_test[:scenario].delete(:steps))
|
98
131
|
end
|
99
132
|
|
100
133
|
# Adapts the AST sub-tree that is rooted at the given outline node.
|
101
134
|
def adapt_outline!(parsed_test)
|
102
135
|
# Removing parsed data for child elements in order to avoid duplicating data
|
103
|
-
parsed_test['cuke_modeler_parsing_data'][:scenario][:tags] = nil
|
104
|
-
parsed_test['cuke_modeler_parsing_data'][:scenario][:steps] = nil
|
105
|
-
parsed_test['cuke_modeler_parsing_data'][:scenario][:examples] = nil
|
136
|
+
parsed_test['cuke_modeler_parsing_data'][:scenario][:tags] = nil if parsed_test['cuke_modeler_parsing_data'][:scenario][:tags]
|
137
|
+
parsed_test['cuke_modeler_parsing_data'][:scenario][:steps] = nil if parsed_test['cuke_modeler_parsing_data'][:scenario][:steps]
|
138
|
+
parsed_test['cuke_modeler_parsing_data'][:scenario][:examples] = nil if parsed_test['cuke_modeler_parsing_data'][:scenario][:examples]
|
106
139
|
|
107
140
|
parsed_test['type'] = 'ScenarioOutline'
|
108
141
|
parsed_test['keyword'] = parsed_test[:scenario].delete(:keyword)
|
109
142
|
parsed_test['name'] = parsed_test[:scenario].delete(:name)
|
110
|
-
parsed_test['description'] = parsed_test[:scenario].delete(:description)
|
143
|
+
parsed_test['description'] = parsed_test[:scenario].delete(:description) || ''
|
111
144
|
parsed_test['line'] = parsed_test[:scenario].delete(:location)[:line]
|
112
145
|
|
113
146
|
parsed_test['tags'] = []
|
114
|
-
parsed_test[:scenario][:tags]
|
115
|
-
|
147
|
+
if parsed_test[:scenario][:tags]
|
148
|
+
parsed_test[:scenario][:tags].each do |tag|
|
149
|
+
adapt_tag!(tag)
|
150
|
+
end
|
151
|
+
parsed_test['tags'].concat(parsed_test[:scenario].delete(:tags))
|
116
152
|
end
|
117
|
-
parsed_test['tags'].concat(parsed_test[:scenario].delete(:tags))
|
118
153
|
|
119
154
|
parsed_test['steps'] = []
|
120
|
-
parsed_test[:scenario][:steps]
|
121
|
-
|
155
|
+
if parsed_test[:scenario][:steps]
|
156
|
+
parsed_test[:scenario][:steps].each do |step|
|
157
|
+
adapt_step!(step)
|
158
|
+
end
|
159
|
+
parsed_test['steps'].concat(parsed_test[:scenario].delete(:steps))
|
122
160
|
end
|
123
|
-
parsed_test['steps'].concat(parsed_test[:scenario].delete(:steps))
|
124
161
|
|
125
162
|
parsed_test['examples'] = []
|
126
|
-
parsed_test[:scenario][:examples]
|
127
|
-
|
163
|
+
if parsed_test[:scenario][:examples]
|
164
|
+
parsed_test[:scenario][:examples].each do |step|
|
165
|
+
adapt_example!(step)
|
166
|
+
end
|
167
|
+
parsed_test['examples'].concat(parsed_test[:scenario].delete(:examples))
|
128
168
|
end
|
129
|
-
parsed_test['examples'].concat(parsed_test[:scenario].delete(:examples))
|
130
169
|
end
|
131
170
|
|
132
171
|
# Adapts the AST sub-tree that is rooted at the given example node.
|
@@ -135,14 +174,14 @@ module CukeModeler
|
|
135
174
|
parsed_example['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_example))
|
136
175
|
|
137
176
|
# Removing parsed data for child elements in order to avoid duplicating data
|
138
|
-
parsed_example['cuke_modeler_parsing_data'][:tags] = nil
|
139
|
-
parsed_example['cuke_modeler_parsing_data'][:table_header] = nil
|
140
|
-
parsed_example['cuke_modeler_parsing_data'][:table_body] = nil
|
177
|
+
parsed_example['cuke_modeler_parsing_data'][:tags] = nil if parsed_example['cuke_modeler_parsing_data'][:tags]
|
178
|
+
parsed_example['cuke_modeler_parsing_data'][:table_header] = nil if parsed_example['cuke_modeler_parsing_data'][:table_header]
|
179
|
+
parsed_example['cuke_modeler_parsing_data'][:table_body] = nil if parsed_example['cuke_modeler_parsing_data'][:table_body]
|
141
180
|
|
142
181
|
parsed_example['keyword'] = parsed_example.delete(:keyword)
|
143
182
|
parsed_example['name'] = parsed_example.delete(:name)
|
144
183
|
parsed_example['line'] = parsed_example.delete(:location)[:line]
|
145
|
-
parsed_example['description'] = parsed_example.delete(:description)
|
184
|
+
parsed_example['description'] = parsed_example.delete(:description) || ''
|
146
185
|
|
147
186
|
parsed_example['rows'] = []
|
148
187
|
|
@@ -152,19 +191,19 @@ module CukeModeler
|
|
152
191
|
end
|
153
192
|
|
154
193
|
if parsed_example[:table_body]
|
155
|
-
|
156
194
|
parsed_example[:table_body].each do |row|
|
157
195
|
adapt_table_row!(row)
|
158
196
|
end
|
159
197
|
parsed_example['rows'].concat(parsed_example.delete(:table_body))
|
160
198
|
end
|
161
199
|
|
162
|
-
|
163
200
|
parsed_example['tags'] = []
|
164
|
-
parsed_example[:tags]
|
165
|
-
|
201
|
+
if parsed_example[:tags]
|
202
|
+
parsed_example[:tags].each do |tag|
|
203
|
+
adapt_tag!(tag)
|
204
|
+
end
|
205
|
+
parsed_example['tags'].concat(parsed_example.delete(:tags))
|
166
206
|
end
|
167
|
-
parsed_example['tags'].concat(parsed_example.delete(:tags))
|
168
207
|
end
|
169
208
|
|
170
209
|
# Adapts the AST sub-tree that is rooted at the given tag node.
|
@@ -191,14 +230,13 @@ module CukeModeler
|
|
191
230
|
parsed_step['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_step))
|
192
231
|
|
193
232
|
# Removing parsed data for child elements in order to avoid duplicating data
|
194
|
-
parsed_step['cuke_modeler_parsing_data'][:data_table] = nil
|
195
|
-
parsed_step['cuke_modeler_parsing_data'][:doc_string] = nil
|
233
|
+
parsed_step['cuke_modeler_parsing_data'][:data_table] = nil if parsed_step['cuke_modeler_parsing_data'][:data_table]
|
234
|
+
parsed_step['cuke_modeler_parsing_data'][:doc_string] = nil if parsed_step['cuke_modeler_parsing_data'][:doc_string]
|
196
235
|
|
197
236
|
parsed_step['keyword'] = parsed_step.delete(:keyword)
|
198
237
|
parsed_step['name'] = parsed_step.delete(:text)
|
199
238
|
parsed_step['line'] = parsed_step.delete(:location)[:line]
|
200
239
|
|
201
|
-
|
202
240
|
case
|
203
241
|
when parsed_step[:doc_string]
|
204
242
|
adapt_doc_string!(parsed_step[:doc_string])
|
@@ -217,7 +255,7 @@ module CukeModeler
|
|
217
255
|
parsed_doc_string['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_doc_string))
|
218
256
|
|
219
257
|
parsed_doc_string['value'] = parsed_doc_string.delete(:content)
|
220
|
-
parsed_doc_string['content_type'] = parsed_doc_string.delete(:
|
258
|
+
parsed_doc_string['content_type'] = parsed_doc_string.delete(:media_type)
|
221
259
|
parsed_doc_string['line'] = parsed_doc_string.delete(:location)[:line]
|
222
260
|
end
|
223
261
|
|
@@ -245,7 +283,6 @@ module CukeModeler
|
|
245
283
|
# Removing parsed data for child elements in order to avoid duplicating data which the child elements will themselves include
|
246
284
|
parsed_table_row['cuke_modeler_parsing_data'][:cells] = nil
|
247
285
|
|
248
|
-
|
249
286
|
parsed_table_row['line'] = parsed_table_row.delete(:location)[:line]
|
250
287
|
|
251
288
|
parsed_table_row['cells'] = []
|
@@ -269,22 +306,22 @@ module CukeModeler
|
|
269
306
|
|
270
307
|
|
271
308
|
def adapt_child_elements!(parsed_children)
|
272
|
-
return if parsed_children.empty?
|
273
|
-
|
274
309
|
background_child = parsed_children.find { |child| child[:background] }
|
310
|
+
rule_children = parsed_children.select { |child| child[:rule] }
|
311
|
+
remaining_children = parsed_children.reject { |child| child[:background] || child[:rule] }
|
275
312
|
|
276
|
-
if background_child
|
277
|
-
|
313
|
+
adapt_background!(background_child) if background_child
|
314
|
+
adapt_rules!(rule_children)
|
315
|
+
adapt_tests!(remaining_children)
|
316
|
+
end
|
278
317
|
|
279
|
-
|
318
|
+
def adapt_rules!(parsed_rules)
|
319
|
+
parsed_rules.each do |rule|
|
320
|
+
adapt_rule!(rule)
|
280
321
|
end
|
281
|
-
|
282
|
-
adapt_tests!(remaining_children || parsed_children)
|
283
322
|
end
|
284
323
|
|
285
324
|
def adapt_tests!(parsed_tests)
|
286
|
-
return unless parsed_tests
|
287
|
-
|
288
325
|
parsed_tests.each do |test|
|
289
326
|
adapt_test!(test)
|
290
327
|
end
|
@@ -294,9 +331,8 @@ module CukeModeler
|
|
294
331
|
# Saving off the original data
|
295
332
|
parsed_test['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_test))
|
296
333
|
|
297
|
-
|
298
334
|
case
|
299
|
-
when parsed_test[:scenario] && parsed_test[:scenario][:examples].
|
335
|
+
when (parsed_test[:scenario] && parsed_test[:scenario][:examples]) || (parsed_test[:scenario] && Parsing.dialects[Parsing.dialect]['scenarioOutline'].include?(parsed_test[:scenario][:keyword]))
|
300
336
|
adapt_outline!(parsed_test)
|
301
337
|
when parsed_test[:scenario]
|
302
338
|
adapt_scenario!(parsed_test)
|