spec/lib/aba/batch_spec.rb in aba-1.0.1 vs spec/lib/aba/batch_spec.rb in aba-1.0.2
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
# encoding: UTF-8
require "spec_helper"
describe Aba::Batch do
@@ -125,9 +127,35 @@
[{amount: 1, transaction_code: 50}, {amount: 'abc', transaction_code: 13}, {amount: 'def', transaction_code: 50}]
end
it "reports the errors" do
expect(batch.errors).to eq(:entries => { 1 => ["amount must be a number"], 2 => ["amount must be a number"] })
+ end
+ end
+
+ context "with an invalid credit total (exceeding 10 characters)" do
+ let(:transactions_attributes) do
+ [
+ {amount: 9999999999, transaction_code: 50},
+ {amount: 9999999999, transaction_code: 50},
+ ]
+ end
+
+ it "reports the errors" do
+ expect(batch.errors).to include(aba: ["credit_total_amount length must not exceed 10 characters"])
+ end
+ end
+
+ context "with an invalid debit total amount (exceeding 10 characters)" do
+ let(:transactions_attributes) do
+ [
+ {amount: 9999999999, transaction_code: 13},
+ {amount: 9999999999, transaction_code: 13},
+ ]
+ end
+
+ it "reports the errors" do
+ expect(batch.errors).to include(aba: ["debit_total_amount length must not exceed 10 characters"])
end
end
end
end