Sha256: f07b1d180892de63f0a2402cbf56ca9c455c521e16e13cabf1f35a4afeadff49

Contents?: true

Size: 1.27 KB

Versions: 1

Compression:

Stored size: 1.27 KB

Contents

require 'spec_helper'

describe Metro2::Records::HeaderSegment do
  before(:each) do
    @header = Metro2::Records::HeaderSegment.new
    @header.cycle_number = 15
    @header.equifax_program_identifier = 'EFAXID'
    @header.transunion_program_identifier = 'TRANSUNION'
    @header.activity_date = Date.new(2014,9,14)
    @header.created_date = Date.new(2014,9,15)
    @header.program_date = Date.new(2014,9,1)
    @header.program_revision_date = '01'
    @header.reporter_name = 'Credit Reporter'
    @header.reporter_address = '123 Report Dr Address CA 91111'
    @header.reporter_telephone_number = '5555555555'
  end

  describe '#to_metro2' do
    it 'should generate header segment string' do
      exp = [
        '0426',
        'HEADER',
        '15',
        '          ',
        'EFAXID    ',
        '     ',
        'TRANSUNION',
        '09142014',
        '09152014',
        '09012014',
        '00000001',
        'Credit Reporter'.ljust(40, ' '),
        '123 Report Dr Address CA 91111'.ljust(96, ' '),
        '5555555555',
        'Upstart Engineer metro 2 gem'.ljust(40, ' '),
        '01000',
        ' ' * 156
      ]
      header_str = @header.to_metro2
      expect(header_str).to eql(exp.join(''))
      expect(header_str.size).to eql(Metro2::FIXED_LENGTH)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
metro_2-1.0.0 spec/records/header_segment_spec.rb