Skip to content

Commit cf32639

Browse files
committed
preserve transaction kind
1 parent 4ff8adb commit cf32639

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

app/models/deb/transaction.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def rollback!
2424
tran.debit_items.each { |di| credit(di.account, di.amount) }
2525
tran.credit_items.each { |ci| debit(ci.account, ci.amount) }
2626
reference(tran)
27+
kind(tran.kind)
2728
description("Rollback of #{tran.description}")
2829
end
2930
end

spec/models/transaction_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ module Deb
8484
credit @revenue, 5
8585
credit @liability, 7
8686
description "foobar"
87+
kind "baz"
8788
end
8889
end
8990

@@ -144,6 +145,10 @@ module Deb
144145
@rollback.description.should == "Rollback of foobar"
145146
end
146147

148+
it "should preserve transaction kind" do
149+
@rollback.kind.should == @transaction.kind
150+
end
151+
147152
it "should set debit accounts" do
148153
@rollback.debit_items.collect(&:account).should == [@revenue, @liability]
149154
end

0 commit comments

Comments
 (0)