cuke_modeler 2.0.0 → 2.1.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.
- checksums.yaml +4 -4
 - data/.travis.yml +51 -33
 - data/CHANGELOG.md +13 -2
 - data/Gemfile +9 -2
 - data/appveyor.yml +29 -2
 - data/cuke_modeler.gemspec +1 -1
 - data/lib/cuke_modeler/adapters/gherkin_4_adapter.rb +1 -1
 - data/lib/cuke_modeler/adapters/gherkin_5_adapter.rb +12 -0
 - data/lib/cuke_modeler/adapters/gherkin_7_adapter.rb +307 -0
 - data/lib/cuke_modeler/adapters/gherkin_8_adapter.rb +12 -0
 - data/lib/cuke_modeler/adapters/gherkin_9_adapter.rb +12 -0
 - data/lib/cuke_modeler/parsing.rb +116 -108
 - data/lib/cuke_modeler/version.rb +1 -1
 - data/testing/gemfiles/gherkin7.gemfile +9 -0
 - data/testing/gemfiles/gherkin8.gemfile +9 -0
 - data/testing/gemfiles/gherkin9.gemfile +9 -0
 - data/testing/helper_methods.rb +23 -0
 - data/testing/rspec/spec/integration/adapters/gherkin_2_adapter_spec.rb +1 -1
 - data/testing/rspec/spec/integration/adapters/gherkin_3_adapter_spec.rb +1 -1
 - data/testing/rspec/spec/integration/adapters/gherkin_4_adapter_spec.rb +1 -1
 - data/testing/rspec/spec/integration/adapters/gherkin_5_adapter_spec.rb +165 -0
 - data/testing/rspec/spec/integration/adapters/gherkin_6_adapter_spec.rb +1 -8
 - data/testing/rspec/spec/integration/adapters/gherkin_7_adapter_spec.rb +162 -0
 - data/testing/rspec/spec/integration/adapters/gherkin_8_adapter_spec.rb +162 -0
 - data/testing/rspec/spec/integration/adapters/gherkin_9_adapter_spec.rb +162 -0
 - data/testing/rspec/spec/integration/models/background_integration_spec.rb +19 -23
 - data/testing/rspec/spec/integration/models/cell_integration_spec.rb +27 -24
 - data/testing/rspec/spec/integration/models/comment_integration_spec.rb +26 -23
 - data/testing/rspec/spec/integration/models/doc_string_integration_spec.rb +19 -23
 - data/testing/rspec/spec/integration/models/example_integration_spec.rb +50 -38
 - data/testing/rspec/spec/integration/models/feature_file_integration_spec.rb +32 -28
 - data/testing/rspec/spec/integration/models/feature_integration_spec.rb +28 -23
 - data/testing/rspec/spec/integration/models/outline_integration_spec.rb +39 -44
 - data/testing/rspec/spec/integration/models/row_integration_spec.rb +35 -23
 - data/testing/rspec/spec/integration/models/scenario_integration_spec.rb +19 -23
 - data/testing/rspec/spec/integration/models/step_integration_spec.rb +51 -47
 - data/testing/rspec/spec/integration/models/table_integration_spec.rb +19 -23
 - data/testing/rspec/spec/integration/models/tag_integration_spec.rb +35 -23
 - data/testing/rspec/spec/integration/parsing_integration_spec.rb +27 -6
 - data/testing/rspec/spec/spec_helper.rb +39 -46
 - metadata +16 -4
 
| 
         @@ -37,36 +37,32 @@ describe 'Background, Integration' do 
     | 
|
| 
       37 
37 
     | 
    
         
             
                  end
         
     | 
| 
       38 
38 
     | 
    
         
             
                end
         
     | 
| 
       39 
39 
     | 
    
         | 
| 
       40 
     | 
    
         
            -
                 
     | 
| 
       41 
     | 
    
         
            -
                  background = clazz.new("#{BACKGROUND_KEYWORD}: test background\ndescription\n#{STEP_KEYWORD} a step")
         
     | 
| 
       42 
     | 
    
         
            -
                  data = background.parsing_data
         
     | 
| 
      
 40 
     | 
    
         
            +
                describe 'parsing data' do
         
     | 
| 
       43 
41 
     | 
    
         | 
| 
       44 
     | 
    
         
            -
                   
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
      
 42 
     | 
    
         
            +
                  it 'stores the original data generated by the parsing adapter', :if => gherkin?(6, 7, 8, 9) do
         
     | 
| 
      
 43 
     | 
    
         
            +
                    background = clazz.new("#{BACKGROUND_KEYWORD}: test background\ndescription\n#{STEP_KEYWORD} a step")
         
     | 
| 
      
 44 
     | 
    
         
            +
                    data = background.parsing_data
         
     | 
| 
       47 
45 
     | 
    
         | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
                   
     | 
| 
      
 46 
     | 
    
         
            +
                    expect(data.keys).to match_array([:background, :rule, :scenario])
         
     | 
| 
      
 47 
     | 
    
         
            +
                    expect(data[:background][:name]).to eq('test background')
         
     | 
| 
      
 48 
     | 
    
         
            +
                  end
         
     | 
| 
       51 
49 
     | 
    
         | 
| 
       52 
     | 
    
         
            -
                   
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
      
 50 
     | 
    
         
            +
                  it 'stores the original data generated by the parsing adapter', :if => gherkin?(3, 4, 5) do
         
     | 
| 
      
 51 
     | 
    
         
            +
                    background = clazz.new("#{BACKGROUND_KEYWORD}: test background\ndescription\n#{STEP_KEYWORD} a step")
         
     | 
| 
      
 52 
     | 
    
         
            +
                    data = background.parsing_data
         
     | 
| 
       55 
53 
     | 
    
         | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
                   
     | 
| 
      
 54 
     | 
    
         
            +
                    expect(data.keys).to match_array([:type, :location, :keyword, :name, :steps, :description])
         
     | 
| 
      
 55 
     | 
    
         
            +
                    expect(data[:type]).to eq(:Background)
         
     | 
| 
      
 56 
     | 
    
         
            +
                  end
         
     | 
| 
       59 
57 
     | 
    
         | 
| 
       60 
     | 
    
         
            -
                   
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
      
 58 
     | 
    
         
            +
                  it 'stores the original data generated by the parsing adapter', :if => gherkin?(2) do
         
     | 
| 
      
 59 
     | 
    
         
            +
                    background = clazz.new("#{BACKGROUND_KEYWORD}: test background\ndescription\n#{STEP_KEYWORD} a step")
         
     | 
| 
      
 60 
     | 
    
         
            +
                    data = background.parsing_data
         
     | 
| 
       63 
61 
     | 
    
         | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
                   
     | 
| 
      
 62 
     | 
    
         
            +
                    expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'steps', 'type'])
         
     | 
| 
      
 63 
     | 
    
         
            +
                    expect(data['keyword']).to eq('Background')
         
     | 
| 
      
 64 
     | 
    
         
            +
                  end
         
     | 
| 
       67 
65 
     | 
    
         | 
| 
       68 
     | 
    
         
            -
                  expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'steps', 'type'])
         
     | 
| 
       69 
     | 
    
         
            -
                  expect(data['keyword']).to eq('Background')
         
     | 
| 
       70 
66 
     | 
    
         
             
                end
         
     | 
| 
       71 
67 
     | 
    
         | 
| 
       72 
68 
     | 
    
         
             
                it 'provides a descriptive filename when being parsed from stand alone text' do
         
     | 
| 
         @@ -44,38 +44,41 @@ describe 'Cell, Integration' do 
     | 
|
| 
       44 
44 
     | 
    
         
             
                  expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_cell\.feature'/)
         
     | 
| 
       45 
45 
     | 
    
         
             
                end
         
     | 
| 
       46 
46 
     | 
    
         | 
| 
       47 
     | 
    
         
            -
                 
     | 
| 
       48 
     | 
    
         
            -
                  cell = clazz.new('a cell')
         
     | 
| 
       49 
     | 
    
         
            -
                  data = cell.parsing_data
         
     | 
| 
      
 47 
     | 
    
         
            +
                describe 'parsing data' do
         
     | 
| 
       50 
48 
     | 
    
         | 
| 
       51 
     | 
    
         
            -
                   
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
      
 49 
     | 
    
         
            +
                  it 'stores the original data generated by the parsing adapter', :if => gherkin?(6, 7, 8, 9) do
         
     | 
| 
      
 50 
     | 
    
         
            +
                    cell = clazz.new('a cell')
         
     | 
| 
      
 51 
     | 
    
         
            +
                    data = cell.parsing_data
         
     | 
| 
       54 
52 
     | 
    
         | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
                   
     | 
| 
      
 53 
     | 
    
         
            +
                    expect(data.keys).to match_array([:location, :value])
         
     | 
| 
      
 54 
     | 
    
         
            +
                    expect(data[:value]).to eq('a cell')
         
     | 
| 
      
 55 
     | 
    
         
            +
                  end
         
     | 
| 
       58 
56 
     | 
    
         | 
| 
       59 
     | 
    
         
            -
                   
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
      
 57 
     | 
    
         
            +
                  it 'stores the original data generated by the parsing adapter', :if => gherkin?(4, 5) do
         
     | 
| 
      
 58 
     | 
    
         
            +
                    cell = clazz.new('a cell')
         
     | 
| 
      
 59 
     | 
    
         
            +
                    data = cell.parsing_data
         
     | 
| 
       62 
60 
     | 
    
         | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
                   
     | 
| 
      
 61 
     | 
    
         
            +
                    expect(data.keys).to match_array([:type, :location, :value])
         
     | 
| 
      
 62 
     | 
    
         
            +
                    expect(data[:type]).to eq(:TableCell)
         
     | 
| 
      
 63 
     | 
    
         
            +
                  end
         
     | 
| 
       66 
64 
     | 
    
         | 
| 
       67 
     | 
    
         
            -
                   
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
      
 65 
     | 
    
         
            +
                  it 'stores the original data generated by the parsing adapter', :if => gherkin?(3) do
         
     | 
| 
      
 66 
     | 
    
         
            +
                    cell = clazz.new("a cell")
         
     | 
| 
      
 67 
     | 
    
         
            +
                    data = cell.parsing_data
         
     | 
| 
       70 
68 
     | 
    
         | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
                   
     | 
| 
      
 69 
     | 
    
         
            +
                    expect(data.keys).to match_array([:type, :location, :value])
         
     | 
| 
      
 70 
     | 
    
         
            +
                    expect(data[:type]).to eq('TableCell')
         
     | 
| 
      
 71 
     | 
    
         
            +
                  end
         
     | 
| 
       74 
72 
     | 
    
         | 
| 
       75 
     | 
    
         
            -
                   
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
      
 73 
     | 
    
         
            +
                  it 'stores the original data generated by the parsing adapter', :if => gherkin?(2) do
         
     | 
| 
      
 74 
     | 
    
         
            +
                    cell = clazz.new("a cell")
         
     | 
| 
      
 75 
     | 
    
         
            +
                    data = cell.parsing_data
         
     | 
| 
       78 
76 
     | 
    
         | 
| 
      
 77 
     | 
    
         
            +
                    # Cells did not exist as full fledged objects in the Gherkin2 parser
         
     | 
| 
      
 78 
     | 
    
         
            +
                    expect(data).to eq('a cell')
         
     | 
| 
      
 79 
     | 
    
         
            +
                  end
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
                end
         
     | 
| 
       79 
82 
     | 
    
         | 
| 
       80 
83 
     | 
    
         
             
                describe 'getting ancestors' do
         
     | 
| 
       81 
84 
     | 
    
         | 
| 
         @@ -44,37 +44,40 @@ describe 'Comment, Integration' do 
     | 
|
| 
       44 
44 
     | 
    
         
             
                  expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_comment\.feature'/)
         
     | 
| 
       45 
45 
     | 
    
         
             
                end
         
     | 
| 
       46 
46 
     | 
    
         | 
| 
       47 
     | 
    
         
            -
                 
     | 
| 
       48 
     | 
    
         
            -
                  comment = clazz.new('# a comment')
         
     | 
| 
       49 
     | 
    
         
            -
                  data = comment.parsing_data
         
     | 
| 
      
 47 
     | 
    
         
            +
                describe 'parsing data' do
         
     | 
| 
       50 
48 
     | 
    
         | 
| 
       51 
     | 
    
         
            -
                   
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
      
 49 
     | 
    
         
            +
                  it 'stores the original data generated by the parsing adapter', :if => gherkin?(6, 7, 8, 9) do
         
     | 
| 
      
 50 
     | 
    
         
            +
                    comment = clazz.new('# a comment')
         
     | 
| 
      
 51 
     | 
    
         
            +
                    data = comment.parsing_data
         
     | 
| 
       54 
52 
     | 
    
         | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
                   
     | 
| 
      
 53 
     | 
    
         
            +
                    expect(data.keys).to match_array([:location, :text])
         
     | 
| 
      
 54 
     | 
    
         
            +
                    expect(data[:text]).to eq('# a comment')
         
     | 
| 
      
 55 
     | 
    
         
            +
                  end
         
     | 
| 
       58 
56 
     | 
    
         | 
| 
       59 
     | 
    
         
            -
                   
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
      
 57 
     | 
    
         
            +
                  it 'stores the original data generated by the parsing adapter', :if => gherkin?(4, 5) do
         
     | 
| 
      
 58 
     | 
    
         
            +
                    comment = clazz.new('# a comment')
         
     | 
| 
      
 59 
     | 
    
         
            +
                    data = comment.parsing_data
         
     | 
| 
       62 
60 
     | 
    
         | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
                   
     | 
| 
      
 61 
     | 
    
         
            +
                    expect(data.keys).to match_array([:type, :location, :text])
         
     | 
| 
      
 62 
     | 
    
         
            +
                    expect(data[:type]).to eq(:Comment)
         
     | 
| 
      
 63 
     | 
    
         
            +
                  end
         
     | 
| 
       66 
64 
     | 
    
         | 
| 
       67 
     | 
    
         
            -
                   
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
      
 65 
     | 
    
         
            +
                  it 'stores the original data generated by the parsing adapter', :if => gherkin?(3) do
         
     | 
| 
      
 66 
     | 
    
         
            +
                    comment = clazz.new('# a comment')
         
     | 
| 
      
 67 
     | 
    
         
            +
                    data = comment.parsing_data
         
     | 
| 
       70 
68 
     | 
    
         | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
                   
     | 
| 
      
 69 
     | 
    
         
            +
                    expect(data.keys).to match_array([:type, :location, :text])
         
     | 
| 
      
 70 
     | 
    
         
            +
                    expect(data[:type]).to eq('Comment')
         
     | 
| 
      
 71 
     | 
    
         
            +
                  end
         
     | 
| 
       74 
72 
     | 
    
         | 
| 
       75 
     | 
    
         
            -
                   
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
      
 73 
     | 
    
         
            +
                  it 'stores the original data generated by the parsing adapter', :if => gherkin?(2) do
         
     | 
| 
      
 74 
     | 
    
         
            +
                    comment = clazz.new('# a comment')
         
     | 
| 
      
 75 
     | 
    
         
            +
                    data = comment.parsing_data
         
     | 
| 
       77 
76 
     | 
    
         | 
| 
      
 77 
     | 
    
         
            +
                    expect(data.keys).to match_array(['value', 'line'])
         
     | 
| 
      
 78 
     | 
    
         
            +
                  end
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
                end
         
     | 
| 
       78 
81 
     | 
    
         | 
| 
       79 
82 
     | 
    
         
             
                describe 'getting ancestors' do
         
     | 
| 
       80 
83 
     | 
    
         | 
| 
         @@ -43,36 +43,32 @@ describe 'DocString, Integration' do 
     | 
|
| 
       43 
43 
     | 
    
         
             
                  expect { clazz.new(source) }.to raise_error(/'cuke_modeler_stand_alone_doc_string\.feature'/)
         
     | 
| 
       44 
44 
     | 
    
         
             
                end
         
     | 
| 
       45 
45 
     | 
    
         | 
| 
       46 
     | 
    
         
            -
                 
     | 
| 
       47 
     | 
    
         
            -
                  doc_string = clazz.new("\"\"\" content type\nsome doc string\n\"\"\"")
         
     | 
| 
       48 
     | 
    
         
            -
                  data = doc_string.parsing_data
         
     | 
| 
      
 46 
     | 
    
         
            +
                describe 'parsing data' do
         
     | 
| 
       49 
47 
     | 
    
         | 
| 
       50 
     | 
    
         
            -
                   
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
      
 48 
     | 
    
         
            +
                  it 'stores the original data generated by the parsing adapter', :if => gherkin?(6, 7, 8, 9) do
         
     | 
| 
      
 49 
     | 
    
         
            +
                    doc_string = clazz.new("\"\"\" content type\nsome doc string\n\"\"\"")
         
     | 
| 
      
 50 
     | 
    
         
            +
                    data = doc_string.parsing_data
         
     | 
| 
       53 
51 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
                   
     | 
| 
      
 52 
     | 
    
         
            +
                    expect(data.keys).to match_array([:location, :content, :content_type, :delimiter])
         
     | 
| 
      
 53 
     | 
    
         
            +
                    expect(data[:content]).to eq('some doc string')
         
     | 
| 
      
 54 
     | 
    
         
            +
                  end
         
     | 
| 
       57 
55 
     | 
    
         | 
| 
       58 
     | 
    
         
            -
                   
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
      
 56 
     | 
    
         
            +
                  it 'stores the original data generated by the parsing adapter', :if => gherkin?(3, 4, 5) do
         
     | 
| 
      
 57 
     | 
    
         
            +
                    doc_string = clazz.new("\"\"\" content type\nsome doc string\n\"\"\"")
         
     | 
| 
      
 58 
     | 
    
         
            +
                    data = doc_string.parsing_data
         
     | 
| 
       61 
59 
     | 
    
         | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
                   
     | 
| 
      
 60 
     | 
    
         
            +
                    expect(data.keys).to match_array([:type, :location, :content, :contentType])
         
     | 
| 
      
 61 
     | 
    
         
            +
                    expect(data[:type]).to eq(:DocString)
         
     | 
| 
      
 62 
     | 
    
         
            +
                  end
         
     | 
| 
       65 
63 
     | 
    
         | 
| 
       66 
     | 
    
         
            -
                   
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
      
 64 
     | 
    
         
            +
                  it 'stores the original data generated by the parsing adapter', :if => gherkin?(2) do
         
     | 
| 
      
 65 
     | 
    
         
            +
                    doc_string = clazz.new("\"\"\" content type\nsome doc string\n\"\"\"")
         
     | 
| 
      
 66 
     | 
    
         
            +
                    data = doc_string.parsing_data
         
     | 
| 
       69 
67 
     | 
    
         | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
                   
     | 
| 
      
 68 
     | 
    
         
            +
                    expect(data.keys).to match_array(['value', 'content_type', 'line'])
         
     | 
| 
      
 69 
     | 
    
         
            +
                    expect(data['value']).to eq('some doc string')
         
     | 
| 
      
 70 
     | 
    
         
            +
                  end
         
     | 
| 
       73 
71 
     | 
    
         | 
| 
       74 
     | 
    
         
            -
                  expect(data.keys).to match_array(['value', 'content_type', 'line'])
         
     | 
| 
       75 
     | 
    
         
            -
                  expect(data['value']).to eq('some doc string')
         
     | 
| 
       76 
72 
     | 
    
         
             
                end
         
     | 
| 
       77 
73 
     | 
    
         | 
| 
       78 
74 
     | 
    
         
             
                it 'stores its content as a String' do
         
     | 
| 
         @@ -15,19 +15,13 @@ describe 'Example, Integration' do 
     | 
|
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
              describe 'unique behavior' do
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
                it 'can be instantiated with the minimum viable Gherkin', : 
     | 
| 
      
 18 
     | 
    
         
            +
                it 'can be instantiated with the minimum viable Gherkin', :if => gherkin?(4, 5, 6, 7, 8, 9) do
         
     | 
| 
       19 
19 
     | 
    
         
             
                  source = "#{EXAMPLE_KEYWORD}:"
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
                  expect { @model = clazz.new(source) }.to_not raise_error
         
     | 
| 
       22 
22 
     | 
    
         
             
                end
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
                it 'can be instantiated with the minimum viable Gherkin', : 
     | 
| 
       25 
     | 
    
         
            -
                  source = "#{EXAMPLE_KEYWORD}:"
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                  expect { @model = clazz.new(source) }.to_not raise_error
         
     | 
| 
       28 
     | 
    
         
            -
                end
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
                it 'can be instantiated with the minimum viable Gherkin', :gherkin3 => true do
         
     | 
| 
      
 24 
     | 
    
         
            +
                it 'can be instantiated with the minimum viable Gherkin', :if => gherkin?(3) do
         
     | 
| 
       31 
25 
     | 
    
         
             
                  source = "#{EXAMPLE_KEYWORD}:
         
     | 
| 
       32 
26 
     | 
    
         
             
                            |param|
         
     | 
| 
       33 
27 
     | 
    
         
             
                            |value|"
         
     | 
| 
         @@ -35,7 +29,7 @@ describe 'Example, Integration' do 
     | 
|
| 
       35 
29 
     | 
    
         
             
                  expect { @model = clazz.new(source) }.to_not raise_error
         
     | 
| 
       36 
30 
     | 
    
         
             
                end
         
     | 
| 
       37 
31 
     | 
    
         | 
| 
       38 
     | 
    
         
            -
                it 'can be instantiated with the minimum viable Gherkin', : 
     | 
| 
      
 32 
     | 
    
         
            +
                it 'can be instantiated with the minimum viable Gherkin', :if => gherkin?(2) do
         
     | 
| 
       39 
33 
     | 
    
         
             
                  source = "#{EXAMPLE_KEYWORD}:
         
     | 
| 
       40 
34 
     | 
    
         
             
                            |param|"
         
     | 
| 
       41 
35 
     | 
    
         | 
| 
         @@ -61,36 +55,32 @@ describe 'Example, Integration' do 
     | 
|
| 
       61 
55 
     | 
    
         
             
                  end
         
     | 
| 
       62 
56 
     | 
    
         
             
                end
         
     | 
| 
       63 
57 
     | 
    
         | 
| 
       64 
     | 
    
         
            -
                 
     | 
| 
       65 
     | 
    
         
            -
                  example = clazz.new("@tag\n#{EXAMPLE_KEYWORD}: test example\ndescription\n|param|\n|value|")
         
     | 
| 
       66 
     | 
    
         
            -
                  data = example.parsing_data
         
     | 
| 
      
 58 
     | 
    
         
            +
                describe 'parsing data' do
         
     | 
| 
       67 
59 
     | 
    
         | 
| 
       68 
     | 
    
         
            -
                   
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
      
 60 
     | 
    
         
            +
                  it 'stores the original data generated by the parsing adapter', :if => gherkin?(6, 7, 8, 9) do
         
     | 
| 
      
 61 
     | 
    
         
            +
                    example = clazz.new("@tag\n#{EXAMPLE_KEYWORD}: test example\ndescription\n|param|\n|value|")
         
     | 
| 
      
 62 
     | 
    
         
            +
                    data = example.parsing_data
         
     | 
| 
       71 
63 
     | 
    
         | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
                   
     | 
| 
      
 64 
     | 
    
         
            +
                    expect(data.keys).to match_array([:tags, :location, :keyword, :name, :table_header, :table_body, :description])
         
     | 
| 
      
 65 
     | 
    
         
            +
                    expect(data[:name]).to eq('test example')
         
     | 
| 
      
 66 
     | 
    
         
            +
                  end
         
     | 
| 
       75 
67 
     | 
    
         | 
| 
       76 
     | 
    
         
            -
                   
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
      
 68 
     | 
    
         
            +
                  it 'stores the original data generated by the parsing adapter', :if => gherkin?(3, 4, 5) do
         
     | 
| 
      
 69 
     | 
    
         
            +
                    example = clazz.new("@tag\n#{EXAMPLE_KEYWORD}: test example\ndescription\n|param|\n|value|")
         
     | 
| 
      
 70 
     | 
    
         
            +
                    data = example.parsing_data
         
     | 
| 
       79 
71 
     | 
    
         | 
| 
       80 
     | 
    
         
            -
             
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
                   
     | 
| 
      
 72 
     | 
    
         
            +
                    expect(data.keys).to match_array([:type, :tags, :location, :keyword, :name, :tableHeader, :tableBody, :description])
         
     | 
| 
      
 73 
     | 
    
         
            +
                    expect(data[:type]).to eq(:Examples)
         
     | 
| 
      
 74 
     | 
    
         
            +
                  end
         
     | 
| 
       83 
75 
     | 
    
         | 
| 
       84 
     | 
    
         
            -
                   
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
      
 76 
     | 
    
         
            +
                  it 'stores the original data generated by the parsing adapter', :if => gherkin?(2) do
         
     | 
| 
      
 77 
     | 
    
         
            +
                    example = clazz.new("@tag\n#{EXAMPLE_KEYWORD}: test example\ndescription\n|param|\n|value|")
         
     | 
| 
      
 78 
     | 
    
         
            +
                    data = example.parsing_data
         
     | 
| 
       87 
79 
     | 
    
         | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
                   
     | 
| 
      
 80 
     | 
    
         
            +
                    expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'rows', 'tags'])
         
     | 
| 
      
 81 
     | 
    
         
            +
                    expect(data['keyword']).to eq('Examples')
         
     | 
| 
      
 82 
     | 
    
         
            +
                  end
         
     | 
| 
       91 
83 
     | 
    
         | 
| 
       92 
     | 
    
         
            -
                  expect(data.keys).to match_array(['keyword', 'name', 'line', 'description', 'id', 'rows', 'tags'])
         
     | 
| 
       93 
     | 
    
         
            -
                  expect(data['keyword']).to eq('Examples')
         
     | 
| 
       94 
84 
     | 
    
         
             
                end
         
     | 
| 
       95 
85 
     | 
    
         | 
| 
       96 
86 
     | 
    
         
             
                it 'provides a descriptive filename when being parsed from stand alone text' do
         
     | 
| 
         @@ -132,10 +122,32 @@ describe 'Example, Integration' do 
     | 
|
| 
       132 
122 
     | 
    
         | 
| 
       133 
123 
     | 
    
         | 
| 
       134 
124 
     | 
    
         
             
                    # gherkin 2.x/3.x does not accept incomplete examples
         
     | 
| 
       135 
     | 
    
         
            -
                    it "models the example's keyword", : 
     | 
| 
      
 125 
     | 
    
         
            +
                    it "models the example's keyword", :unless => gherkin?(2, 3) do
         
     | 
| 
       136 
126 
     | 
    
         
             
                      expect(example.keyword).to eq("#{EXAMPLE_KEYWORD}")
         
     | 
| 
       137 
127 
     | 
    
         
             
                    end
         
     | 
| 
       138 
128 
     | 
    
         | 
| 
      
 129 
     | 
    
         
            +
                    context 'using gherkin 2.x', :if => gherkin?(2) do
         
     | 
| 
      
 130 
     | 
    
         
            +
             
     | 
| 
      
 131 
     | 
    
         
            +
                      let(:source_text) { "#{EXAMPLE_KEYWORD}:\n|param|" }
         
     | 
| 
      
 132 
     | 
    
         
            +
                      let(:example) { clazz.new(source_text) }
         
     | 
| 
      
 133 
     | 
    
         
            +
             
     | 
| 
      
 134 
     | 
    
         
            +
                      it "models the example's keyword" do
         
     | 
| 
      
 135 
     | 
    
         
            +
                        expect(example.keyword).to eq(EXAMPLE_KEYWORD)
         
     | 
| 
      
 136 
     | 
    
         
            +
                      end
         
     | 
| 
      
 137 
     | 
    
         
            +
             
     | 
| 
      
 138 
     | 
    
         
            +
                    end
         
     | 
| 
      
 139 
     | 
    
         
            +
             
     | 
| 
      
 140 
     | 
    
         
            +
                    context 'using gherkin 3.x', :if => gherkin?(3) do
         
     | 
| 
      
 141 
     | 
    
         
            +
             
     | 
| 
      
 142 
     | 
    
         
            +
                      let(:source_text) { "#{EXAMPLE_KEYWORD}:\n|param|\n|value|" }
         
     | 
| 
      
 143 
     | 
    
         
            +
                      let(:example) { clazz.new(source_text) }
         
     | 
| 
      
 144 
     | 
    
         
            +
             
     | 
| 
      
 145 
     | 
    
         
            +
                      it "models the example's keyword" do
         
     | 
| 
      
 146 
     | 
    
         
            +
                        expect(example.keyword).to eq(EXAMPLE_KEYWORD)
         
     | 
| 
      
 147 
     | 
    
         
            +
                      end
         
     | 
| 
      
 148 
     | 
    
         
            +
             
     | 
| 
      
 149 
     | 
    
         
            +
                    end
         
     | 
| 
      
 150 
     | 
    
         
            +
             
     | 
| 
       139 
151 
     | 
    
         
             
                    it "models the example's source line" do
         
     | 
| 
       140 
152 
     | 
    
         
             
                      source_text = "#{FEATURE_KEYWORD}:
         
     | 
| 
       141 
153 
     | 
    
         | 
| 
         @@ -197,7 +209,7 @@ describe 'Example, Integration' do 
     | 
|
| 
       197 
209 
     | 
    
         
             
                    end
         
     | 
| 
       198 
210 
     | 
    
         | 
| 
       199 
211 
     | 
    
         
             
                    # gherkin 2.x/3.x does not accept incomplete examples
         
     | 
| 
       200 
     | 
    
         
            -
                    context 'an empty example', : 
     | 
| 
      
 212 
     | 
    
         
            +
                    context 'an empty example', :unless => gherkin?(2, 3) do
         
     | 
| 
       201 
213 
     | 
    
         | 
| 
       202 
214 
     | 
    
         
             
                      let(:source_text) { "#{EXAMPLE_KEYWORD}:" }
         
     | 
| 
       203 
215 
     | 
    
         
             
                      let(:example) { clazz.new(source_text) }
         
     | 
| 
         @@ -586,7 +598,7 @@ describe 'Example, Integration' do 
     | 
|
| 
       586 
598 
     | 
    
         
             
                  context 'from source text' do
         
     | 
| 
       587 
599 
     | 
    
         | 
| 
       588 
600 
     | 
    
         
             
                    # gherkin 2.x/3.x does not accept incomplete examples
         
     | 
| 
       589 
     | 
    
         
            -
                    it 'can output an empty example', : 
     | 
| 
      
 601 
     | 
    
         
            +
                    it 'can output an empty example', :unless => gherkin?(2, 3) do
         
     | 
| 
       590 
602 
     | 
    
         
             
                      source = ["#{EXAMPLE_KEYWORD}:"]
         
     | 
| 
       591 
603 
     | 
    
         
             
                      source = source.join("\n")
         
     | 
| 
       592 
604 
     | 
    
         
             
                      example = clazz.new(source)
         
     | 
| 
         @@ -597,7 +609,7 @@ describe 'Example, Integration' do 
     | 
|
| 
       597 
609 
     | 
    
         
             
                    end
         
     | 
| 
       598 
610 
     | 
    
         | 
| 
       599 
611 
     | 
    
         
             
                    # gherkin 2.x/3.x does not accept incomplete examples
         
     | 
| 
       600 
     | 
    
         
            -
                    it 'can output an example that has a name', : 
     | 
| 
      
 612 
     | 
    
         
            +
                    it 'can output an example that has a name', :unless => gherkin?(2, 3) do
         
     | 
| 
       601 
613 
     | 
    
         
             
                      source = ["#{EXAMPLE_KEYWORD}: test example"]
         
     | 
| 
       602 
614 
     | 
    
         
             
                      source = source.join("\n")
         
     | 
| 
       603 
615 
     | 
    
         
             
                      example = clazz.new(source)
         
     | 
| 
         @@ -608,7 +620,7 @@ describe 'Example, Integration' do 
     | 
|
| 
       608 
620 
     | 
    
         
             
                    end
         
     | 
| 
       609 
621 
     | 
    
         | 
| 
       610 
622 
     | 
    
         
             
                    # gherkin 2.x/3.x does not accept incomplete examples
         
     | 
| 
       611 
     | 
    
         
            -
                    it 'can output an example that has a description', : 
     | 
| 
      
 623 
     | 
    
         
            +
                    it 'can output an example that has a description', :unless => gherkin?(2, 3) do
         
     | 
| 
       612 
624 
     | 
    
         
             
                      source = ["#{EXAMPLE_KEYWORD}:",
         
     | 
| 
       613 
625 
     | 
    
         
             
                                'Some description.',
         
     | 
| 
       614 
626 
     | 
    
         
             
                                'Some more description.']
         
     | 
| 
         @@ -625,7 +637,7 @@ describe 'Example, Integration' do 
     | 
|
| 
       625 
637 
     | 
    
         | 
| 
       626 
638 
     | 
    
         | 
| 
       627 
639 
     | 
    
         
             
                    # gherkin 3.x does not accept incomplete examples
         
     | 
| 
       628 
     | 
    
         
            -
                    it 'can output an example that has a single row', : 
     | 
| 
      
 640 
     | 
    
         
            +
                    it 'can output an example that has a single row', :unless => gherkin?(3) do
         
     | 
| 
       629 
641 
     | 
    
         
             
                      source = ["#{EXAMPLE_KEYWORD}:",
         
     | 
| 
       630 
642 
     | 
    
         
             
                                '|param1|param2|']
         
     | 
| 
       631 
643 
     | 
    
         
             
                      source = source.join("\n")
         
     | 
| 
         @@ -14,44 +14,48 @@ describe 'FeatureFile, Integration' do 
     | 
|
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
              describe 'unique behavior' do
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
                 
     | 
| 
       18 
     | 
    
         
            -
                  test_file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{FEATURE_KEYWORD}: test feature", :name => 'test_file')
         
     | 
| 
      
 17 
     | 
    
         
            +
                describe 'parsing data' do
         
     | 
| 
       19 
18 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
                   
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
      
 19 
     | 
    
         
            +
                  it 'stores the original data generated by the parsing adapter', :if => gherkin?(6, 7, 8, 9) do
         
     | 
| 
      
 20 
     | 
    
         
            +
                    test_file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{FEATURE_KEYWORD}: test feature", :name => 'test_file')
         
     | 
| 
       22 
21 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
                    feature_file = clazz.new(test_file_path)
         
     | 
| 
      
 23 
     | 
    
         
            +
                    data = feature_file.parsing_data
         
     | 
| 
       26 
24 
     | 
    
         | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
      
 25 
     | 
    
         
            +
                    expect(data.keys).to match_array([:uri, :feature, :comments])
         
     | 
| 
      
 26 
     | 
    
         
            +
                    expect(File.basename(data[:uri])).to eq('test_file.feature')
         
     | 
| 
      
 27 
     | 
    
         
            +
                  end
         
     | 
| 
       29 
28 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
                   
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
      
 29 
     | 
    
         
            +
                  it 'stores the original data generated by the parsing adapter', :if => gherkin?(4, 5) do
         
     | 
| 
      
 30 
     | 
    
         
            +
                    test_file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{FEATURE_KEYWORD}: test feature", :name => 'test_file')
         
     | 
| 
       32 
31 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
                    feature_file = clazz.new(test_file_path)
         
     | 
| 
      
 33 
     | 
    
         
            +
                    data = feature_file.parsing_data
         
     | 
| 
       36 
34 
     | 
    
         | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
      
 35 
     | 
    
         
            +
                    expect(data.keys).to match_array([:type, :feature, :comments])
         
     | 
| 
      
 36 
     | 
    
         
            +
                    expect(data[:type]).to eq(:GherkinDocument)
         
     | 
| 
      
 37 
     | 
    
         
            +
                  end
         
     | 
| 
       39 
38 
     | 
    
         | 
| 
       40 
     | 
    
         
            -
                   
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
      
 39 
     | 
    
         
            +
                  it 'stores the original data generated by the parsing adapter', :if => gherkin?(3) do
         
     | 
| 
      
 40 
     | 
    
         
            +
                    test_file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{FEATURE_KEYWORD}: test feature", :name => 'test_file')
         
     | 
| 
       42 
41 
     | 
    
         | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
                end
         
     | 
| 
      
 42 
     | 
    
         
            +
                    feature_file = clazz.new(test_file_path)
         
     | 
| 
      
 43 
     | 
    
         
            +
                    data = feature_file.parsing_data
         
     | 
| 
       46 
44 
     | 
    
         | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
      
 45 
     | 
    
         
            +
                    # There is no parsing data stored above the feature level for gherkin 3.x
         
     | 
| 
      
 46 
     | 
    
         
            +
                    expect(data).to be_nil
         
     | 
| 
      
 47 
     | 
    
         
            +
                  end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                  it 'stores the original data generated by the parsing adapter', :if => gherkin?(2) do
         
     | 
| 
      
 50 
     | 
    
         
            +
                    test_file_path = CukeModeler::FileHelper.create_feature_file(:text => "#{FEATURE_KEYWORD}: test feature", :name => 'test_file')
         
     | 
| 
       49 
51 
     | 
    
         | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
      
 52 
     | 
    
         
            +
                    feature_file = clazz.new(test_file_path)
         
     | 
| 
      
 53 
     | 
    
         
            +
                    data = feature_file.parsing_data
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                    # There is no parsing data stored above the feature level for gherkin 2.x
         
     | 
| 
      
 56 
     | 
    
         
            +
                    expect(data).to eq([])
         
     | 
| 
      
 57 
     | 
    
         
            +
                  end
         
     | 
| 
       52 
58 
     | 
    
         | 
| 
       53 
     | 
    
         
            -
                  # There is no parsing data stored above the feature level for gherkin 2.x
         
     | 
| 
       54 
     | 
    
         
            -
                  expect(data).to eq([])
         
     | 
| 
       55 
59 
     | 
    
         
             
                end
         
     | 
| 
       56 
60 
     | 
    
         | 
| 
       57 
61 
     | 
    
         
             
                it 'provides its own filename when being parsed' do
         
     | 
| 
         @@ -183,7 +187,7 @@ describe 'FeatureFile, Integration' do 
     | 
|
| 
       183 
187 
     | 
    
         | 
| 
       184 
188 
     | 
    
         | 
| 
       185 
189 
     | 
    
         
             
                  # gherkin 3.x does not accept empty feature files
         
     | 
| 
       186 
     | 
    
         
            -
                  context 'an empty feature file', : 
     | 
| 
      
 190 
     | 
    
         
            +
                  context 'an empty feature file', :unless => gherkin?(3) do
         
     | 
| 
       187 
191 
     | 
    
         | 
| 
       188 
192 
     | 
    
         
             
                    let(:source_text) { '' }
         
     | 
| 
       189 
193 
     | 
    
         |