Sha256: da4c4f2ff6f2c081f213d109fd04f2710c28e85496e0af007ef9408842d94943

Contents?: true

Size: 885 Bytes

Versions: 5

Compression:

Stored size: 885 Bytes

Contents

require 'helper'
require 'peddler/parser'

class CSVParserTest < MiniTest::Test
  def setup
    body = "Feed Processing Summary:\n\tNumber of records processed\t\t11006\n\tNumber of records successful\t\t11006\n\noriginal-record-number\tsku\terror-code\terror-type\terror-message\n1822\t85da472e-ba6c-11e3-95af-002590a74356\t5000\tWarning\tThe update for Sku '85da472e-ba6c-11e3-95af-002590a74356' was skipped because it is identical to the update in feed '9518995390'.\n"
    headers = { 'Content-Type' => 'application/octet-stream', 'Content-MD5' => 'SmZIMTs2mCO8u8QzR5LE7Q==' }
    res = OpenStruct.new(body: body, headers: headers)

    @parser = Peddler::Parser.parse(res)
  end

  def test_parses_data
    assert_kind_of CSV::Table, @parser.parse
  end

  def test_summarises
    refute_empty @parser.records_count
  end

  def test_validates
    assert @parser.valid?
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
peddler-0.7.5 test/unit/peddler/test_csv_parser.rb
peddler-0.7.3 test/unit/peddler/test_csv_parser.rb
peddler-0.7.2 test/unit/peddler/test_csv_parser.rb
peddler-0.7.1 test/unit/peddler/test_csv_parser.rb
peddler-0.7.0 test/unit/peddler/test_csv_parser.rb