Sha256: a6e2b4535246db6010ab65d8610696ce99f7d61ba8e7f6c25c2479e57c7f0422

Contents?: true

Size: 702 Bytes

Versions: 5

Compression:

Stored size: 702 Bytes

Contents

module SpecTracker
  module SpecParser
    class CSVParser < BaseParser
      private

      def spec_file_extension
        '.csv'
      end

      def parse_single(csv_file)
        scenarios = []
        scenario_id_header = SpecTracker.configuration.scenario_id_header
        scenario_name_header = SpecTracker.configuration.scenario_name_header
        CSV.foreach(csv_file, headers: true, skip_blanks: true) do |row|
          next if row[scenario_id_header].nil?
          scenario_id = row[scenario_id_header]
          scenario_name = row[scenario_name_header]
          scenarios << Scenario.new(id: scenario_id, name: scenario_name)
        end
        scenarios
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spec_tracker-1.2.4 lib/spec_tracker/spec_parser/csv_parser.rb
spec_tracker-1.2.3 lib/spec_tracker/spec_parser/csv_parser.rb
spec_tracker-1.2.2 lib/spec_tracker/spec_parser/csv_parser.rb
spec_tracker-1.2.1 lib/spec_tracker/spec_parser/csv_parser.rb
spec_tracker-1.2.0 lib/spec_tracker/spec_parser/csv_parser.rb