Allow users to remove their support on investments
Note we don't cast negative votes when users remove their support. That way we provide compatibility for institutions who have implemented real negative votes (in case there are / will be any), and we also keep the database meaningful: it's not that users downvoted something; they simply removed their upvote. Co-Authored-By: Javi Martín <javim@elretirao.net> Co-Authored-By: Julian Nicolas Herrero <microweb10@gmail.com>
This commit is contained in:
@@ -1177,6 +1177,48 @@ describe "Budget Investments" do
|
||||
expect(page).to have_content "SUPPORTS"
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Remove a support from show view" do
|
||||
investment = create(:budget_investment, budget: budget)
|
||||
|
||||
login_as(author)
|
||||
visit budget_investment_path(budget, investment)
|
||||
|
||||
within("aside") do
|
||||
expect(page).to have_content "No supports"
|
||||
|
||||
click_button "Support"
|
||||
|
||||
expect(page).to have_content "1 support"
|
||||
expect(page).to have_content "You have already supported this investment project."
|
||||
|
||||
click_button "Remove your support"
|
||||
|
||||
expect(page).to have_content "No supports"
|
||||
expect(page).to have_button "Support"
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Remove a support from index view" do
|
||||
investment = create(:budget_investment, budget: budget)
|
||||
|
||||
login_as(author)
|
||||
visit budget_investments_path(budget)
|
||||
|
||||
within("#budget_investment_#{investment.id}") do
|
||||
expect(page).to have_content "No supports"
|
||||
|
||||
click_button "Support"
|
||||
|
||||
expect(page).to have_content "1 support"
|
||||
expect(page).to have_content "You have already supported this investment project."
|
||||
|
||||
click_button "Remove your support"
|
||||
|
||||
expect(page).to have_content "No supports"
|
||||
expect(page).to have_button "Support"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "Evaluating Phase" do
|
||||
|
||||
Reference in New Issue
Block a user