spec/batch_spec.rb in ach_builder-0.0.1.1 vs spec/batch_spec.rb in ach_builder-0.0.2

- old
+ new

@@ -1,10 +1,11 @@ require 'spec_helper' describe ACH::Batch do before(:each) do @batch = ACH::Batch.new + @file = ACH.sample_file end it "should create entry with attributes" do entry = @batch.entry :amount => 100 entry.should be_instance_of(ACH::Entry) @@ -45,7 +46,16 @@ it "should generate 200 service_class_code for header if with debit and credit entries" do @batch.entry :amount => 100 @batch.entry :amount => 100, :transaction_code => 21 @batch.header.service_class_code.should == 200 + end + + it "should have header record with length of 94" do + @file.batch(0).header.to_s!.length.should == ACH::Constants::RECORD_SIZE + end + + it "should have control record with length of 94" do + @file.batch(0).send(:before_header) # to fill service_class_code value + @file.batch(0).control.to_s!.length.should == ACH::Constants::RECORD_SIZE end end