cuke_modeler 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. data/.travis.yml +23 -0
  2. data/Gemfile +22 -4
  3. data/History.rdoc +6 -0
  4. data/Rakefile +26 -26
  5. data/cuke_modeler.gemspec +3 -1
  6. data/features/modeling/{background_modeling.feature → gherkin/background_modeling.feature} +1 -11
  7. data/features/modeling/{background_output.feature → gherkin/background_output.feature} +1 -0
  8. data/features/modeling/{directory_modeling.feature → gherkin/directory_modeling.feature} +1 -11
  9. data/features/modeling/{directory_output.feature → gherkin/directory_output.feature} +1 -0
  10. data/features/modeling/{doc_string_modeling.feature → gherkin/doc_string_modeling.feature} +1 -11
  11. data/features/modeling/{doc_string_output.feature → gherkin/doc_string_output.feature} +1 -0
  12. data/features/modeling/{example_modeling.feature → gherkin/example_modeling.feature} +1 -11
  13. data/features/modeling/{example_output.feature → gherkin/example_output.feature} +1 -0
  14. data/features/modeling/{feature_file_modeling.feature → gherkin/feature_file_modeling.feature} +1 -11
  15. data/features/modeling/{feature_file_output.feature → gherkin/feature_file_output.feature} +1 -0
  16. data/features/modeling/{feature_modeling.feature → gherkin/feature_modeling.feature} +1 -11
  17. data/features/modeling/{feature_output.feature → gherkin/feature_output.feature} +1 -0
  18. data/features/modeling/{outline_modeling.feature → gherkin/outline_modeling.feature} +1 -11
  19. data/features/modeling/{outline_output.feature → gherkin/outline_output.feature} +1 -0
  20. data/features/modeling/{row_modeling.feature → gherkin/row_modeling.feature} +1 -10
  21. data/features/modeling/{row_output.feature → gherkin/row_output.feature} +1 -0
  22. data/features/modeling/{scenario_modeling.feature → gherkin/scenario_modeling.feature} +1 -11
  23. data/features/modeling/{scenario_output.feature → gherkin/scenario_output.feature} +1 -0
  24. data/features/modeling/{step_modeling.feature → gherkin/step_modeling.feature} +1 -11
  25. data/features/modeling/{step_output.feature → gherkin/step_output.feature} +1 -0
  26. data/features/modeling/{table_modeling.feature → gherkin/table_modeling.feature} +1 -11
  27. data/features/modeling/{table_output.feature → gherkin/table_output.feature} +1 -0
  28. data/features/modeling/{table_row_modeling.feature → gherkin/table_row_modeling.feature} +1 -11
  29. data/features/modeling/{table_row_output.feature → gherkin/table_row_output.feature} +1 -0
  30. data/features/modeling/{tag_modeling.feature → gherkin/tag_modeling.feature} +1 -11
  31. data/features/modeling/{tag_output.feature → gherkin/tag_output.feature} +1 -0
  32. data/features/modeling/gherkin3/background_modeling.feature +64 -0
  33. data/features/modeling/gherkin3/background_output.feature +131 -0
  34. data/features/modeling/gherkin3/directory_modeling.feature +110 -0
  35. data/features/modeling/gherkin3/directory_output.feature +14 -0
  36. data/features/modeling/gherkin3/doc_string_modeling.feature +53 -0
  37. data/features/modeling/gherkin3/doc_string_output.feature +72 -0
  38. data/features/modeling/gherkin3/example_modeling.feature +100 -0
  39. data/features/modeling/gherkin3/example_output.feature +207 -0
  40. data/features/modeling/gherkin3/feature_file_modeling.feature +54 -0
  41. data/features/modeling/gherkin3/feature_file_output.feature +14 -0
  42. data/features/modeling/gherkin3/feature_modeling.feature +155 -0
  43. data/features/modeling/gherkin3/feature_output.feature +249 -0
  44. data/features/modeling/gherkin3/outline_modeling.feature +89 -0
  45. data/features/modeling/gherkin3/outline_output.feature +255 -0
  46. data/features/modeling/gherkin3/row_modeling.feature +68 -0
  47. data/features/modeling/gherkin3/row_output.feature +28 -0
  48. data/features/modeling/gherkin3/scenario_modeling.feature +78 -0
  49. data/features/modeling/gherkin3/scenario_output.feature +148 -0
  50. data/features/modeling/gherkin3/step_modeling.feature +75 -0
  51. data/features/modeling/gherkin3/step_output.feature +53 -0
  52. data/features/modeling/gherkin3/table_modeling.feature +42 -0
  53. data/features/modeling/gherkin3/table_output.feature +43 -0
  54. data/features/modeling/gherkin3/table_row_modeling.feature +57 -0
  55. data/features/modeling/gherkin3/table_row_output.feature +28 -0
  56. data/features/modeling/gherkin3/tag_modeling.feature +49 -0
  57. data/features/modeling/gherkin3/tag_output.feature +17 -0
  58. data/features/step_definitions/background_steps.rb +5 -1
  59. data/features/step_definitions/doc_string_steps.rb +5 -1
  60. data/features/step_definitions/feature_steps.rb +5 -1
  61. data/features/step_definitions/outline_steps.rb +10 -4
  62. data/features/step_definitions/step_steps.rb +10 -2
  63. data/features/step_definitions/table_steps.rb +6 -2
  64. data/features/step_definitions/tag_steps.rb +15 -3
  65. data/features/step_definitions/test_steps.rb +7 -2
  66. data/features/support/env.rb +21 -9
  67. data/gemfiles/gherkin.gemfile +17 -0
  68. data/gemfiles/gherkin3.gemfile +15 -0
  69. data/lib/cuke_modeler/adapters/gherkin_2_adapter.rb +146 -0
  70. data/lib/cuke_modeler/adapters/gherkin_3_adapter.rb +206 -0
  71. data/lib/cuke_modeler/parsing.rb +61 -20
  72. data/lib/cuke_modeler/raw.rb +1 -1
  73. data/lib/cuke_modeler/row.rb +2 -2
  74. data/lib/cuke_modeler/table.rb +2 -2
  75. data/lib/cuke_modeler/table_row.rb +1 -1
  76. data/lib/cuke_modeler/version.rb +1 -1
  77. data/spec/integration/example_integration_spec.rb +2 -1
  78. data/spec/integration/feature_integration_spec.rb +7 -4
  79. data/spec/integration/outline_integration_spec.rb +4 -2
  80. data/spec/integration/tag_integration_spec.rb +2 -1
  81. data/spec/spec_helper.rb +6 -0
  82. data/spec/unit/background_unit_spec.rb +17 -0
  83. data/spec/unit/doc_string_unit_spec.rb +17 -0
  84. data/spec/unit/example_unit_spec.rb +18 -1
  85. data/spec/unit/feature_file_unit_spec.rb +2 -2
  86. data/spec/unit/feature_unit_spec.rb +16 -0
  87. data/spec/unit/outline_unit_spec.rb +20 -1
  88. data/spec/unit/row_unit_spec.rb +18 -0
  89. data/spec/unit/scenario_unit_spec.rb +17 -0
  90. data/spec/unit/step_unit_spec.rb +17 -0
  91. data/spec/unit/table_row_unit_spec.rb +18 -0
  92. data/spec/unit/table_unit_spec.rb +16 -0
  93. data/spec/unit/tag_unit_spec.rb +17 -0
  94. metadata +147 -60
  95. data/features/step_definitions/spec_steps.rb +0 -18
@@ -13,7 +13,7 @@ module CukeModeler
13
13
 
14
14
 
15
15
  def populate_raw_element(parsed_element)
16
- @raw_element = parsed_element
16
+ @raw_element = parsed_element['cuke_modeler_raw_adapter_output']
17
17
  end
18
18
 
19
19
  end
@@ -42,12 +42,12 @@ module CukeModeler
42
42
  end
43
43
 
44
44
  def parse_row(source_text)
45
- base_file_string = "Feature: Fake feature to parse\nScenario Outline:\n* fake step\nExamples: fake examples\n"
45
+ base_file_string = "Feature: Fake feature to parse\nScenario Outline:\n* fake step\nExamples: fake examples\n#{source_text}\n"
46
46
  source_text = base_file_string + source_text
47
47
 
48
48
  parsed_file = Parsing::parse_text(source_text)
49
49
 
50
- parsed_file.first['elements'].first['examples'].first['rows'].first
50
+ parsed_file.first['elements'].first['examples'].first['rows'].last
51
51
  end
52
52
 
53
53
  def build_row(parsed_row)
@@ -63,11 +63,11 @@ module CukeModeler
63
63
  end
64
64
 
65
65
  def populate_contents(table)
66
- @contents = table.collect { |row| row['cells'] }
66
+ @contents = table['rows'].collect { |row| row['cells'] }
67
67
  end
68
68
 
69
69
  def populate_row_elements(table)
70
- table.each do |row|
70
+ table['rows'].each do |row|
71
71
  @row_elements << build_child_element(TableRow, row)
72
72
  end
73
73
  end
@@ -47,7 +47,7 @@ module CukeModeler
47
47
 
48
48
  parsed_file = Parsing::parse_text(source_text)
49
49
 
50
- parsed_file.first['elements'].first['steps'].first['rows'].first
50
+ parsed_file.first['elements'].first['steps'].first['rows']['rows'].first
51
51
  end
52
52
 
53
53
  def build_row(parsed_row)
@@ -1,3 +1,3 @@
1
1
  module CukeModeler
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -28,7 +28,8 @@ describe 'Example, Integration' do
28
28
  ' Scenario Outline: Test test',
29
29
  ' * a step',
30
30
  ' Examples: Test example',
31
- ' | a param |']
31
+ ' | a param |',
32
+ ' | a value |']
32
33
  source = source.join("\n")
33
34
 
34
35
  file_path = "#{@default_file_directory}/example_test_file.feature"
@@ -15,7 +15,10 @@ describe 'Feature, Integration' do
15
15
  'Feature: Test feature',
16
16
  ' Background: Test background',
17
17
  ' Scenario: Test scenario',
18
- ' Scenario Outline: Test outline']
18
+ ' Scenario Outline: Test outline',
19
+ ' Examples: Test Examples',
20
+ ' | param |',
21
+ ' | value |']
19
22
  source = source.join("\n")
20
23
 
21
24
 
@@ -34,7 +37,7 @@ describe 'Feature, Integration' do
34
37
 
35
38
  it 'can distinguish scenarios from outlines - #scenarios, #outlines' do
36
39
  scenarios = [CukeModeler::Scenario.new('Scenario: 1'), CukeModeler::Scenario.new('Scenario: 2')]
37
- outlines = [CukeModeler::Outline.new('Scenario Outline: 1'), CukeModeler::Outline.new('Scenario Outline: 2')]
40
+ outlines = [CukeModeler::Outline.new("Scenario Outline: 1\nExamples:\n|param|\n|value|"), CukeModeler::Outline.new("Scenario Outline: 2\nExamples:\n|param|\n|value|")]
38
41
 
39
42
  @feature.tests = scenarios + outlines
40
43
 
@@ -44,7 +47,7 @@ describe 'Feature, Integration' do
44
47
 
45
48
  it 'knows how many scenarios it has - #scenario_count' do
46
49
  scenarios = [CukeModeler::Scenario.new('Scenario: 1'), CukeModeler::Scenario.new('Scenario: 2')]
47
- outlines = [CukeModeler::Outline.new('Scenario Outline: 1')]
50
+ outlines = [CukeModeler::Outline.new("Scenario Outline: 1\nExamples:\n|param|\n|value|")]
48
51
 
49
52
  @feature.tests = []
50
53
  @feature.scenario_count.should == 0
@@ -55,7 +58,7 @@ describe 'Feature, Integration' do
55
58
 
56
59
  it 'knows how many outlines it has - #outline_count' do
57
60
  scenarios = [CukeModeler::Scenario.new('Scenario: 1')]
58
- outlines = [CukeModeler::Outline.new('Scenario Outline: 1'), CukeModeler::Outline.new('Scenario Outline: 2')]
61
+ outlines = [CukeModeler::Outline.new("Scenario Outline: 1\nExamples:\n|param|\n|value|"), CukeModeler::Outline.new("Scenario Outline: 2\nExamples:\n|param|\n|value|")]
59
62
 
60
63
  @feature.tests = []
61
64
  @feature.outline_count.should == 0
@@ -9,7 +9,8 @@ describe 'Outline, Integration' do
9
9
  ' Scenario Outline:',
10
10
  ' * a step',
11
11
  ' Examples:',
12
- ' | param |']
12
+ ' | param |',
13
+ ' | value |']
13
14
  source = source.join("\n")
14
15
 
15
16
  outline = CukeModeler::Outline.new(source)
@@ -31,7 +32,8 @@ describe 'Outline, Integration' do
31
32
  ' Scenario Outline: Test test',
32
33
  ' * a step',
33
34
  ' Examples: Test example',
34
- ' | a param |']
35
+ ' | a param |',
36
+ ' | a value |']
35
37
  source = source.join("\n")
36
38
 
37
39
  file_path = "#{@default_file_directory}/outline_test_file.feature"
@@ -15,7 +15,8 @@ describe 'Tag, Integration' do
15
15
  '',
16
16
  ' @example_tag',
17
17
  ' Examples: Test example',
18
- ' | a param |']
18
+ ' | a param |',
19
+ ' | a value |']
19
20
  source = source.join("\n")
20
21
 
21
22
  file_path = "#{@default_file_directory}/tag_test_file.feature"
@@ -14,6 +14,12 @@ require "#{File.dirname(__FILE__)}/unit/sourced_element_unit_specs"
14
14
  require "#{File.dirname(__FILE__)}/unit/raw_element_unit_specs"
15
15
 
16
16
  RSpec.configure do |config|
17
+ if Gem.loaded_specs['gherkin'].version.version[/^3/]
18
+ config.filter_run_excluding :gherkin2 => true
19
+ else
20
+ config.filter_run_excluding :gherkin3 => true
21
+ end
22
+
17
23
  config.before(:all) do
18
24
  @default_file_directory = "#{File.dirname(__FILE__)}/temp_files"
19
25
  @default_feature_file_name = 'test_feature.feature'
@@ -24,6 +24,23 @@ describe 'Background, Unit' do
24
24
  @element.name.should == 'test background'
25
25
  end
26
26
 
27
+ it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
28
+ background = clazz.new('Background: test background')
29
+ raw_data = background.raw_element
30
+
31
+ expect(raw_data.keys).to match_array([:type, :location, :keyword, :name, :steps])
32
+ expect(raw_data[:type]).to eq(:Background)
33
+ end
34
+
35
+ it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
36
+ background = clazz.new('Background: test background')
37
+ raw_data = background.raw_element
38
+
39
+ expect(raw_data.keys).to match_array(['keyword', 'name', 'line', 'description', 'type'])
40
+ expect(raw_data['keyword']).to eq('Background')
41
+ end
42
+
43
+
27
44
  context 'background output edge cases' do
28
45
 
29
46
  before(:each) do
@@ -22,6 +22,23 @@ describe 'DocString, Unit' do
22
22
  @element.contents.should == ["some doc string"]
23
23
  end
24
24
 
25
+ it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
26
+ doc_string = clazz.new("\"\"\"\nsome doc string\n\"\"\"")
27
+ raw_data = doc_string.raw_element
28
+
29
+ expect(raw_data.keys).to match_array([:type, :location, :content])
30
+ expect(raw_data[:type]).to eq(:DocString)
31
+ end
32
+
33
+ it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
34
+ doc_string = clazz.new("\"\"\"\nsome doc string\n\"\"\"")
35
+ raw_data = doc_string.raw_element
36
+
37
+ expect(raw_data.keys).to match_array(['value', 'content_type', 'line'])
38
+ expect(raw_data['value']).to eq('some doc string')
39
+ end
40
+
41
+
25
42
  before(:each) do
26
43
  @doc_string = clazz.new
27
44
  end
@@ -18,7 +18,8 @@ describe 'Example, Unit' do
18
18
 
19
19
  it 'can be parsed from stand alone text' do
20
20
  source = ['Examples: test example',
21
- '|param| ']
21
+ '|param| ',
22
+ '|value|']
22
23
 
23
24
  source = source.join("\n")
24
25
 
@@ -28,6 +29,22 @@ describe 'Example, Unit' do
28
29
  @element.name.should == 'test example'
29
30
  end
30
31
 
32
+ it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
33
+ example = clazz.new("Examples: test example\n|param|\n|value|")
34
+ raw_data = example.raw_element
35
+
36
+ expect(raw_data.keys).to match_array([:type, :tags, :location, :keyword, :name, :tableHeader, :tableBody])
37
+ expect(raw_data[:type]).to eq(:Examples)
38
+ end
39
+
40
+ it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
41
+ example = clazz.new("Examples: test example\n|param|\n|value|")
42
+ raw_data = example.raw_element
43
+
44
+ expect(raw_data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'rows'])
45
+ expect(raw_data['keyword']).to eq('Examples')
46
+ end
47
+
31
48
 
32
49
  before(:each) do
33
50
  @example = clazz.new
@@ -24,7 +24,7 @@ describe 'FeatureFile, Unit' do
24
24
 
25
25
  it 'knows the name of the file that it is modeling' do
26
26
  path = "#{@default_file_directory}/#{@default_feature_file_name}"
27
- File.open(path, "w") {}
27
+ File.open(path, "w") { |file| file.puts "Feature:" }
28
28
 
29
29
  feature = CukeModeler::FeatureFile.new(path)
30
30
 
@@ -33,7 +33,7 @@ describe 'FeatureFile, Unit' do
33
33
 
34
34
  it 'knows the path of the file that it is modeling' do
35
35
  path = "#{@default_file_directory}/#{@default_feature_file_name}"
36
- File.open(path, "w") {}
36
+ File.open(path, "w") { |file| file.puts "Feature:" }
37
37
 
38
38
  directory = CukeModeler::FeatureFile.new(path)
39
39
 
@@ -28,6 +28,22 @@ describe 'Feature, Unit' do
28
28
  @element.name.should == 'test feature'
29
29
  end
30
30
 
31
+ it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
32
+ feature = clazz.new('Feature: test feature')
33
+ raw_data = feature.raw_element
34
+
35
+ expect(raw_data.keys).to match_array([:type, :tags, :location, :language, :keyword, :name, :scenarioDefinitions, :comments])
36
+ expect(raw_data[:type]).to eq(:Feature)
37
+ end
38
+
39
+ it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
40
+ feature = clazz.new('Feature: test feature')
41
+ raw_data = feature.raw_element
42
+
43
+ expect(raw_data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'uri'])
44
+ expect(raw_data['keyword']).to eq('Feature')
45
+ end
46
+
31
47
  it 'will complain about unknown element types' do
32
48
  parsed_element = {'description' => '',
33
49
  'elements' => [{'keyword' => 'Scenario', 'description' => ''},
@@ -18,7 +18,10 @@ describe 'Outline, Unit' do
18
18
 
19
19
 
20
20
  it 'can be parsed from stand alone text' do
21
- source = 'Scenario Outline: test outline'
21
+ source = "Scenario Outline: test outline
22
+ Examples:
23
+ |param|
24
+ |value|"
22
25
 
23
26
  expect { @element = clazz.new(source) }.to_not raise_error
24
27
 
@@ -26,6 +29,22 @@ describe 'Outline, Unit' do
26
29
  @element.name.should == 'test outline'
27
30
  end
28
31
 
32
+ it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
33
+ outline = clazz.new("Scenario Outline: test outline\nExamples:\n|param|\n|value|")
34
+ raw_data = outline.raw_element
35
+
36
+ expect(raw_data.keys).to match_array([:type, :tags, :location, :keyword, :name, :steps, :examples])
37
+ expect(raw_data[:type]).to eq(:ScenarioOutline)
38
+ end
39
+
40
+ it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
41
+ outline = clazz.new("Scenario Outline: test outline\nExamples:\n|param|\n|value|")
42
+ raw_data = outline.raw_element
43
+
44
+ expect(raw_data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'type'])
45
+ expect(raw_data['keyword']).to eq('Scenario Outline')
46
+ end
47
+
29
48
 
30
49
  before(:each) do
31
50
  @outline = clazz.new
@@ -21,6 +21,24 @@ describe 'Row, Unit' do
21
21
  @element.cells.should == ['a', 'row']
22
22
  end
23
23
 
24
+ it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
25
+ example_row = clazz.new("| a | row |")
26
+ raw_data = example_row.raw_element
27
+
28
+ expect(raw_data.keys).to match_array([:type, :location, :cells])
29
+ expect(raw_data[:type]).to eq('TableRow') # Open bug in the gherkin gem. Should be a symbol like the others.
30
+ # expect(raw_data[:type]).to eq(:TableRow)
31
+ end
32
+
33
+ it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
34
+ example_row = clazz.new("| a | row |")
35
+ raw_data = example_row.raw_element
36
+
37
+ expect(raw_data.keys).to match_array(['cells', 'line', 'id'])
38
+ expect(raw_data['cells']).to eq(['a', 'row'])
39
+ end
40
+
41
+
24
42
  before(:each) do
25
43
  @row = clazz.new
26
44
  end
@@ -25,6 +25,23 @@ describe 'Scenario, Unit' do
25
25
  @element.name.should == 'test scenario'
26
26
  end
27
27
 
28
+ it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
29
+ scenario = clazz.new("Scenario: test scenario")
30
+ raw_data = scenario.raw_element
31
+
32
+ expect(raw_data.keys).to match_array([:type, :tags, :location, :keyword, :name, :steps])
33
+ expect(raw_data[:type]).to eq(:Scenario)
34
+ end
35
+
36
+ it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
37
+ scenario = clazz.new("Scenario: test scenario")
38
+ raw_data = scenario.raw_element
39
+
40
+ expect(raw_data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'type'])
41
+ expect(raw_data['keyword']).to eq('Scenario')
42
+ end
43
+
44
+
28
45
  before(:each) do
29
46
  @scenario = clazz.new
30
47
  end
@@ -187,6 +187,23 @@ describe 'Step, Unit' do
187
187
  @element.base.should == 'test step'
188
188
  end
189
189
 
190
+ it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
191
+ step = clazz.new("* test step")
192
+ raw_data = step.raw_element
193
+
194
+ expect(raw_data.keys).to match_array([:type, :location, :keyword, :text])
195
+ expect(raw_data[:type]).to eq(:Step)
196
+ end
197
+
198
+ it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
199
+ step = clazz.new("* test step")
200
+ raw_data = step.raw_element
201
+
202
+ expect(raw_data.keys).to match_array(['keyword', 'name', 'line'])
203
+ expect(raw_data['keyword']).to eq('* ')
204
+ end
205
+
206
+
190
207
  context '#step_text' do
191
208
 
192
209
  before(:each) do
@@ -21,6 +21,24 @@ describe 'TableRow, Unit' do
21
21
  @element.cells.should == ['a', 'row']
22
22
  end
23
23
 
24
+ it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
25
+ table_row = clazz.new("| a | row |")
26
+ raw_data = table_row.raw_element
27
+
28
+ expect(raw_data.keys).to match_array([:type, :location, :cells])
29
+ expect(raw_data[:type]).to eq('TableRow') # Open bug in the gherkin gem. Should be a symbol like the others.
30
+ # expect(raw_data[:type]).to eq(:TableRow)
31
+ end
32
+
33
+ it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
34
+ table_row = clazz.new("| a | row |")
35
+ raw_data = table_row.raw_element
36
+
37
+ expect(raw_data.keys).to match_array(['cells', 'line'])
38
+ expect(raw_data['cells']).to eq(['a', 'row'])
39
+ end
40
+
41
+
24
42
  before(:each) do
25
43
  @row = clazz.new
26
44
  end
@@ -22,6 +22,22 @@ describe 'Table, Unit' do
22
22
  @element.contents.should == [['a table']]
23
23
  end
24
24
 
25
+ it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
26
+ table = clazz.new("| a table |")
27
+ raw_data = table.raw_element
28
+
29
+ expect(raw_data.keys).to match_array([:type, :location, :rows])
30
+ expect(raw_data[:type]).to eq(:DataTable)
31
+ end
32
+
33
+ it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
34
+ table = clazz.new("| a table |")
35
+ raw_data = table.raw_element
36
+
37
+ expect(raw_data).to match_array([{"cells" => ["a table"], "line" => 4}])
38
+ end
39
+
40
+
25
41
  before(:each) do
26
42
  @table = clazz.new
27
43
  end
@@ -20,6 +20,23 @@ describe 'Tag, Unit' do
20
20
  @element.name.should == '@a_tag'
21
21
  end
22
22
 
23
+ it 'stores the original data generated by the parsing adapter', :gherkin3 => true do
24
+ tag = clazz.new('@a_tag')
25
+ raw_data = tag.raw_element
26
+
27
+ expect(raw_data.keys).to match_array([:type, :location, :name])
28
+ expect(raw_data[:type]).to eq('Tag')
29
+ end
30
+
31
+ it 'stores the original data generated by the parsing adapter', :gherkin2 => true do
32
+ tag = clazz.new('@a_tag')
33
+ raw_data = tag.raw_element
34
+
35
+ expect(raw_data.keys).to match_array(['name', 'line'])
36
+ expect(raw_data['name']).to eq('@a_tag')
37
+ end
38
+
39
+
23
40
  before(:each) do
24
41
  @element = clazz.new
25
42
  end