Sha256: 5fb9e2c7ce55536fb6b6ca87cd88ca1b4a8692dc2804ee2d97292657870e5d97

Contents?: true

Size: 897 Bytes

Versions: 1

Compression:

Stored size: 897 Bytes

Contents

require 'spec_helper'

module AsciiDataTools
  module RecordType
    module Encoder
      describe FixedLengthRecordEncoder do
        before do
          @type = Object.new
          @type.extend(FixedLengthRecordEncoder)
        end
        
        context "fixed length records" do
          it "should pack the values of fixed length records back together" do
            @type.encode(["123", "abc", "\n"]).should == "123abc\n"
          end
        end
      end

      describe CsvRecordEncoder do
        before do
          @type = Object.new
          @type.stub!(:field_with_name).with(:divider).and_return(mock("divider field", :value => ";"))
          @type.extend(CsvRecordEncoder)
        end
        
        it "should pack the values of csv records back together" do
          @type.encode(["123", "abc", "XYZ"]).should == "123;abc;XYZ\n"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ascii-data-tools-0.9 spec/ascii-data-tools/record_type/encoder_spec.rb