Sha256: 9e26b46921f0fc9a52a7c9457c7103c574042d36cdac8bc61287a534051b8385

Contents?: true

Size: 1.39 KB

Versions: 5

Compression:

Stored size: 1.39 KB

Contents

require 'spec_helper'

describe "parsing a BH.csv file" do

  it "uses the correct version" do
    lambda { EfoNelfo.load(csv('B123.v3.csv')) }.must_raise EfoNelfo::UnsupportedPostType
  end

  it "parses the file and returns an Order" do
    EfoNelfo.load(csv('B650517.032.csv')).must_be_instance_of EfoNelfo::V40::BH
  end

  it "the order contains order information" do
    order = EfoNelfo.load(csv('B650517.032.csv'))
    order.post_type.must_equal 'BH'
    order.format.must_equal 'EFONELFO'
    order.version.must_equal '4.0'
  end

  it "the order contains orderlines" do
    order = EfoNelfo.load(csv('B650517.032.csv'))

    line = order.lines.first
    line.must_be_instance_of EfoNelfo::V40::BL

    line.post_type.must_equal 'BL'

    line.index.must_equal 1
    line.order_number.must_equal '1465'
    line.item_count.must_equal 200
    line.price_unit.must_equal "EA"
    line.buyer_item_number.must_be_nil
    line.delivery_date.must_equal Date.new(2010, 6, 1)
    line.buyer_ref.must_be_nil
    line.splitable.must_equal true
    line.replacable.must_equal true

    line.item_type.must_equal 1
    line.item_number.must_equal '8000502'
    line.item_name.must_equal '200L OSO STD BEREDER SUPER S'
    line.item_description.must_be_nil
  end

  it "adds text to orderline" do
    order = EfoNelfo.load(csv('B650517.032.csv'))
    order.lines.first.text.first.to_s.must_equal "Her er litt fritekst"
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
efo_nelfo-1.5.3 spec/parsing/bh_spec.rb
efo_nelfo-1.5.2 spec/parsing/bh_spec.rb
efo_nelfo-1.5.1 spec/parsing/bh_spec.rb
efo_nelfo-1.5.0 spec/parsing/bh_spec.rb
efo_nelfo-1.4.0 spec/parsing/bh_spec.rb