Deal gracefully with recommendations of hidden proposals

We were seeing an exceptions in the home page when displaying
recommendations. This was due to trying to load tags of hidden proposals

With this commit we are skipping proposals that that have been hidden,
which will hopefully solve this exception
This commit is contained in:
rgarcia
2018-05-10 15:38:46 +02:00
committed by decabeza
parent f7f1f12b82
commit f670019325
2 changed files with 11 additions and 1 deletions

View File

@@ -667,6 +667,15 @@ describe User do
expect(user.interests).to eq ["Sport"]
end
it "deals gracefully with hidden proposals" do
proposal = create(:proposal, tag_list: "Sport")
create(:follow, followable: proposal, user: user)
proposal.hide
expect(user.interests).to eq []
end
it "discards followed objects duplicated tags" do
proposal1 = create(:proposal, tag_list: "Sport")
proposal2 = create(:proposal, tag_list: "Sport")