adds Budget::Group model to group headings

many refactors through budget related models
This commit is contained in:
Juanjo Bazán
2016-06-09 18:00:06 +02:00
parent 3fae269c40
commit b5a6828e41
18 changed files with 156 additions and 110 deletions

View File

@@ -33,14 +33,11 @@ describe Budget do
end
describe "heading_price" do
let(:budget) { create(:budget, price: 1000) }
it "returns the budget price if no heading is provided" do
expect(budget.heading_price(nil)).to eq(1000)
end
let(:budget) { create(:budget) }
let(:group) { create(:budget_group, budget: budget) }
it "returns the heading price if the heading provided is part of the budget" do
heading = create(:budget_heading, price: 100, budget: budget)
heading = create(:budget_heading, price: 100, group: group)
expect(budget.heading_price(heading)).to eq(100)
end