Sha256: e629f023abe3c5d9f9ad1b71145c79c1ec27564e6ef11a3a113863472e1a31c4

Contents?: true

Size: 625 Bytes

Versions: 4

Compression:

Stored size: 625 Bytes

Contents

require_relative '../spec_helper'

module BankgiroInbetalningar
  class Tk00 < BgmaxLine
    field :currency, 3..5, 'A:h'
    field :cents, 6..11, 'N:h0'
    field :flag, 12, 'N:-'
  end
  describe BgmaxLine do
    it "knows its children" do
      BgmaxLine.parsers['00'].should == Tk00
    end
    context "fields" do
      subject { Tk00.new("00SEK0001234") }

      it "can be strings" do
        subject.currency.should == 'SEK'
      end
      it "can be a 0-padded number" do
        subject.cents.should == 123
      end
      it 'can be a numeric flag' do
        subject.flag.should == 4
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bankgiro_inbetalningar-1.2.0 spec/bankgiro_inbetalningar/bgmax_line_spec.rb
bankgiro_inbetalningar-1.1.1 spec/bankgiro_inbetalningar/bgmax_line_spec.rb
bankgiro_inbetalningar-1.1.0 spec/bankgiro_inbetalningar/bgmax_line_spec.rb
bankgiro_inbetalningar-1.0.0 spec/bankgiro_inbetalningar/bgmax_line_spec.rb