Directly assign valuators in specs

Creating a record and then assigning an association makes the code even
harder to follow.
This commit is contained in:
Javi Martín
2019-09-21 16:57:38 +02:00
parent 3ecab8af13
commit a9159e0ec8
7 changed files with 43 additions and 89 deletions

View File

@@ -20,13 +20,10 @@ describe Valuator do
it "returns investments assigned to a valuator" do
valuator = create(:valuator)
investment1 = create(:budget_investment)
investment2 = create(:budget_investment)
investment1 = create(:budget_investment, valuators: [valuator])
investment2 = create(:budget_investment, valuators: [valuator])
investment3 = create(:budget_investment)
investment1.valuators << valuator
investment2.valuators << valuator
assigned_investment_ids = valuator.assigned_investment_ids
expect(assigned_investment_ids).to match_array [investment1.id, investment2.id]