Sha256: 6ec06f298594f32e0778610caa1856f3ed6a4a4db1e073ee6a5f26a08b3b2c5c
Contents?: true
Size: 1013 Bytes
Versions: 1
Compression:
Stored size: 1013 Bytes
Contents
# frozen_string_literal: true require 'gherkin/gherkin' require 'gherkin/dialect' module Cucumber module Gherkin class DataTableParser def initialize(builder) @builder = builder end def parse(text) gherkin_document = nil messages = ::Gherkin::Gherkin.from_source('dummy', feature_header + text, include_source: false, include_pickles: false) messages.each do |message| gherkin_document = message.gherkinDocument.to_hash unless message.gherkinDocument.nil? end return if gherkin_document.nil? gherkin_document[:feature][:children][0][:scenario][:steps][0][:data_table][:rows].each do |row| @builder.row(row[:cells].map { |cell| cell[:value] }) end end def feature_header dialect = ::Gherkin::Dialect.for('en') %(#{dialect.feature_keywords[0]}: #{dialect.scenario_keywords[0]}: #{dialect.given_keywords[0]} x ) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cucumber-4.0.0.rc.1 | lib/cucumber/gherkin/data_table_parser.rb |