cuke_modeler 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +16 -0
  3. data/Gemfile +11 -3
  4. data/History.md +5 -0
  5. data/LICENSE.txt +1 -1
  6. data/Rakefile +8 -1
  7. data/appveyor.yml +7 -12
  8. data/cuke_modeler.gemspec +2 -2
  9. data/lib/cuke_modeler/adapters/gherkin_6_adapter.rb +309 -0
  10. data/lib/cuke_modeler/parsing.rb +28 -5
  11. data/lib/cuke_modeler/version.rb +1 -1
  12. data/testing/cucumber/step_definitions/feature_file_steps.rb +1 -1
  13. data/testing/cucumber/step_definitions/modeling_steps.rb +2 -2
  14. data/testing/cucumber/step_definitions/verification_steps.rb +3 -2
  15. data/testing/file_helper.rb +3 -0
  16. data/testing/gemfiles/gherkin2.gemfile +7 -0
  17. data/testing/gemfiles/gherkin3.gemfile +6 -0
  18. data/testing/gemfiles/gherkin4.gemfile +7 -0
  19. data/testing/gemfiles/gherkin5.gemfile +6 -0
  20. data/testing/gemfiles/gherkin6.gemfile +10 -0
  21. data/testing/rspec/spec/integration/background_integration_spec.rb +80 -72
  22. data/testing/rspec/spec/integration/cell_integration_spec.rb +28 -20
  23. data/testing/rspec/spec/integration/comment_integration_spec.rb +11 -3
  24. data/testing/rspec/spec/integration/directory_integration_spec.rb +2 -2
  25. data/testing/rspec/spec/integration/doc_string_integration_spec.rb +26 -18
  26. data/testing/rspec/spec/integration/example_integration_spec.rb +75 -61
  27. data/testing/rspec/spec/integration/feature_file_integration_spec.rb +30 -20
  28. data/testing/rspec/spec/integration/feature_integration_spec.rb +106 -98
  29. data/testing/rspec/spec/integration/gherkin_2_adapter_spec.rb +11 -11
  30. data/testing/rspec/spec/integration/gherkin_3_adapter_spec.rb +11 -11
  31. data/testing/rspec/spec/integration/gherkin_4_adapter_spec.rb +12 -12
  32. data/testing/rspec/spec/integration/gherkin_6_adapter_spec.rb +166 -0
  33. data/testing/rspec/spec/integration/outline_integration_spec.rb +116 -102
  34. data/testing/rspec/spec/integration/parsing_integration_spec.rb +16 -4
  35. data/testing/rspec/spec/integration/row_integration_spec.rb +26 -18
  36. data/testing/rspec/spec/integration/scenario_integration_spec.rb +82 -74
  37. data/testing/rspec/spec/integration/step_integration_spec.rb +65 -49
  38. data/testing/rspec/spec/integration/table_integration_spec.rb +25 -17
  39. data/testing/rspec/spec/integration/tag_integration_spec.rb +27 -19
  40. data/testing/rspec/spec/spec_helper.rb +64 -35
  41. data/todo.txt +3 -1
  42. metadata +10 -8
  43. data/testing/cucumber/support/transforms.rb +0 -3
@@ -26,65 +26,94 @@ require "#{this_dir}/unit/shared/keyworded_models_unit_specs"
26
26
  require "#{this_dir}/../../dialect_helper"
27
27
  require "#{this_dir}/../../file_helper"
28
28
 
29
- # Use a fake dialect for testing in order to avoid hard coded language assumptions in the
30
- # implementation. Only possible with newer versions of Gherkin.
31
- if Gem.loaded_specs['gherkin'].version.version[/^2\./]
32
- CukeModeler::DialectHelper.set_dialect(Gherkin::I18n::LANGUAGES['en'])
33
- CukeModeler::Parsing.dialect = 'en'
34
- else
35
- dialect_file_path = "#{this_dir}/../../test_languages.json"
36
- test_dialects = JSON.parse File.open(dialect_file_path, 'r:UTF-8').read
29
+ # Use a random dialect for testing in order to avoid hard coded language assumptions in the
30
+ # implementation and making the test dialect the default dialect so that language headers
31
+ # aren't needed for all of the test code. Only possible with some versions of Gherkin.
37
32
 
38
- Gherkin::DIALECTS.merge!(test_dialects)
33
+ gherkin_version = Gem.loaded_specs['gherkin'].version.version
39
34
 
35
+ case gherkin_version
36
+ when /^6\./
37
+ # gherkin 6 does not preload the dialect module
38
+ require 'gherkin/dialect' if Gem.loaded_specs['gherkin'].version.version[/^6\./]
40
39
 
41
- # Making the test dialect the default dialect so that language headers aren't
42
- # needed for all of the test code.
43
- module Gherkin
44
- class Parser
40
+ # TODO: choose randomly from Gherkin::DIALECTS once I figure out how to handle encodings...
41
+ test_dialect = ['en', 'en-lol', 'en-pirate', 'en-Scouse'].sample
42
+ puts "Testing with dialect '#{test_dialect}'..."
45
43
 
46
- alias_method :original_parse, :parse
47
44
 
48
- def parse(token_scanner, token_matcher = TokenMatcher.new('cm-test'))
49
- original_parse(token_scanner, token_matcher)
50
- end
45
+ CukeModeler::DialectHelper.set_dialect(Gherkin::DIALECTS[test_dialect])
46
+ CukeModeler::Parsing.dialect = test_dialect
47
+ when /^[543]\./
48
+ # TODO: stop using test dialect and just randomize for all version of `gherkin`
49
+ dialect_file_path = "#{this_dir}/../../test_languages.json"
50
+ test_dialects = JSON.parse File.open(dialect_file_path, 'r:UTF-8').read
51
+
52
+ Gherkin::DIALECTS.merge!(test_dialects)
53
+
54
+
55
+ module Gherkin
56
+ class Parser
51
57
 
58
+ alias_method :original_parse, :parse
59
+
60
+ def parse(token_scanner, token_matcher = TokenMatcher.new('cm-test'))
61
+ original_parse(token_scanner, token_matcher)
62
+ end
63
+
64
+ end
52
65
  end
53
- end
54
66
 
55
- CukeModeler::DialectHelper.set_dialect(test_dialects['cm-test'])
56
- CukeModeler::Parsing.dialect = 'cm-test'
67
+ CukeModeler::DialectHelper.set_dialect(test_dialects['cm-test'])
68
+ CukeModeler::Parsing.dialect = 'cm-test'
69
+ when /^2\./
70
+ CukeModeler::DialectHelper.set_dialect(Gherkin::I18n::LANGUAGES['en'])
71
+ CukeModeler::Parsing.dialect = 'en'
72
+ else
73
+ raise("Unknown Gherkin version: '#{gherkin_version}'")
57
74
  end
58
75
 
59
76
 
60
77
  RSpec.configure do |config|
61
- case Gem.loaded_specs['gherkin'].version.version
78
+ gherkin_version = Gem.loaded_specs['gherkin'].version.version
79
+
80
+ case gherkin_version
81
+ when /^6\./
82
+ config.filter_run_excluding :gherkin2 => true,
83
+ :gherkin3 => true,
84
+ :gherkin4_5 => true,
85
+ :gherkin6 => false
62
86
  when /^[54]\./
63
87
  config.filter_run_excluding :gherkin2 => true,
64
88
  :gherkin3 => true,
65
- :gherkin4 => false
89
+ :gherkin4_5 => false,
90
+ :gherkin6 => true
66
91
  when /^3\./
67
92
  config.filter_run_excluding :gherkin2 => true,
68
93
  :gherkin3 => false,
69
- :gherkin4 => true
70
- else
94
+ :gherkin4_5 => true,
95
+ :gherkin6 => true
96
+ when /^2\./
71
97
  config.filter_run_excluding :gherkin2 => false,
72
98
  :gherkin3 => true,
73
- :gherkin4 => true
99
+ :gherkin4_5 => true,
100
+ :gherkin6 => true
101
+ else
102
+ raise("Unknown Gherkin version: '#{gherkin_version}'")
74
103
  end
75
104
 
76
- config.before(:all) do
77
- @feature_keyword = CukeModeler::DialectHelper.feature_keyword
78
- @background_keyword = CukeModeler::DialectHelper.background_keyword
79
- @scenario_keyword = CukeModeler::DialectHelper.scenario_keyword
80
- @outline_keyword = CukeModeler::DialectHelper.outline_keyword
81
- @example_keyword = CukeModeler::DialectHelper.example_keyword
82
- @step_keyword = CukeModeler::DialectHelper.step_keyword
83
- @given_keyword = CukeModeler::DialectHelper.given_keyword
84
- @then_keyword = CukeModeler::DialectHelper.then_keyword
105
+ config.before(:suite) do
106
+ FEATURE_KEYWORD = CukeModeler::DialectHelper.feature_keyword
107
+ BACKGROUND_KEYWORD = CukeModeler::DialectHelper.background_keyword
108
+ SCENARIO_KEYWORD = CukeModeler::DialectHelper.scenario_keyword
109
+ OUTLINE_KEYWORD = CukeModeler::DialectHelper.outline_keyword
110
+ EXAMPLE_KEYWORD = CukeModeler::DialectHelper.example_keyword
111
+ STEP_KEYWORD = CukeModeler::DialectHelper.step_keyword
112
+ GIVEN_KEYWORD = CukeModeler::DialectHelper.given_keyword
113
+ THEN_KEYWORD = CukeModeler::DialectHelper.then_keyword
85
114
  end
86
115
 
87
- config.after(:all) do
116
+ config.after(:suite) do
88
117
  CukeModeler::FileHelper.created_directories.each do |dir_path|
89
118
  FileUtils.remove_entry(dir_path, true)
90
119
  end
data/todo.txt CHANGED
@@ -9,7 +9,9 @@ document helper modules as not part of the public API
9
9
 
10
10
  # todo - incorporate cuke_modeler extensions from other projects
11
11
  # todo - add plenty of testing around weird and minimal gherkin text for all models
12
-
12
+ # todo - add support for `Rule` keyword
13
+ # todo - incorporate new flexibility of `Example` keyword, etc.
14
+ # todo - Have CukeModeler::Parsing.dialect also control the default dialect used by Gherkin
13
15
 
14
16
  Backlog
15
17
  -------------
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuke_modeler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Kessler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-20 00:00:00.000000000 Z
11
+ date: 2018-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gherkin
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "<"
18
18
  - !ruby/object:Gem::Version
19
- version: '6.0'
19
+ version: '7.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "<"
25
25
  - !ruby/object:Gem::Version
26
- version: '6.0'
26
+ version: '7.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -92,14 +92,14 @@ dependencies:
92
92
  requirements:
93
93
  - - "<"
94
94
  - !ruby/object:Gem::Version
95
- version: 3.0.0
95
+ version: 5.0.0
96
96
  type: :development
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "<"
101
101
  - !ruby/object:Gem::Version
102
- version: 3.0.0
102
+ version: 5.0.0
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: rspec
105
105
  requirement: !ruby/object:Gem::Requirement
@@ -182,6 +182,7 @@ files:
182
182
  - lib/cuke_modeler/adapters/gherkin_2_adapter.rb
183
183
  - lib/cuke_modeler/adapters/gherkin_3_adapter.rb
184
184
  - lib/cuke_modeler/adapters/gherkin_4_adapter.rb
185
+ - lib/cuke_modeler/adapters/gherkin_6_adapter.rb
185
186
  - lib/cuke_modeler/containing.rb
186
187
  - lib/cuke_modeler/described.rb
187
188
  - lib/cuke_modeler/models/background.rb
@@ -251,13 +252,13 @@ files:
251
252
  - testing/cucumber/step_definitions/tag_steps.rb
252
253
  - testing/cucumber/step_definitions/verification_steps.rb
253
254
  - testing/cucumber/support/env.rb
254
- - testing/cucumber/support/transforms.rb
255
255
  - testing/dialect_helper.rb
256
256
  - testing/file_helper.rb
257
257
  - testing/gemfiles/gherkin2.gemfile
258
258
  - testing/gemfiles/gherkin3.gemfile
259
259
  - testing/gemfiles/gherkin4.gemfile
260
260
  - testing/gemfiles/gherkin5.gemfile
261
+ - testing/gemfiles/gherkin6.gemfile
261
262
  - testing/rspec/spec/integration/background_integration_spec.rb
262
263
  - testing/rspec/spec/integration/cell_integration_spec.rb
263
264
  - testing/rspec/spec/integration/comment_integration_spec.rb
@@ -269,6 +270,7 @@ files:
269
270
  - testing/rspec/spec/integration/gherkin_2_adapter_spec.rb
270
271
  - testing/rspec/spec/integration/gherkin_3_adapter_spec.rb
271
272
  - testing/rspec/spec/integration/gherkin_4_adapter_spec.rb
273
+ - testing/rspec/spec/integration/gherkin_6_adapter_spec.rb
272
274
  - testing/rspec/spec/integration/model_integration_spec.rb
273
275
  - testing/rspec/spec/integration/nested_integration_spec.rb
274
276
  - testing/rspec/spec/integration/outline_integration_spec.rb
@@ -338,7 +340,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
338
340
  version: '0'
339
341
  requirements: []
340
342
  rubyforge_project:
341
- rubygems_version: 2.5.2
343
+ rubygems_version: 2.7.6
342
344
  signing_key:
343
345
  specification_version: 4
344
346
  summary: A gem providing functionality to model Gherkin based test suites.
@@ -1,3 +0,0 @@
1
- Transform /^(-?\d+)$/ do |number|
2
- number.to_i
3
- end