cuke_modeler 2.0.0 → 3.3.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 +59 -2
- data/README.md +14 -16
- 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_15_adapter.rb +12 -0
- data/lib/cuke_modeler/adapters/{gherkin_6_adapter.rb → gherkin_9_adapter.rb} +104 -69
- data/lib/cuke_modeler/containing.rb +15 -5
- 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 +1 -1
- data/lib/cuke_modeler/models/table.rb +1 -1
- data/lib/cuke_modeler/models/tag.rb +1 -1
- data/lib/cuke_modeler/parsing.rb +89 -110
- data/lib/cuke_modeler/version.rb +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 -63
- data/Gemfile +0 -37
- data/Rakefile +0 -73
- data/appveyor.yml +0 -61
- data/lib/cuke_modeler/adapters/gherkin_2_adapter.rb +0 -274
- data/lib/cuke_modeler/adapters/gherkin_3_adapter.rb +0 -297
- data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +0 -309
- 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 -49
- 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 -181
- 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 -569
- 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 -136
- 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 -25
data/.gitignore
DELETED
data/.simplecov
DELETED
data/.travis.yml
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
os:
|
2
|
-
- linux
|
3
|
-
- osx
|
4
|
-
|
5
|
-
# JRuby isn't working on the new default distribution
|
6
|
-
dist: trusty
|
7
|
-
|
8
|
-
language: ruby
|
9
|
-
rvm:
|
10
|
-
- 1.8.7
|
11
|
-
- 1.9.3
|
12
|
-
- 2.3.8
|
13
|
-
- 2.4.5
|
14
|
-
- 2.5.3
|
15
|
-
- 2.6.0
|
16
|
-
- jruby-9.1.7.0
|
17
|
-
|
18
|
-
gemfile:
|
19
|
-
- testing/gemfiles/gherkin2.gemfile
|
20
|
-
- testing/gemfiles/gherkin3.gemfile
|
21
|
-
- testing/gemfiles/gherkin4.gemfile
|
22
|
-
- testing/gemfiles/gherkin5.gemfile
|
23
|
-
- testing/gemfiles/gherkin6.gemfile
|
24
|
-
|
25
|
-
matrix:
|
26
|
-
exclude:
|
27
|
-
# gherkin 3.x does not work with Ruby 1.8.x
|
28
|
-
- rvm: 1.8.7
|
29
|
-
gemfile: testing/gemfiles/gherkin3.gemfile
|
30
|
-
# gherkin 4.x does not work with Ruby 1.8.x
|
31
|
-
- rvm: 1.8.7
|
32
|
-
gemfile: testing/gemfiles/gherkin4.gemfile
|
33
|
-
# gherkin 5.x does not work with Ruby 1.8.x
|
34
|
-
- rvm: 1.8.7
|
35
|
-
gemfile: testing/gemfiles/gherkin5.gemfile
|
36
|
-
# gherkin 6.x does not work with Ruby 1.8.x
|
37
|
-
- rvm: 1.8.7
|
38
|
-
gemfile: testing/gemfiles/gherkin6.gemfile
|
39
|
-
# gherkin 6.x does not work with Ruby 1.9.x
|
40
|
-
- rvm: 1.9.3
|
41
|
-
gemfile: testing/gemfiles/gherkin6.gemfile
|
42
|
-
|
43
|
-
# TODO: use once protobuf is updated
|
44
|
-
# gherkin 6.x uses protobuf, which does not work with Ruby 2.6.x
|
45
|
-
- rvm: 2.6.0
|
46
|
-
gemfile: testing/gemfiles/gherkin6.gemfile
|
47
|
-
|
48
|
-
# TODO: turn this back on
|
49
|
-
# gherkin 6.x relies on 'google-protobuf', which does not currently work on JRuby (https://github.com/protocolbuffers/protobuf/issues/1594)
|
50
|
-
- rvm: jruby-9.1.7.0
|
51
|
-
gemfile: testing/gemfiles/gherkin6.gemfile
|
52
|
-
|
53
|
-
# Travis does not provide 1.8.7 on OSX
|
54
|
-
- rvm: 1.8.7
|
55
|
-
os: osx
|
56
|
-
# Travis does not provide 1.9.3 on OSX
|
57
|
-
- rvm: 1.9.3
|
58
|
-
os: osx
|
59
|
-
|
60
|
-
before_install:
|
61
|
-
- gem install bundler -v '< 2'
|
62
|
-
|
63
|
-
script: bundle exec rake cuke_modeler:ci_build
|
data/Gemfile
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
source 'http://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in cuke_modeler.gemspec
|
4
|
-
gemspec
|
5
|
-
|
6
|
-
# cuke_modeler can play with pretty much any version of these but they all play differently with Ruby
|
7
|
-
|
8
|
-
if RUBY_VERSION =~ /^1\./
|
9
|
-
|
10
|
-
if RbConfig::CONFIG['host_os'].downcase =~ /mswin|msys|mingw32/
|
11
|
-
gem 'ffi', '< 1.9.15' # The 'ffi' gem, for Windows, requires Ruby 2.x on/after this version
|
12
|
-
end
|
13
|
-
|
14
|
-
gem 'unf_ext', '< 0.0.7.3' # Requires Ruby 2.x on/after this version
|
15
|
-
gem 'tins', '< 1.7' # The 'tins' gem requires Ruby 2.x on/after this version
|
16
|
-
gem 'json', '< 2.0' # The 'json' gem drops pre-Ruby 2.x support on/after this version
|
17
|
-
gem 'term-ansicolor', '< 1.4' # The 'term-ansicolor' gem requires Ruby 2.x on/after this version
|
18
|
-
|
19
|
-
if RUBY_VERSION =~ /^1\.8/
|
20
|
-
gem 'cucumber', '~> 1.0' # Ruby 1.8.x support dropped after this version
|
21
|
-
gem 'gherkin', '< 2.12.1' # Ruby 1.8.x support dropped after this version
|
22
|
-
gem 'rainbow', '< 2.0' # Ruby 1.8.x support dropped after this version
|
23
|
-
gem 'rake', '< 11.0' # Ruby 1.8.x support dropped after this version
|
24
|
-
else
|
25
|
-
gem 'rake', '< 12.3.0' # Ruby 1.9.x support dropped after this version
|
26
|
-
gem 'cucumber', '< 3.0.0' # Ruby 1.9.x support dropped after this version
|
27
|
-
end
|
28
|
-
|
29
|
-
elsif RUBY_VERSION =~ /^2\./
|
30
|
-
|
31
|
-
if RUBY_VERSION =~ /^2\.[23456789]/
|
32
|
-
gem 'test-unit'
|
33
|
-
end
|
34
|
-
|
35
|
-
gem 'gherkin', '~> 6.0'
|
36
|
-
gem 'cucumber', '~>4.0.rc'
|
37
|
-
end
|
data/Rakefile
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require 'rake'
|
3
|
-
require 'racatt'
|
4
|
-
require 'coveralls/rake/task'
|
5
|
-
require 'rainbow'
|
6
|
-
|
7
|
-
|
8
|
-
Rainbow.enabled = true
|
9
|
-
|
10
|
-
namespace 'racatt' do
|
11
|
-
Racatt.create_tasks
|
12
|
-
end
|
13
|
-
|
14
|
-
|
15
|
-
namespace 'cuke_modeler' do
|
16
|
-
|
17
|
-
desc 'Removes the current code coverage data'
|
18
|
-
task :clear_coverage do
|
19
|
-
code_coverage_directory = "#{File.dirname(__FILE__)}/coverage"
|
20
|
-
|
21
|
-
FileUtils.remove_dir(code_coverage_directory, true)
|
22
|
-
end
|
23
|
-
|
24
|
-
desc 'Check documentation with RDoc'
|
25
|
-
task :check_documentation do
|
26
|
-
output = `rdoc lib -C`
|
27
|
-
puts output
|
28
|
-
|
29
|
-
if output =~ /100.00% documented/
|
30
|
-
puts Rainbow('All code documented').green
|
31
|
-
else
|
32
|
-
raise Rainbow('Parts of the gem are undocumented').red
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
desc 'Run all of the tests'
|
37
|
-
task :test_everything => [:clear_coverage] do
|
38
|
-
rspec_args = '--tag ~@wip --pattern "testing/rspec/spec/**/*_spec.rb" --force-color'
|
39
|
-
|
40
|
-
cucumber_version = Gem.loaded_specs['cucumber'].version.version
|
41
|
-
|
42
|
-
if cucumber_version =~ /^[123]\./
|
43
|
-
cucumber_args = 'testing/cucumber/features -r testing/cucumber/support -r testing/cucumber/step_definitions -f progress -t ~@wip --color'
|
44
|
-
else
|
45
|
-
cucumber_args = "testing/cucumber/features -r testing/cucumber/support -r testing/cucumber/step_definitions -f progress -t 'not @wip' --color"
|
46
|
-
end
|
47
|
-
|
48
|
-
Rake::Task['racatt:test_everything'].invoke(rspec_args, cucumber_args)
|
49
|
-
end
|
50
|
-
|
51
|
-
# creates coveralls:push task
|
52
|
-
Coveralls::RakeTask.new
|
53
|
-
|
54
|
-
desc 'The task that CI will run. Do not run locally.'
|
55
|
-
task :ci_build => ['cuke_modeler:test_everything', 'coveralls:push']
|
56
|
-
|
57
|
-
desc 'Check that things look good before trying to release'
|
58
|
-
task :prerelease_check do
|
59
|
-
begin
|
60
|
-
Rake::Task['cuke_modeler:test_everything'].invoke
|
61
|
-
Rake::Task['cuke_modeler:check_documentation'].invoke
|
62
|
-
rescue => e
|
63
|
-
puts Rainbow("Something isn't right!").red
|
64
|
-
raise e
|
65
|
-
end
|
66
|
-
|
67
|
-
puts Rainbow('All is well. :)').green
|
68
|
-
end
|
69
|
-
|
70
|
-
end
|
71
|
-
|
72
|
-
|
73
|
-
task :default => 'cuke_modeler:test_everything'
|
data/appveyor.yml
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
version: '1.0.{build}'
|
2
|
-
|
3
|
-
environment:
|
4
|
-
matrix:
|
5
|
-
|
6
|
-
# Gherkin 2.x does not appear to support 32-bit Ruby 2.x and it's not worth it to investigate if this is true or not
|
7
|
-
- RUBY_VERSION: 24-x64
|
8
|
-
BUNDLE_GEMFILE: testing/gemfiles/gherkin2.gemfile
|
9
|
-
- RUBY_VERSION: 25-x64
|
10
|
-
BUNDLE_GEMFILE: testing/gemfiles/gherkin2.gemfile
|
11
|
-
|
12
|
-
- RUBY_VERSION: 24
|
13
|
-
BUNDLE_GEMFILE: testing/gemfiles/gherkin3.gemfile
|
14
|
-
- RUBY_VERSION: 24-x64
|
15
|
-
BUNDLE_GEMFILE: testing/gemfiles/gherkin3.gemfile
|
16
|
-
- RUBY_VERSION: 25
|
17
|
-
BUNDLE_GEMFILE: testing/gemfiles/gherkin3.gemfile
|
18
|
-
- RUBY_VERSION: 25-x64
|
19
|
-
BUNDLE_GEMFILE: testing/gemfiles/gherkin3.gemfile
|
20
|
-
|
21
|
-
- RUBY_VERSION: 24
|
22
|
-
BUNDLE_GEMFILE: testing/gemfiles/gherkin4.gemfile
|
23
|
-
- RUBY_VERSION: 24-x64
|
24
|
-
BUNDLE_GEMFILE: testing/gemfiles/gherkin4.gemfile
|
25
|
-
- RUBY_VERSION: 25
|
26
|
-
BUNDLE_GEMFILE: testing/gemfiles/gherkin4.gemfile
|
27
|
-
- RUBY_VERSION: 25-x64
|
28
|
-
BUNDLE_GEMFILE: testing/gemfiles/gherkin4.gemfile
|
29
|
-
|
30
|
-
- RUBY_VERSION: 24
|
31
|
-
BUNDLE_GEMFILE: testing/gemfiles/gherkin5.gemfile
|
32
|
-
- RUBY_VERSION: 24-x64
|
33
|
-
BUNDLE_GEMFILE: testing/gemfiles/gherkin5.gemfile
|
34
|
-
- RUBY_VERSION: 25
|
35
|
-
BUNDLE_GEMFILE: testing/gemfiles/gherkin5.gemfile
|
36
|
-
- RUBY_VERSION: 25-x64
|
37
|
-
BUNDLE_GEMFILE: testing/gemfiles/gherkin5.gemfile
|
38
|
-
|
39
|
-
# Gherkin 6.x requires at least Ruby 2.2
|
40
|
-
- RUBY_VERSION: 24
|
41
|
-
BUNDLE_GEMFILE: testing/gemfiles/gherkin6.gemfile
|
42
|
-
- RUBY_VERSION: 24-x64
|
43
|
-
BUNDLE_GEMFILE: testing/gemfiles/gherkin6.gemfile
|
44
|
-
- RUBY_VERSION: 25
|
45
|
-
BUNDLE_GEMFILE: testing/gemfiles/gherkin6.gemfile
|
46
|
-
- RUBY_VERSION: 25-x64
|
47
|
-
BUNDLE_GEMFILE: testing/gemfiles/gherkin6.gemfile
|
48
|
-
|
49
|
-
install:
|
50
|
-
- set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
|
51
|
-
- bundle install
|
52
|
-
|
53
|
-
build: off
|
54
|
-
|
55
|
-
before_test:
|
56
|
-
- ruby -v
|
57
|
-
- gem -v
|
58
|
-
- bundle -v
|
59
|
-
|
60
|
-
test_script:
|
61
|
-
- bundle exec rake cuke_modeler:ci_build
|
@@ -1,274 +0,0 @@
|
|
1
|
-
module CukeModeler
|
2
|
-
|
3
|
-
# NOT A PART OF THE PUBLIC API
|
4
|
-
# An adapter that can convert the output of version 2.x of the *gherkin* gem into input that is consumable by this gem.
|
5
|
-
|
6
|
-
class Gherkin2Adapter
|
7
|
-
|
8
|
-
# Adapts the given AST into the shape that this gem expects
|
9
|
-
def adapt(parsed_ast)
|
10
|
-
parsed_data = {}
|
11
|
-
|
12
|
-
# The entire AST is just an array with one feature and we don't want to save any child data so...an empty array
|
13
|
-
parsed_data['cuke_modeler_parsing_data'] = []
|
14
|
-
|
15
|
-
# Comments are stored on child elements in gherkin 2.x
|
16
|
-
comments = []
|
17
|
-
|
18
|
-
# An AST is just one feature
|
19
|
-
adapt_feature!(parsed_ast.first, comments) if parsed_ast.first
|
20
|
-
parsed_data['feature'] = parsed_ast.first
|
21
|
-
|
22
|
-
# Adapt and store comments once they have all been gathered
|
23
|
-
comments.each do |comment|
|
24
|
-
adapt_comment!(comment)
|
25
|
-
end
|
26
|
-
parsed_data['comments'] = comments
|
27
|
-
|
28
|
-
|
29
|
-
[parsed_data]
|
30
|
-
end
|
31
|
-
|
32
|
-
# Adapts the AST sub-tree that is rooted at the given feature node.
|
33
|
-
def adapt_feature!(parsed_feature, gathered_comments)
|
34
|
-
# Saving off the original data
|
35
|
-
parsed_feature['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_feature))
|
36
|
-
|
37
|
-
# Removing parsed data for child elements in order to avoid duplicating data
|
38
|
-
parsed_feature['cuke_modeler_parsing_data']['tags'] = nil
|
39
|
-
parsed_feature['cuke_modeler_parsing_data']['elements'] = nil
|
40
|
-
|
41
|
-
if parsed_feature['comments']
|
42
|
-
parsed_feature['cuke_modeler_parsing_data']['comments'] = nil
|
43
|
-
gathered_comments.concat(parsed_feature['comments'])
|
44
|
-
end
|
45
|
-
|
46
|
-
adapt_child_elements!(parsed_feature, gathered_comments)
|
47
|
-
|
48
|
-
if parsed_feature['tags']
|
49
|
-
parsed_feature['tags'].each do |tag|
|
50
|
-
adapt_tag!(tag)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
# Adapts the AST sub-tree that is rooted at the given background node.
|
56
|
-
def adapt_background!(parsed_background, gathered_comments)
|
57
|
-
# Saving off the original data
|
58
|
-
parsed_background['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_background))
|
59
|
-
|
60
|
-
# Removing parsed data for child elements in order to avoid duplicating data
|
61
|
-
parsed_background['cuke_modeler_parsing_data']['steps'] = nil
|
62
|
-
|
63
|
-
if parsed_background['comments']
|
64
|
-
parsed_background['cuke_modeler_parsing_data']['comments'] = nil
|
65
|
-
gathered_comments.concat(parsed_background['comments'])
|
66
|
-
end
|
67
|
-
|
68
|
-
if parsed_background['steps']
|
69
|
-
parsed_background['steps'].each do |step|
|
70
|
-
adapt_step!(step, gathered_comments)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
# Adapts the AST sub-tree that is rooted at the given scenario node.
|
76
|
-
def adapt_scenario!(parsed_scenario, gathered_comments)
|
77
|
-
# Saving off the original data
|
78
|
-
parsed_scenario['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_scenario))
|
79
|
-
|
80
|
-
# Removing parsed data for child elements in order to avoid duplicating data
|
81
|
-
parsed_scenario['cuke_modeler_parsing_data']['tags'] = nil
|
82
|
-
parsed_scenario['cuke_modeler_parsing_data']['steps'] = nil
|
83
|
-
|
84
|
-
if parsed_scenario['comments']
|
85
|
-
parsed_scenario['cuke_modeler_parsing_data']['comments'] = nil
|
86
|
-
gathered_comments.concat(parsed_scenario['comments'])
|
87
|
-
end
|
88
|
-
|
89
|
-
if parsed_scenario['tags']
|
90
|
-
parsed_scenario['tags'].each do |tag|
|
91
|
-
adapt_tag!(tag)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
if parsed_scenario['steps']
|
96
|
-
parsed_scenario['steps'].each do |step|
|
97
|
-
adapt_step!(step, gathered_comments)
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
# Adapts the AST sub-tree that is rooted at the given outline node.
|
103
|
-
def adapt_outline!(parsed_outline, gathered_comments)
|
104
|
-
# Saving off the original data
|
105
|
-
parsed_outline['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_outline))
|
106
|
-
|
107
|
-
# Removing parsed data for child elements in order to avoid duplicating data
|
108
|
-
parsed_outline['cuke_modeler_parsing_data']['tags'] = nil
|
109
|
-
parsed_outline['cuke_modeler_parsing_data']['steps'] = nil
|
110
|
-
parsed_outline['cuke_modeler_parsing_data']['examples'] = nil
|
111
|
-
|
112
|
-
if parsed_outline['comments']
|
113
|
-
parsed_outline['cuke_modeler_parsing_data']['comments'] = nil
|
114
|
-
gathered_comments.concat(parsed_outline['comments'])
|
115
|
-
end
|
116
|
-
|
117
|
-
if parsed_outline['tags']
|
118
|
-
parsed_outline['tags'].each do |tag|
|
119
|
-
adapt_tag!(tag)
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
if parsed_outline['steps']
|
124
|
-
parsed_outline['steps'].each do |step|
|
125
|
-
adapt_step!(step, gathered_comments)
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
if parsed_outline['examples']
|
130
|
-
parsed_outline['examples'].each do |example|
|
131
|
-
adapt_example!(example, gathered_comments)
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
# Adapts the AST sub-tree that is rooted at the given example node.
|
137
|
-
def adapt_example!(parsed_example, gathered_comments)
|
138
|
-
# Saving off the original data
|
139
|
-
parsed_example['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_example))
|
140
|
-
|
141
|
-
# Removing parsed data for child elements in order to avoid duplicating data
|
142
|
-
parsed_example['cuke_modeler_parsing_data']['tags'] = nil
|
143
|
-
parsed_example['cuke_modeler_parsing_data']['rows'] = nil
|
144
|
-
|
145
|
-
if parsed_example['comments']
|
146
|
-
parsed_example['cuke_modeler_parsing_data']['comments'] = nil
|
147
|
-
gathered_comments.concat(parsed_example['comments'])
|
148
|
-
end
|
149
|
-
|
150
|
-
parsed_example['rows'].each do |row|
|
151
|
-
adapt_table_row!(row, gathered_comments)
|
152
|
-
end
|
153
|
-
|
154
|
-
if parsed_example['tags']
|
155
|
-
parsed_example['tags'].each do |tag|
|
156
|
-
adapt_tag!(tag)
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
# Adapts the AST sub-tree that is rooted at the given tag node.
|
162
|
-
def adapt_tag!(parsed_tag)
|
163
|
-
# Saving off the original data
|
164
|
-
parsed_tag['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_tag))
|
165
|
-
end
|
166
|
-
|
167
|
-
# Adapts the AST sub-tree that is rooted at the given comment node.
|
168
|
-
def adapt_comment!(parsed_comment)
|
169
|
-
# Saving off the original data
|
170
|
-
parsed_comment['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_comment))
|
171
|
-
|
172
|
-
parsed_comment['text'] = parsed_comment.delete('value')
|
173
|
-
parsed_comment['line'] = parsed_comment.delete('line')
|
174
|
-
end
|
175
|
-
|
176
|
-
# Adapts the AST sub-tree that is rooted at the given step node.
|
177
|
-
def adapt_step!(parsed_step, gathered_comments)
|
178
|
-
# Saving off the original data
|
179
|
-
parsed_step['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_step))
|
180
|
-
|
181
|
-
# Removing parsed data for child elements in order to avoid duplicating data
|
182
|
-
parsed_step['cuke_modeler_parsing_data']['rows'] = nil if parsed_step['cuke_modeler_parsing_data']['rows']
|
183
|
-
parsed_step['cuke_modeler_parsing_data']['doc_string'] = nil if parsed_step['cuke_modeler_parsing_data']['doc_string']
|
184
|
-
|
185
|
-
if parsed_step['comments']
|
186
|
-
parsed_step['cuke_modeler_parsing_data']['comments'] = nil
|
187
|
-
gathered_comments.concat(parsed_step['comments'])
|
188
|
-
end
|
189
|
-
|
190
|
-
adapt_doc_string!(parsed_step['doc_string']) if parsed_step['doc_string']
|
191
|
-
|
192
|
-
if parsed_step['rows']
|
193
|
-
parsed_step['table'] = {'rows' => parsed_step['rows']}
|
194
|
-
adapt_step_table!(parsed_step['table'], gathered_comments)
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
# Adapts the AST sub-tree that is rooted at the given doc string node.
|
199
|
-
def adapt_doc_string!(parsed_doc_string)
|
200
|
-
# Saving off the original data
|
201
|
-
parsed_doc_string['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_doc_string))
|
202
|
-
end
|
203
|
-
|
204
|
-
# Adapts the AST sub-tree that is rooted at the given table node.
|
205
|
-
def adapt_step_table!(parsed_step_table, gathered_comments)
|
206
|
-
# Saving off the original data
|
207
|
-
parsed_step_table['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_step_table['rows']))
|
208
|
-
|
209
|
-
# Removing parsed data for child elements in order to avoid duplicating data
|
210
|
-
parsed_step_table['cuke_modeler_parsing_data'].clear
|
211
|
-
|
212
|
-
|
213
|
-
parsed_step_table['line'] = parsed_step_table['rows'].first['line']
|
214
|
-
|
215
|
-
parsed_step_table['rows'].each do |row|
|
216
|
-
adapt_table_row!(row, gathered_comments)
|
217
|
-
end
|
218
|
-
end
|
219
|
-
|
220
|
-
# Adapts the AST sub-tree that is rooted at the given row node.
|
221
|
-
def adapt_table_row!(parsed_table_row, gathered_comments)
|
222
|
-
# Saving off the original data
|
223
|
-
parsed_table_row['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_table_row))
|
224
|
-
|
225
|
-
# Removing parsed data for child elements in order to avoid duplicating data which the child elements will themselves include
|
226
|
-
parsed_table_row['cuke_modeler_parsing_data']['cells'] = nil
|
227
|
-
|
228
|
-
if parsed_table_row['comments']
|
229
|
-
parsed_table_row['cuke_modeler_parsing_data']['comments'] = nil
|
230
|
-
gathered_comments.concat(parsed_table_row['comments'])
|
231
|
-
end
|
232
|
-
|
233
|
-
parsed_table_row['cells'].collect! do |cell|
|
234
|
-
create_cell_for(cell, parsed_table_row['line'])
|
235
|
-
end
|
236
|
-
end
|
237
|
-
|
238
|
-
# Adapts the AST sub-tree that is rooted at the given cell node.
|
239
|
-
def create_cell_for(parsed_cell, line_number)
|
240
|
-
cell = {}
|
241
|
-
|
242
|
-
# Saving off the original data
|
243
|
-
cell['cuke_modeler_parsing_data'] = Marshal::load(Marshal.dump(parsed_cell))
|
244
|
-
|
245
|
-
cell['value'] = parsed_cell
|
246
|
-
cell['line'] = line_number
|
247
|
-
|
248
|
-
|
249
|
-
cell
|
250
|
-
end
|
251
|
-
|
252
|
-
|
253
|
-
private
|
254
|
-
|
255
|
-
|
256
|
-
def adapt_child_elements!(parsed_feature, gathered_comments)
|
257
|
-
if parsed_feature['elements']
|
258
|
-
parsed_feature['elements'].each do |element|
|
259
|
-
case element['type']
|
260
|
-
when 'background'
|
261
|
-
adapt_background!(element, gathered_comments)
|
262
|
-
when 'scenario'
|
263
|
-
adapt_scenario!(element, gathered_comments)
|
264
|
-
when 'scenario_outline'
|
265
|
-
adapt_outline!(element, gathered_comments)
|
266
|
-
else
|
267
|
-
raise(ArgumentError, "Unknown element type: #{element['type']}")
|
268
|
-
end
|
269
|
-
end
|
270
|
-
end
|
271
|
-
end
|
272
|
-
|
273
|
-
end
|
274
|
-
end
|