Sha256: cec69fddf6a7db0a1fa7ac479bdaa28724882123389b2cff50f9a6ec5742b340

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

describe UBImporter do
  
  let(:importer) { UBImporter.new('spec/fixtures/sample.csv') }
  
  describe "#original_lines" do
    it "should load the file" do
      importer.should have(3).original_lines
      importer.should have(3).changed_lines
    end
    
    it "should change the last few parts of the first line" do
      importer.changed_lines.first.length.should == 18
      importer.changed_lines.first[17].should == 'Amount'
      importer.changed_lines.first[16].should == 'TxType'
    end
    
    it "should change the last few parts of the second line" do
      importer.changed_lines[1].length.should == 18
      importer.changed_lines[1][17].should == '-900.00'
      importer.changed_lines[1][16].should == 'DEBIT'
    end

    it "should change the last few parts of the third line" do
      importer.changed_lines[2].length.should == 18
      importer.changed_lines[2][17].should == '3811.50'
      importer.changed_lines[2][16].should == 'CREDIT'
    end
  end
  
  describe "#output" do
    it "should output the file correctly" do
      importer.output.should == File.read('spec/fixtures/sample_output.csv')
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ubimport-0.1.0 spec/ub_importer_spec.rb