From 49b47dd5f4b1e8e16c17b508a0bddf00dae66c6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sat, 28 Sep 2019 01:01:41 +0200 Subject: [PATCH] Remove useless valuation comment creation The valuation comment doesn't show up in the comment show action because it's not a child of the parent comment. With a regular comment, the test passes as well. However, if we make the valuation comment a child of the parent comment, it shows up both in the index and show actions. That's because the method `root_descendants` in the `CommentTree` class doesn't filter valuation comments. I'm not sure whether it's a bug or the intended behaviour. --- spec/features/comments/budget_investments_spec.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/spec/features/comments/budget_investments_spec.rb b/spec/features/comments/budget_investments_spec.rb index aabeba2ed..451c66d9f 100644 --- a/spec/features/comments/budget_investments_spec.rb +++ b/spec/features/comments/budget_investments_spec.rb @@ -27,7 +27,6 @@ describe "Commenting Budget::Investments" do parent_comment = create(:comment, commentable: investment) first_child = create(:comment, commentable: investment, parent: parent_comment) second_child = create(:comment, commentable: investment, parent: parent_comment) - valuation_comment = create(:comment, :valuation, commentable: investment, subject: "Not viable") visit comment_path(parent_comment) @@ -35,7 +34,6 @@ describe "Commenting Budget::Investments" do expect(page).to have_content parent_comment.body expect(page).to have_content first_child.body expect(page).to have_content second_child.body - expect(page).not_to have_content("Not viable") expect(page).to have_link "Go back to #{investment.title}", href: budget_investment_path(investment.budget, investment)