Do not show confirm message if user can vote in all headings
This commit is contained in:
@@ -45,7 +45,7 @@ class Budgets::Investments::VotesComponent < ApplicationComponent
|
|||||||
def display_support_alert?
|
def display_support_alert?
|
||||||
current_user &&
|
current_user &&
|
||||||
!current_user.voted_in_group?(investment.group) &&
|
!current_user.voted_in_group?(investment.group) &&
|
||||||
investment.group.headings.count > 1
|
investment.group.headings.count > investment.group.max_votable_headings
|
||||||
end
|
end
|
||||||
|
|
||||||
def confirm_vote_message
|
def confirm_vote_message
|
||||||
|
|||||||
@@ -198,6 +198,16 @@ describe "Votes" do
|
|||||||
|
|
||||||
expect(page.driver.send(:find_modal).text).to match "You can only support investments in 2 districts."
|
expect(page.driver.send(:find_modal).text).to match "You can only support investments in 2 districts."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scenario "Do not show confirm message if user can vote in all headings" do
|
||||||
|
group.update!(max_votable_headings: group.headings.count)
|
||||||
|
|
||||||
|
visit budget_investments_path(budget, heading_id: new_york.id)
|
||||||
|
click_button "Support"
|
||||||
|
|
||||||
|
expect(page).to have_content "1 support"
|
||||||
|
expect(page).to have_content "You have already supported this investment project. Share it!"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user