cuke_modeler 1.4.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +329 -0
  3. data/LICENSE.txt +1 -1
  4. data/README.md +25 -18
  5. data/cuke_modeler.gemspec +15 -9
  6. data/lib/cuke_modeler/adapters/gherkin_10_adapter.rb +12 -0
  7. data/lib/cuke_modeler/adapters/gherkin_11_adapter.rb +12 -0
  8. data/lib/cuke_modeler/adapters/gherkin_12_adapter.rb +12 -0
  9. data/lib/cuke_modeler/adapters/gherkin_13_adapter.rb +12 -0
  10. data/lib/cuke_modeler/adapters/{gherkin_6_adapter.rb → gherkin_9_adapter.rb} +75 -64
  11. data/lib/cuke_modeler/containing.rb +16 -0
  12. data/lib/cuke_modeler/described.rb +1 -0
  13. data/lib/cuke_modeler/models/background.rb +1 -1
  14. data/lib/cuke_modeler/models/cell.rb +1 -1
  15. data/lib/cuke_modeler/models/comment.rb +1 -1
  16. data/lib/cuke_modeler/models/directory.rb +2 -2
  17. data/lib/cuke_modeler/models/doc_string.rb +1 -1
  18. data/lib/cuke_modeler/models/example.rb +1 -1
  19. data/lib/cuke_modeler/models/feature.rb +1 -1
  20. data/lib/cuke_modeler/models/feature_file.rb +2 -2
  21. data/lib/cuke_modeler/models/outline.rb +1 -1
  22. data/lib/cuke_modeler/models/row.rb +1 -1
  23. data/lib/cuke_modeler/models/scenario.rb +1 -1
  24. data/lib/cuke_modeler/models/step.rb +32 -3
  25. data/lib/cuke_modeler/models/table.rb +1 -1
  26. data/lib/cuke_modeler/models/tag.rb +1 -1
  27. data/lib/cuke_modeler/named.rb +1 -0
  28. data/lib/cuke_modeler/nested.rb +1 -0
  29. data/lib/cuke_modeler/parsed.rb +1 -0
  30. data/lib/cuke_modeler/parsing.rb +88 -92
  31. data/lib/cuke_modeler/sourceable.rb +1 -0
  32. data/lib/cuke_modeler/stepped.rb +1 -0
  33. data/lib/cuke_modeler/taggable.rb +1 -0
  34. data/lib/cuke_modeler/version.rb +1 -1
  35. data/testing/cucumber/features/analysis/step_comparison.feature +25 -0
  36. data/testing/cucumber/features/analysis/test_comparison.feature +1 -1
  37. metadata +55 -142
  38. data/.gitignore +0 -18
  39. data/.simplecov +0 -7
  40. data/.travis.yml +0 -54
  41. data/Gemfile +0 -36
  42. data/History.md +0 -191
  43. data/Rakefile +0 -63
  44. data/appveyor.yml +0 -43
  45. data/lib/cuke_modeler/adapters/gherkin_2_adapter.rb +0 -273
  46. data/lib/cuke_modeler/adapters/gherkin_3_adapter.rb +0 -296
  47. data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +0 -308
  48. data/testing/cucumber/step_definitions/action_steps.rb +0 -13
  49. data/testing/cucumber/step_definitions/background_steps.rb +0 -1
  50. data/testing/cucumber/step_definitions/directory_steps.rb +0 -6
  51. data/testing/cucumber/step_definitions/doc_string_steps.rb +0 -1
  52. data/testing/cucumber/step_definitions/feature_file_steps.rb +0 -16
  53. data/testing/cucumber/step_definitions/feature_steps.rb +0 -7
  54. data/testing/cucumber/step_definitions/modeling_steps.rb +0 -44
  55. data/testing/cucumber/step_definitions/setup_steps.rb +0 -32
  56. data/testing/cucumber/step_definitions/step_steps.rb +0 -3
  57. data/testing/cucumber/step_definitions/table_steps.rb +0 -1
  58. data/testing/cucumber/step_definitions/tag_steps.rb +0 -3
  59. data/testing/cucumber/step_definitions/verification_steps.rb +0 -173
  60. data/testing/cucumber/support/env.rb +0 -30
  61. data/testing/dialect_helper.rb +0 -48
  62. data/testing/file_helper.rb +0 -47
  63. data/testing/gemfiles/gherkin2.gemfile +0 -32
  64. data/testing/gemfiles/gherkin3.gemfile +0 -26
  65. data/testing/gemfiles/gherkin4.gemfile +0 -27
  66. data/testing/gemfiles/gherkin5.gemfile +0 -26
  67. data/testing/gemfiles/gherkin6.gemfile +0 -10
  68. data/testing/rspec/spec/integration/background_integration_spec.rb +0 -442
  69. data/testing/rspec/spec/integration/cell_integration_spec.rb +0 -335
  70. data/testing/rspec/spec/integration/comment_integration_spec.rb +0 -177
  71. data/testing/rspec/spec/integration/directory_integration_spec.rb +0 -218
  72. data/testing/rspec/spec/integration/doc_string_integration_spec.rb +0 -402
  73. data/testing/rspec/spec/integration/example_integration_spec.rb +0 -741
  74. data/testing/rspec/spec/integration/feature_file_integration_spec.rb +0 -272
  75. data/testing/rspec/spec/integration/feature_integration_spec.rb +0 -650
  76. data/testing/rspec/spec/integration/gherkin_2_adapter_spec.rb +0 -166
  77. data/testing/rspec/spec/integration/gherkin_3_adapter_spec.rb +0 -166
  78. data/testing/rspec/spec/integration/gherkin_4_adapter_spec.rb +0 -165
  79. data/testing/rspec/spec/integration/gherkin_6_adapter_spec.rb +0 -166
  80. data/testing/rspec/spec/integration/model_integration_spec.rb +0 -15
  81. data/testing/rspec/spec/integration/nested_integration_spec.rb +0 -91
  82. data/testing/rspec/spec/integration/outline_integration_spec.rb +0 -624
  83. data/testing/rspec/spec/integration/parsing_integration_spec.rb +0 -117
  84. data/testing/rspec/spec/integration/row_integration_spec.rb +0 -291
  85. data/testing/rspec/spec/integration/scenario_integration_spec.rb +0 -479
  86. data/testing/rspec/spec/integration/shared/models_integration_specs.rb +0 -18
  87. data/testing/rspec/spec/integration/step_integration_spec.rb +0 -475
  88. data/testing/rspec/spec/integration/table_integration_spec.rb +0 -337
  89. data/testing/rspec/spec/integration/tag_integration_spec.rb +0 -259
  90. data/testing/rspec/spec/spec_helper.rb +0 -122
  91. data/testing/rspec/spec/unit/background_unit_spec.rb +0 -83
  92. data/testing/rspec/spec/unit/cell_unit_spec.rb +0 -68
  93. data/testing/rspec/spec/unit/comment_unit_spec.rb +0 -68
  94. data/testing/rspec/spec/unit/described_unit_spec.rb +0 -23
  95. data/testing/rspec/spec/unit/directory_unit_spec.rb +0 -127
  96. data/testing/rspec/spec/unit/doc_string_unit_spec.rb +0 -100
  97. data/testing/rspec/spec/unit/example_unit_spec.rb +0 -133
  98. data/testing/rspec/spec/unit/feature_file_unit_spec.rb +0 -125
  99. data/testing/rspec/spec/unit/feature_unit_spec.rb +0 -157
  100. data/testing/rspec/spec/unit/model_unit_spec.rb +0 -15
  101. data/testing/rspec/spec/unit/named_unit_spec.rb +0 -23
  102. data/testing/rspec/spec/unit/nested_unit_spec.rb +0 -43
  103. data/testing/rspec/spec/unit/outline_unit_spec.rb +0 -117
  104. data/testing/rspec/spec/unit/parsed_unit_spec.rb +0 -27
  105. data/testing/rspec/spec/unit/parsing_unit_spec.rb +0 -54
  106. data/testing/rspec/spec/unit/row_unit_spec.rb +0 -68
  107. data/testing/rspec/spec/unit/scenario_unit_spec.rb +0 -86
  108. data/testing/rspec/spec/unit/shared/bare_bones_models_unit_specs.rb +0 -14
  109. data/testing/rspec/spec/unit/shared/containing_models_unit_specs.rb +0 -25
  110. data/testing/rspec/spec/unit/shared/described_models_unit_specs.rb +0 -38
  111. data/testing/rspec/spec/unit/shared/keyworded_models_unit_specs.rb +0 -58
  112. data/testing/rspec/spec/unit/shared/models_unit_specs.rb +0 -15
  113. data/testing/rspec/spec/unit/shared/named_models_unit_specs.rb +0 -39
  114. data/testing/rspec/spec/unit/shared/nested_models_unit_specs.rb +0 -51
  115. data/testing/rspec/spec/unit/shared/parsed_models_unit_specs.rb +0 -39
  116. data/testing/rspec/spec/unit/shared/prepopulated_models_unit_specs.rb +0 -18
  117. data/testing/rspec/spec/unit/shared/sourced_models_unit_specs.rb +0 -39
  118. data/testing/rspec/spec/unit/shared/stepped_models_unit_specs.rb +0 -46
  119. data/testing/rspec/spec/unit/shared/stringifiable_models_unit_specs.rb +0 -18
  120. data/testing/rspec/spec/unit/shared/tagged_models_unit_specs.rb +0 -72
  121. data/testing/rspec/spec/unit/sourceable_unit_spec.rb +0 -27
  122. data/testing/rspec/spec/unit/step_unit_spec.rb +0 -109
  123. data/testing/rspec/spec/unit/stepped_unit_spec.rb +0 -23
  124. data/testing/rspec/spec/unit/table_unit_spec.rb +0 -77
  125. data/testing/rspec/spec/unit/tag_unit_spec.rb +0 -68
  126. data/testing/rspec/spec/unit/taggable_unit_spec.rb +0 -69
  127. data/testing/test_languages.json +0 -45
  128. data/todo.txt +0 -24
@@ -57,8 +57,8 @@ module CukeModeler
57
57
  def process_feature_file(file_path)
58
58
  source_text = IO.read(file_path)
59
59
 
60
- feature_file_data = Parsing::parse_text(source_text, file_path).first
61
- feature_file_data = feature_file_data.merge({'path' => file_path})
60
+ feature_file_data = Parsing::parse_text(source_text, file_path)
61
+ feature_file_data = feature_file_data.merge({ 'path' => file_path })
62
62
 
63
63
  feature_file_data
64
64
  end
@@ -72,7 +72,7 @@ module CukeModeler
72
72
 
73
73
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_outline.feature')
74
74
 
75
- parsed_file.first['feature']['elements'].first
75
+ parsed_file['feature']['elements'].first
76
76
  end
77
77
 
78
78
  def examples_output_string
@@ -43,7 +43,7 @@ module CukeModeler
43
43
 
44
44
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_row.feature')
45
45
 
46
- parsed_file.first['feature']['elements'].first['steps'].first['table']['rows'].first
46
+ parsed_file['feature']['elements'].first['steps'].first['table']['rows'].first
47
47
  end
48
48
 
49
49
  end
@@ -67,7 +67,7 @@ module CukeModeler
67
67
 
68
68
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_scenario.feature')
69
69
 
70
- parsed_file.first['feature']['elements'].first
70
+ parsed_file['feature']['elements'].first
71
71
  end
72
72
 
73
73
  end
@@ -33,9 +33,11 @@ module CukeModeler
33
33
  # Returns *true* if the two steps have the same base text (i.e. minus any keyword,
34
34
  # table, or doc string and *false* otherwise.
35
35
  def ==(other_step)
36
- return false unless other_step.respond_to?(:text)
36
+ return false unless other_step.is_a?(CukeModeler::Step)
37
37
 
38
- text == other_step.text
38
+ text_matches?(other_step) &&
39
+ table_matches?(other_step) &&
40
+ doc_string_matches?(other_step)
39
41
  end
40
42
 
41
43
  # Returns the model objects that belong to this model.
@@ -62,7 +64,34 @@ module CukeModeler
62
64
 
63
65
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_step.feature')
64
66
 
65
- parsed_file.first['feature']['elements'].first['steps'].first
67
+ parsed_file['feature']['elements'].first['steps'].first
68
+ end
69
+
70
+ def text_matches?(other_step)
71
+ text == other_step.text
72
+ end
73
+
74
+ def table_matches?(other_step)
75
+ return false if (!block.is_a?(CukeModeler::Table) || !other_step.block.is_a?(CukeModeler::Table)) && (block.is_a?(CukeModeler::Table) || other_step.block.is_a?(CukeModeler::Table))
76
+ return true unless block.is_a?(CukeModeler::Table) && other_step.block.is_a?(CukeModeler::Table)
77
+
78
+ first_step_values = block.rows.collect { |table_row| table_row.cells.map(&:value) }
79
+ second_step_values = other_step.block.rows.collect { |table_row| table_row.cells.map(&:value) }
80
+
81
+ first_step_values == second_step_values
82
+ end
83
+
84
+ def doc_string_matches?(other_step)
85
+ return false if (!block.is_a?(CukeModeler::DocString) || !other_step.block.is_a?(CukeModeler::DocString)) && (block.is_a?(CukeModeler::DocString) || other_step.block.is_a?(CukeModeler::DocString))
86
+ return true unless block.is_a?(CukeModeler::DocString) && other_step.block.is_a?(CukeModeler::DocString)
87
+
88
+ first_content = block.content
89
+ first_content_type = block.content_type
90
+ second_content = other_step.block.content
91
+ second_content_type = other_step.block.content_type
92
+
93
+ (first_content == second_content) &&
94
+ (first_content_type == second_content_type)
66
95
  end
67
96
 
68
97
  end
@@ -47,7 +47,7 @@ module CukeModeler
47
47
 
48
48
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_table.feature')
49
49
 
50
- parsed_file.first['feature']['elements'].first['steps'].first['table']
50
+ parsed_file['feature']['elements'].first['steps'].first['table']
51
51
  end
52
52
 
53
53
  def row_output_string(row)
@@ -40,7 +40,7 @@ module CukeModeler
40
40
 
41
41
  parsed_file = Parsing::parse_text(source_text, 'cuke_modeler_stand_alone_tag.feature')
42
42
 
43
- parsed_file.first['feature']['tags'].first
43
+ parsed_file['feature']['tags'].first
44
44
  end
45
45
 
46
46
  end
@@ -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 a name.
4
5
 
5
6
  module Named
@@ -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 are nested inside
4
5
  # of other models.
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 are parsed from source text.
4
5
 
5
6
  module Parsed
@@ -1,98 +1,36 @@
1
- module CukeModeler
2
-
3
- # A module providing source text parsing functionality.
4
-
5
- module Parsing
6
-
7
-
8
- # Have to at least load some version of the gem before which version of the gem has been loaded can
9
- # be determined and the rest of the needed files can be loaded. Try the old one first and then the
10
- # new one.
11
- begin
12
- require 'gherkin'
13
- rescue LoadError
14
- begin
15
- require 'gherkin/parser'
16
- rescue LoadError
17
- # Gherkin 6.x
18
- require 'gherkin/gherkin'
19
- end
20
- end
21
-
22
-
23
- # The *gherkin* gem loads differently and has different grammar rules across major versions. Parsing
24
- # will be done with an 'adapter' appropriate to the version of the *gherkin* gem that has been activated.
25
-
26
- gherkin_version = Gem.loaded_specs['gherkin'].version.version
27
-
28
- case gherkin_version
29
- when /^6\./
30
- require 'gherkin/gherkin'
31
- require 'cuke_modeler/adapters/gherkin_6_adapter'
32
-
33
- def self.parsing_method(source_text, filename)
34
- messages = Gherkin::Gherkin.from_source(filename, source_text, {:default_dialect => CukeModeler::Parsing.dialect}).to_a
35
-
36
- messages.map(&:to_hash).find { |message| message[:gherkinDocument] }[:gherkinDocument]
37
- end
38
-
39
- def self.adapter_class
40
- CukeModeler::Gherkin6Adapter
41
- end
1
+ # Have to at least load some version of the gem before which version of the gem has been loaded can
2
+ # be determined and the rest of the needed files can be loaded. The entry points vary across versions,
3
+ # so try them all until one of them works.
4
+ begin
5
+ # Gherkin 9.x
6
+ require 'gherkin'
7
+ rescue LoadError => e
8
+ # Add other entry points again if things change again
9
+ raise e
10
+ end
42
11
 
43
- when /^[54]\./
44
- require 'gherkin/parser'
45
- require 'cuke_modeler/adapters/gherkin_4_adapter'
46
12
 
47
- # TODO: shouldn't the filename be used?
48
- # todo - make these methods private?
49
- def self.parsing_method(source_text, _filename)
50
- Gherkin::Parser.new.parse(source_text)
51
- end
13
+ # The *cucumber-gherkin* gem loads differently and has different grammar rules across major versions. Parsing
14
+ # will be done with an 'adapter' appropriate to the version of the *cucumber-gherkin* gem that has been activated.
52
15
 
53
- def self.adapter_class
54
- CukeModeler::Gherkin4Adapter
55
- end
16
+ gherkin_version = Gem.loaded_specs['cucumber-gherkin'].version.version
17
+ gherkin_major_version = gherkin_version.match(/^(\d+)\./)[1].to_i
56
18
 
57
- when /^3\./
58
- require 'gherkin/parser'
59
- require 'cuke_modeler/adapters/gherkin_3_adapter'
19
+ case gherkin_major_version
20
+ when 9, 10, 11, 12, 13
21
+ # Currently nothing else to load beyond the entry point to the gem
22
+ else
23
+ raise("Unknown Gherkin version: '#{gherkin_version}'")
24
+ end
60
25
 
26
+ require "cuke_modeler/adapters/gherkin_#{gherkin_major_version}_adapter"
61
27
 
62
- def self.parsing_method(source_text, _filename)
63
- Gherkin::Parser.new.parse(source_text)
64
- end
65
28
 
66
- def self.adapter_class
67
- CukeModeler::Gherkin3Adapter
68
- end
69
- when /^2\./
70
- require 'stringio'
71
- require 'gherkin/formatter/json_formatter'
72
- require 'gherkin'
73
- require 'json'
74
- require 'multi_json'
75
- require 'cuke_modeler/adapters/gherkin_2_adapter'
76
-
77
-
78
- def self.parsing_method(source_text, filename)
79
- io = StringIO.new
80
- formatter = Gherkin::Formatter::JSONFormatter.new(io)
81
- parser = Gherkin::Parser::Parser.new(formatter)
82
- parser.parse(source_text, filename, 0)
83
- formatter.done
84
- MultiJson.load(io.string)
85
- end
86
-
87
- def self.adapter_class
88
- CukeModeler::Gherkin2Adapter
89
- end
29
+ module CukeModeler
90
30
 
91
- else
92
- # TODO: test this
93
- raise("Unknown Gherkin version: '#{gherkin_version}'")
94
- end
31
+ # A module providing source text parsing functionality.
95
32
 
33
+ module Parsing
96
34
 
97
35
  class << self
98
36
 
@@ -108,28 +46,86 @@ module CukeModeler
108
46
  # The dialects currently known by the gherkin gem
109
47
  def dialects
110
48
  unless @dialects
111
- @dialects = Gem.loaded_specs['gherkin'].version.version[/^2\./] ? Gherkin::I18n::LANGUAGES : Gherkin::DIALECTS
49
+ @dialects = Gherkin::DIALECTS
112
50
  end
113
51
 
114
52
  @dialects
115
53
  end
116
54
 
117
- # Parses the Cucumber feature given in *source_text* and returns an array
118
- # containing the hash representation of its logical structure.
55
+ # Parses the Cucumber feature given in *source_text* and returns a hash representation of
56
+ # its logical structure. This is a standardized AST that should remain consistent across
57
+ # different versions of `cucumber-gherkin`
119
58
  def parse_text(source_text, filename = 'cuke_modeler_fake_file.feature')
120
59
  raise(ArgumentError, "Text to parse must be a String but got #{source_text.class}") unless source_text.is_a?(String)
121
60
 
122
-
123
61
  begin
124
62
  parsed_result = parsing_method(source_text, filename)
125
63
  rescue => e
126
64
  raise(ArgumentError, "Error encountered while parsing '#{filename}'\n#{e.class} - #{e.message}")
127
65
  end
128
66
 
129
- adapted_result = adapter_class.new.adapt(parsed_result)
67
+ adapter_class.new.adapt(parsed_result)
68
+ end
69
+
130
70
 
71
+ gherkin_version = Gem.loaded_specs['cucumber-gherkin'].version.version
72
+ gherkin_major_version = gherkin_version.match(/^(\d+)\./)[1].to_i
73
+
74
+ case gherkin_major_version
75
+ when 13
76
+ # todo - make these methods private?
77
+ # NOT A PART OF THE PUBLIC API
78
+ # The method to use for parsing Gherkin text
79
+ def parsing_method(source_text, filename)
80
+ messages = Gherkin.from_source(filename, source_text, { :include_gherkin_document => true }).to_a.map(&:to_hash)
81
+
82
+ error_message = messages.find { |message| message[:parse_error] }
83
+ gherkin_ast_message = messages.find { |message| message[:gherkin_document] }
84
+
85
+ raise error_message[:parse_error][:message] if error_message
86
+
87
+ gherkin_ast_message[:gherkin_document]
88
+ end
89
+ when 12
90
+ # todo - make these methods private?
91
+ # NOT A PART OF THE PUBLIC API
92
+ # The method to use for parsing Gherkin text
93
+ def parsing_method(source_text, filename)
94
+ messages = Gherkin.from_source(filename, source_text, { :include_gherkin_document => true }).to_a.map(&:to_hash)
95
+
96
+ potential_error_message = messages.find { |message| message[:attachment] }
97
+ gherkin_ast_message = messages.find { |message| message[:gherkin_document] }
98
+
99
+ if potential_error_message
100
+ raise potential_error_message[:attachment][:body] if potential_error_message[:attachment][:body] =~ /expected.*got/
101
+ end
102
+
103
+ gherkin_ast_message[:gherkin_document]
104
+ end
105
+ when 9, 10, 11
106
+ # todo - make these methods private?
107
+ # NOT A PART OF THE PUBLIC API
108
+ # The method to use for parsing Gherkin text
109
+ def parsing_method(source_text, filename)
110
+ messages = Gherkin.from_source(filename, source_text, { :include_gherkin_document => true }).to_a.map(&:to_hash)
111
+
112
+ potential_error_message = messages.find { |message| message[:attachment] }
113
+ gherkin_ast_message = messages.find { |message| message[:gherkin_document] }
114
+
115
+ if potential_error_message
116
+ raise potential_error_message[:attachment][:text] if potential_error_message[:attachment][:text] =~ /expected.*got/
117
+ end
118
+
119
+ gherkin_ast_message[:gherkin_document]
120
+ end
121
+ else
122
+ raise("Unknown Gherkin version: '#{gherkin_version}'")
123
+ end
131
124
 
132
- adapted_result
125
+ # NOT A PART OF THE PUBLIC API
126
+ # The adapter to use when converting an AST to a standard internal shape
127
+ define_method('adapter_class') do
128
+ CukeModeler.const_get("Gherkin#{gherkin_major_version}Adapter")
133
129
  end
134
130
 
135
131
  end
@@ -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.4.0'
3
+ VERSION = '3.0.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
metadata CHANGED
@@ -1,77 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuke_modeler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 3.0.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: 2018-11-14 00:00:00.000000000 Z
11
+ date: 2020-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: gherkin
14
+ name: cucumber-gherkin
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "<"
18
18
  - !ruby/object:Gem::Version
19
- version: '7.0'
19
+ version: '14.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: '7.0'
26
+ version: '14.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: json
28
+ name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '1.0'
34
31
  - - "<"
35
32
  - !ruby/object:Gem::Version
36
33
  version: '3.0'
37
- type: :runtime
34
+ type: :development
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: '1.0'
44
38
  - - "<"
45
39
  - !ruby/object:Gem::Version
46
40
  version: '3.0'
47
- - !ruby/object:Gem::Dependency
48
- name: multi_json
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '1.0'
54
- type: :runtime
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '1.0'
61
- - !ruby/object:Gem::Dependency
62
- name: bundler
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '1.5'
68
- type: :development
69
- prerelease: false
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: '1.5'
75
41
  - !ruby/object:Gem::Dependency
76
42
  name: rake
77
43
  requirement: !ruby/object:Gem::Requirement
@@ -118,16 +84,16 @@ dependencies:
118
84
  name: simplecov
119
85
  requirement: !ruby/object:Gem::Requirement
120
86
  requirements:
121
- - - "<"
87
+ - - "<="
122
88
  - !ruby/object:Gem::Version
123
- version: 1.0.0
89
+ version: 0.16.1
124
90
  type: :development
125
91
  prerelease: false
126
92
  version_requirements: !ruby/object:Gem::Requirement
127
93
  requirements:
128
- - - "<"
94
+ - - "<="
129
95
  - !ruby/object:Gem::Version
130
- version: 1.0.0
96
+ version: 0.16.1
131
97
  - !ruby/object:Gem::Dependency
132
98
  name: racatt
133
99
  requirement: !ruby/object:Gem::Requirement
@@ -156,33 +122,57 @@ dependencies:
156
122
  - - "<"
157
123
  - !ruby/object:Gem::Version
158
124
  version: 1.0.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: rainbow
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "<"
130
+ - !ruby/object:Gem::Version
131
+ version: 4.0.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "<"
137
+ - !ruby/object:Gem::Version
138
+ version: 4.0.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: test-unit
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "<"
144
+ - !ruby/object:Gem::Version
145
+ version: 4.0.0
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "<"
151
+ - !ruby/object:Gem::Version
152
+ version: 4.0.0
159
153
  description: This gem facilitates modeling a test suite that is written in Gherkin
160
154
  (e.g. Cucumber, SpecFlow, Lettuce, etc.). It does this by providing an abstraction
161
- layer on top of the Abstract Syntax Tree that the 'gherkin' gem generates when parsing
162
- features, as well as providing models for feature files and directories in order
163
- to be able to have a fully traversable model tree of a test suite's structure. These
164
- models can then be analyzed or manipulated more easily than the underlying AST layer.
155
+ layer on top of the Abstract Syntax Tree that the 'cucumber-gherkin' gem generates
156
+ when parsing features, as well as providing models for feature files and directories
157
+ in order to be able to have a fully traversable model tree of a test suite's structure.
158
+ These models can then be analyzed or manipulated more easily than the underlying
159
+ AST layer.
165
160
  email:
166
161
  - morrow748@gmail.com
167
162
  executables: []
168
163
  extensions: []
169
164
  extra_rdoc_files: []
170
165
  files:
171
- - ".gitignore"
172
- - ".simplecov"
173
- - ".travis.yml"
174
- - Gemfile
175
- - History.md
166
+ - CHANGELOG.md
176
167
  - LICENSE.txt
177
168
  - README.md
178
- - Rakefile
179
- - appveyor.yml
180
169
  - cuke_modeler.gemspec
181
170
  - lib/cuke_modeler.rb
182
- - lib/cuke_modeler/adapters/gherkin_2_adapter.rb
183
- - lib/cuke_modeler/adapters/gherkin_3_adapter.rb
184
- - lib/cuke_modeler/adapters/gherkin_4_adapter.rb
185
- - lib/cuke_modeler/adapters/gherkin_6_adapter.rb
171
+ - lib/cuke_modeler/adapters/gherkin_10_adapter.rb
172
+ - lib/cuke_modeler/adapters/gherkin_11_adapter.rb
173
+ - lib/cuke_modeler/adapters/gherkin_12_adapter.rb
174
+ - lib/cuke_modeler/adapters/gherkin_13_adapter.rb
175
+ - lib/cuke_modeler/adapters/gherkin_9_adapter.rb
186
176
  - lib/cuke_modeler/containing.rb
187
177
  - lib/cuke_modeler/described.rb
188
178
  - lib/cuke_modeler/models/background.rb
@@ -208,6 +198,7 @@ files:
208
198
  - lib/cuke_modeler/stepped.rb
209
199
  - lib/cuke_modeler/taggable.rb
210
200
  - lib/cuke_modeler/version.rb
201
+ - testing/cucumber/features/analysis/step_comparison.feature
211
202
  - testing/cucumber/features/analysis/test_comparison.feature
212
203
  - testing/cucumber/features/modeling/background_modeling.feature
213
204
  - testing/cucumber/features/modeling/background_output.feature
@@ -239,87 +230,6 @@ files:
239
230
  - testing/cucumber/features/modeling/table_output.feature
240
231
  - testing/cucumber/features/modeling/tag_modeling.feature
241
232
  - testing/cucumber/features/modeling/tag_output.feature
242
- - testing/cucumber/step_definitions/action_steps.rb
243
- - testing/cucumber/step_definitions/background_steps.rb
244
- - testing/cucumber/step_definitions/directory_steps.rb
245
- - testing/cucumber/step_definitions/doc_string_steps.rb
246
- - testing/cucumber/step_definitions/feature_file_steps.rb
247
- - testing/cucumber/step_definitions/feature_steps.rb
248
- - testing/cucumber/step_definitions/modeling_steps.rb
249
- - testing/cucumber/step_definitions/setup_steps.rb
250
- - testing/cucumber/step_definitions/step_steps.rb
251
- - testing/cucumber/step_definitions/table_steps.rb
252
- - testing/cucumber/step_definitions/tag_steps.rb
253
- - testing/cucumber/step_definitions/verification_steps.rb
254
- - testing/cucumber/support/env.rb
255
- - testing/dialect_helper.rb
256
- - testing/file_helper.rb
257
- - testing/gemfiles/gherkin2.gemfile
258
- - testing/gemfiles/gherkin3.gemfile
259
- - testing/gemfiles/gherkin4.gemfile
260
- - testing/gemfiles/gherkin5.gemfile
261
- - testing/gemfiles/gherkin6.gemfile
262
- - testing/rspec/spec/integration/background_integration_spec.rb
263
- - testing/rspec/spec/integration/cell_integration_spec.rb
264
- - testing/rspec/spec/integration/comment_integration_spec.rb
265
- - testing/rspec/spec/integration/directory_integration_spec.rb
266
- - testing/rspec/spec/integration/doc_string_integration_spec.rb
267
- - testing/rspec/spec/integration/example_integration_spec.rb
268
- - testing/rspec/spec/integration/feature_file_integration_spec.rb
269
- - testing/rspec/spec/integration/feature_integration_spec.rb
270
- - testing/rspec/spec/integration/gherkin_2_adapter_spec.rb
271
- - testing/rspec/spec/integration/gherkin_3_adapter_spec.rb
272
- - testing/rspec/spec/integration/gherkin_4_adapter_spec.rb
273
- - testing/rspec/spec/integration/gherkin_6_adapter_spec.rb
274
- - testing/rspec/spec/integration/model_integration_spec.rb
275
- - testing/rspec/spec/integration/nested_integration_spec.rb
276
- - testing/rspec/spec/integration/outline_integration_spec.rb
277
- - testing/rspec/spec/integration/parsing_integration_spec.rb
278
- - testing/rspec/spec/integration/row_integration_spec.rb
279
- - testing/rspec/spec/integration/scenario_integration_spec.rb
280
- - testing/rspec/spec/integration/shared/models_integration_specs.rb
281
- - testing/rspec/spec/integration/step_integration_spec.rb
282
- - testing/rspec/spec/integration/table_integration_spec.rb
283
- - testing/rspec/spec/integration/tag_integration_spec.rb
284
- - testing/rspec/spec/spec_helper.rb
285
- - testing/rspec/spec/unit/background_unit_spec.rb
286
- - testing/rspec/spec/unit/cell_unit_spec.rb
287
- - testing/rspec/spec/unit/comment_unit_spec.rb
288
- - testing/rspec/spec/unit/described_unit_spec.rb
289
- - testing/rspec/spec/unit/directory_unit_spec.rb
290
- - testing/rspec/spec/unit/doc_string_unit_spec.rb
291
- - testing/rspec/spec/unit/example_unit_spec.rb
292
- - testing/rspec/spec/unit/feature_file_unit_spec.rb
293
- - testing/rspec/spec/unit/feature_unit_spec.rb
294
- - testing/rspec/spec/unit/model_unit_spec.rb
295
- - testing/rspec/spec/unit/named_unit_spec.rb
296
- - testing/rspec/spec/unit/nested_unit_spec.rb
297
- - testing/rspec/spec/unit/outline_unit_spec.rb
298
- - testing/rspec/spec/unit/parsed_unit_spec.rb
299
- - testing/rspec/spec/unit/parsing_unit_spec.rb
300
- - testing/rspec/spec/unit/row_unit_spec.rb
301
- - testing/rspec/spec/unit/scenario_unit_spec.rb
302
- - testing/rspec/spec/unit/shared/bare_bones_models_unit_specs.rb
303
- - testing/rspec/spec/unit/shared/containing_models_unit_specs.rb
304
- - testing/rspec/spec/unit/shared/described_models_unit_specs.rb
305
- - testing/rspec/spec/unit/shared/keyworded_models_unit_specs.rb
306
- - testing/rspec/spec/unit/shared/models_unit_specs.rb
307
- - testing/rspec/spec/unit/shared/named_models_unit_specs.rb
308
- - testing/rspec/spec/unit/shared/nested_models_unit_specs.rb
309
- - testing/rspec/spec/unit/shared/parsed_models_unit_specs.rb
310
- - testing/rspec/spec/unit/shared/prepopulated_models_unit_specs.rb
311
- - testing/rspec/spec/unit/shared/sourced_models_unit_specs.rb
312
- - testing/rspec/spec/unit/shared/stepped_models_unit_specs.rb
313
- - testing/rspec/spec/unit/shared/stringifiable_models_unit_specs.rb
314
- - testing/rspec/spec/unit/shared/tagged_models_unit_specs.rb
315
- - testing/rspec/spec/unit/sourceable_unit_spec.rb
316
- - testing/rspec/spec/unit/step_unit_spec.rb
317
- - testing/rspec/spec/unit/stepped_unit_spec.rb
318
- - testing/rspec/spec/unit/table_unit_spec.rb
319
- - testing/rspec/spec/unit/tag_unit_spec.rb
320
- - testing/rspec/spec/unit/taggable_unit_spec.rb
321
- - testing/test_languages.json
322
- - todo.txt
323
233
  homepage: https://github.com/enkessler/cuke_modeler
324
234
  licenses:
325
235
  - MIT
@@ -332,7 +242,10 @@ required_ruby_version: !ruby/object:Gem::Requirement
332
242
  requirements:
333
243
  - - ">="
334
244
  - !ruby/object:Gem::Version
335
- version: '0'
245
+ version: '2.3'
246
+ - - "<"
247
+ - !ruby/object:Gem::Version
248
+ version: '3.0'
336
249
  required_rubygems_version: !ruby/object:Gem::Requirement
337
250
  requirements:
338
251
  - - ">="