Simplify investment creation in specs

Now factories define default headings for investments, so there's no
need to create a group and a heading to create an investment.

Likewise, in order to create a heading it isn't necessary to specify a
group anymore; specifying the budget is enough.

It's possible that there are more similar cases we haven't simplified
yet; I'm only addressing the obvious ones.
This commit is contained in:
Javi Martín
2019-09-21 01:53:22 +02:00
parent 1faa659c89
commit c8c8a7bc30
17 changed files with 33 additions and 73 deletions

View File

@@ -35,10 +35,7 @@ describe "Admin budget investments" do
end
context "Load" do
let(:group) { create(:budget_group, budget: budget) }
let(:heading) { create(:budget_heading, group: group) }
let!(:investment) { create(:budget_investment, heading: heading) }
let!(:investment) { create(:budget_investment, budget: budget) }
before { budget.update(slug: "budget_slug") }
@@ -1596,8 +1593,7 @@ describe "Admin budget investments" do
let(:valuator) { create(:valuator) }
let(:admin) { create(:administrator) }
let(:group) { create(:budget_group, budget: budget) }
let(:heading) { create(:budget_heading, group: group) }
let(:heading) { create(:budget_heading, budget: budget) }
let(:investment1) { create(:budget_investment, heading: heading) }
let(:investment2) { create(:budget_investment, heading: heading) }