Sha256: faf435008c62100bf76688b9b832f7ad9cf2ce441f1c23f1d9d4a0b05b1e5e6b
Contents?: true
Size: 869 Bytes
Versions: 2
Compression:
Stored size: 869 Bytes
Contents
require 'spec_helper' describe ACH::Record do before(:all) do class Entry < ACH::Record fields :customer_name, :amount defaults :customer_name => 'JOHN SMITH' end end it "should have 2 ordered fields" do Entry.fields.should == [:customer_name, :amount] end it "should create a record with default value" do Entry.new.customer_name.should == 'JOHN SMITH' end it "should overwrite default value" do entry = Entry.new(:customer_name => 'SMITH JOHN') entry.customer_name.should == 'SMITH JOHN' end it "should generate formatted string" do entry = Entry.new :amount => 1599 entry.to_s!.should == "JOHN SMITH".ljust(22) + "1599".rjust(10, '0') end it "should raise exception with unfilled value" do lambda{ Entry.new.to_s! }.should raise_error(ACH::Record::EmptyField) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ach_builder-0.0.2 | spec/record_spec.rb |
ach_builder-0.0.1.1 | spec/record_spec.rb |