aba 0.0.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,40 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Aba do
4
- subject(:aba) do
5
- aba = Aba.new(bsb: "123-345", financial_institution: "WPC", user_name: "John Doe",
6
- user_id: "466364", description: "Payroll", process_at: Time.new(2014, 12, 01, 10, 22, 0))
7
-
8
- [30, -20].each do |amount|
9
- aba.transactions << Aba::Transaction.new(
10
- :bsb => "342-342",
11
- :account_number => "3244654",
12
- :amount => amount,
13
- :account_name => "John Doe",
14
- :payment_id => "P2345543",
15
- :transaction_code => 53,
16
- :lodgement_reference => "R435564",
17
- :trace_bsb => "453-543",
18
- :trace_account_number => "45656733",
19
- :name_of_remitter => "Remitter"
20
- )
21
- end
22
-
23
- aba
24
- end
25
-
26
- describe "#to_s" do
27
- it "should contain a descriptive record" do
28
- expect(subject.to_s).to include("0123-345 01WPC John Doe 466364Payroll 0112141022 \r\n")
29
- end
30
-
31
- it "should contain transactions records" do
32
- expect(subject.to_s).to include("1342-342 3244654 530000000030John Doe R435564 453-543 45656733Remitter 00000000\r\n")
33
- expect(subject.to_s).to include("1342-342 3244654 530000000020John Doe R435564 453-543 45656733Remitter 00000000\r\n")
34
- end
35
-
36
- it "should contain a batch control record" do
37
- expect(subject.to_s).to include("7999-999 000000001000000000300000000020 000002 ")
38
- end
39
- end
40
- end
@@ -1,47 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe Aba::Validations do
4
- let(:clean_room) do
5
- Class.new(Object) do
6
- include Aba::Validations
7
- end
8
- end
9
-
10
- subject(:test_instance) { clean_room.new }
11
-
12
- describe "#valid?" do
13
- it "should validate presence of attrs" do
14
- clean_room.instance_eval do
15
- attr_accessor :attr1
16
- validates_presence_of :attr1
17
- end
18
-
19
- expect(subject.valid?).to eq false
20
- expect(subject.errors).to eq ["attr1 is empty"]
21
- end
22
-
23
- it "should validate bsb format" do
24
- clean_room.instance_eval do
25
- attr_accessor :attr1
26
- validates_bsb :attr1
27
- end
28
-
29
- subject.attr1 = "234456"
30
-
31
- expect(subject.valid?).to eq false
32
- expect(subject.errors).to eq ["attr1 format is incorrect"]
33
- end
34
-
35
- it "should validate length" do
36
- clean_room.instance_eval do
37
- attr_accessor :attr1
38
- validates_max_length :attr1, 5
39
- end
40
-
41
- subject.attr1 = "234456642"
42
-
43
- expect(subject.valid?).to eq false
44
- expect(subject.errors).to eq ["attr1 length must not exceed 5 characters"]
45
- end
46
- end
47
- end