Add payment structure

This commit is contained in:
2015-04-29 10:21:12 +02:00
parent 9d5e3f684c
commit e4e7198af5
8 changed files with 59 additions and 5 deletions
+21
View File
@@ -0,0 +1,21 @@
require 'spec_helper'
describe ListPayment do
it "does completes a list if amount is equal to the list amount" do
list = create :list, price: 10.22
create :list_payment, amount: 10.22, list: list
list.should be_closed
end
it "does completes a list if amount is greater than the list amount" do
list = create :list, price: 10.22
create :list_payment, amount: 12, list: list
list.should be_closed
end
it "does completes a list if amount is less than the list amount, but total payments on list bigger" do
list = create :list, price: 10.22
create :list_payment, amount: 7, list: list
list.should be_active
create :list_payment, amount: 7, list: list
list.should be_closed
end
end