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
