<%= render "shared/social_share",
diff --git a/app/components/proposals/votes_component.html.erb b/app/components/proposals/votes_component.html.erb
index 1d1ea009d..7e87fe6ec 100644
--- a/app/components/proposals/votes_component.html.erb
+++ b/app/components/proposals/votes_component.html.erb
@@ -12,7 +12,6 @@
title: t("proposals.proposal.support_title"),
method: "post",
remote: true,
- disabled: !can_vote?,
"aria-label": support_aria_label do %>
<%= t("proposals.proposal.support") %>
<% end %>
diff --git a/app/components/shared/in_favor_against_component.html.erb b/app/components/shared/in_favor_against_component.html.erb
index 3b52938bc..5d9739052 100644
--- a/app/components/shared/in_favor_against_component.html.erb
+++ b/app/components/shared/in_favor_against_component.html.erb
@@ -5,8 +5,7 @@
title: t("votes.agree"),
"aria-label": agree_aria_label,
method: "post",
- remote: true,
- disabled: !current_user do %>
+ remote: true do %>
@@ -18,8 +17,7 @@
title: t("votes.disagree"),
"aria-label": disagree_aria_label,
method: "post",
- remote: true,
- disabled: !current_user do %>
+ remote: true do %>
diff --git a/app/components/shared/participation_not_allowed_component.html.erb b/app/components/shared/participation_not_allowed_component.html.erb
index 6a7459e64..6189b17e9 100644
--- a/app/components/shared/participation_not_allowed_component.html.erb
+++ b/app/components/shared/participation_not_allowed_component.html.erb
@@ -1,5 +1,3 @@
-
-
- <%= body %>
-
+
+ <%= body %>
diff --git a/spec/components/budgets/investments/ballot_component_spec.rb b/spec/components/budgets/investments/ballot_component_spec.rb
index 00aee0304..797c67986 100644
--- a/spec/components/budgets/investments/ballot_component_spec.rb
+++ b/spec/components/budgets/investments/ballot_component_spec.rb
@@ -18,7 +18,7 @@ describe Budgets::Investments::BallotComponent do
render_inline component
- expect(page).to have_button "Vote", disabled: true
+ expect(page).to have_button "Vote"
expect(page).to have_content "Only verified users can vote on investments; verify your account."
end
diff --git a/spec/components/budgets/investments/votes_component_spec.rb b/spec/components/budgets/investments/votes_component_spec.rb
index b2c3dab35..17c219682 100644
--- a/spec/components/budgets/investments/votes_component_spec.rb
+++ b/spec/components/budgets/investments/votes_component_spec.rb
@@ -18,11 +18,12 @@ describe Budgets::Investments::VotesComponent do
expect(page).to have_button "Support Renovate sidewalks in Main Street"
end
- it "disables the button to support the investment to unidentified users" do
+ it "renders the support button and a reminder to sign in to unidentified users" do
render_inline component
expect(page).to have_button count: 1, disabled: :all
- expect(page).to have_button "Support", disabled: true
+ expect(page).to have_button "Support"
+ expect(page).to have_content "You must sign in or sign up to continue."
end
describe "button to remove support" do
diff --git a/spec/components/debates/votes_component_spec.rb b/spec/components/debates/votes_component_spec.rb
index f21ef797d..6d1c973aa 100644
--- a/spec/components/debates/votes_component_spec.rb
+++ b/spec/components/debates/votes_component_spec.rb
@@ -5,11 +5,11 @@ describe Debates::VotesComponent do
let(:component) { Debates::VotesComponent.new(debate) }
describe "Agree and disagree buttons" do
- it "is disabled to anonymous users" do
+ it "is shown to anonymous users alongside a reminder to sign in" do
render_inline component
- expect(page).to have_button "I agree", disabled: true
- expect(page).to have_button "I disagree", disabled: true
+ expect(page).to have_button "I agree"
+ expect(page).to have_button "I disagree"
expect(page).to have_content "You must sign in or sign up to continue."
end
diff --git a/spec/components/legislation/proposals/votes_component_spec.rb b/spec/components/legislation/proposals/votes_component_spec.rb
index b832fc51f..81649bf9f 100644
--- a/spec/components/legislation/proposals/votes_component_spec.rb
+++ b/spec/components/legislation/proposals/votes_component_spec.rb
@@ -18,11 +18,11 @@ describe Legislation::Proposals::VotesComponent do
expect(page).not_to have_button "I disagree", disabled: :all
end
- it "is disabled to anonymous users" do
+ it "is shown to anonymous users alongside a reminder to sign in" do
render_inline component
- expect(page).to have_button "I agree", disabled: true
- expect(page).to have_button "I disagree", disabled: true
+ expect(page).to have_button "I agree"
+ expect(page).to have_button "I disagree"
expect(page).to have_content "You must sign in or sign up to continue."
end
diff --git a/spec/components/proposals/votes_component_spec.rb b/spec/components/proposals/votes_component_spec.rb
index ef686e625..531b05d9d 100644
--- a/spec/components/proposals/votes_component_spec.rb
+++ b/spec/components/proposals/votes_component_spec.rb
@@ -5,12 +5,12 @@ describe Proposals::VotesComponent do
let(:component) { Proposals::VotesComponent.new(proposal) }
describe "support proposal button" do
- it "is disabled to unverified users" do
+ it "is shown to unverified users" do
sign_in(create(:user))
render_inline component
- expect(page).to have_button "Support", disabled: true
+ expect(page).to have_button "Support"
end
it "is shown to verified users" do
@@ -38,8 +38,8 @@ describe Proposals::VotesComponent do
it "asks anonymous users to sign in or sign up" do
render_inline component
- expect(page).to have_link "sign in", visible: :hidden
- expect(page).to have_link "sign up", visible: :hidden
+ expect(page).to have_link "sign in"
+ expect(page).to have_link "sign up"
end
it "says voting is not allowed to organizations" do
@@ -58,7 +58,7 @@ describe Proposals::VotesComponent do
render_inline component
expect(page).to have_content "Only verified users can vote on proposals"
- expect(page).to have_link "verify your account", visible: :hidden
+ expect(page).to have_link "verify your account"
expect(page).not_to have_link "sign in", visible: :all
expect(page).not_to have_link "sign up", visible: :all
end
diff --git a/spec/support/common_actions.rb b/spec/support/common_actions.rb
index e59219ee8..cc7144328 100644
--- a/spec/support/common_actions.rb
+++ b/spec/support/common_actions.rb
@@ -13,7 +13,6 @@ module CommonActions
include Translations
include Users
include Verifications
- include Votes
def app_host
"#{Capybara.app_host}:#{Capybara::Server.ports.values.last}"
diff --git a/spec/support/common_actions/budgets.rb b/spec/support/common_actions/budgets.rb
index f36e143c3..9f0eadc6b 100644
--- a/spec/support/common_actions/budgets.rb
+++ b/spec/support/common_actions/budgets.rb
@@ -4,11 +4,6 @@ module Budgets
expect(page).to have_button "Vote", disabled: true, obscured: true
end
- def hover_over_ballot
- scroll_to find("div.ballot"), align: :bottom
- first("div.ballot p").hover
- end
-
def add_to_ballot(investment_title)
within(".budget-investment", text: investment_title) do
click_button "Vote"
diff --git a/spec/support/common_actions/votes.rb b/spec/support/common_actions/votes.rb
deleted file mode 100644
index e6f4ff061..000000000
--- a/spec/support/common_actions/votes.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-module Votes
- def expect_message_you_need_to_sign_in
- expect(page).to have_content "You must sign in or sign up to continue"
- expect(page).to have_selector(".in-favor", obscured: true)
- end
-
- def expect_message_to_many_anonymous_votes
- expect(page).to have_content "Too many anonymous votes to admit vote"
- expect(page).to have_button "I agree", obscured: true
- end
-
- def expect_message_only_verified_can_vote_proposals
- expect(page).to have_content "Only verified users can vote on proposals"
- expect(page).to have_selector(".in-favor", obscured: true)
- end
-end
diff --git a/spec/system/budget_polls/voter_spec.rb b/spec/system/budget_polls/voter_spec.rb
index 66b457c27..1662d9dbf 100644
--- a/spec/system/budget_polls/voter_spec.rb
+++ b/spec/system/budget_polls/voter_spec.rb
@@ -81,11 +81,12 @@ describe "BudgetPolls", :with_frozen_time do
login_as(user)
visit budget_investment_path(budget, investment)
- first("div.ballot p").hover
within("#budget_investment_#{investment.id}") do
+ click_button "Vote"
+
expect(page).to have_content "You have already participated offline"
- expect(page).to have_button "Vote", disabled: true, obscured: true
+ expect(page).not_to have_button "Vote", disabled: :all
end
end
end
@@ -111,7 +112,6 @@ describe "BudgetPolls", :with_frozen_time do
end
visit budget_investment_path(budget, investment)
- find("div.ballot").hover
within("#budget_investment_#{investment.id}") do
expect(page).to have_content "Remove vote"
diff --git a/spec/system/budgets/ballots_spec.rb b/spec/system/budgets/ballots_spec.rb
index 233137729..f824ef956 100644
--- a/spec/system/budgets/ballots_spec.rb
+++ b/spec/system/budgets/ballots_spec.rb
@@ -446,10 +446,10 @@ describe "Ballots" do
visit budget_investments_path(budget, heading_id: new_york.id)
within("#budget_investment_#{investment.id}") do
- hover_over_ballot
+ click_button "Vote"
expect(page).to have_content "You must sign in or sign up to continue."
- expect(page).to have_button "Vote", disabled: true, obscured: true
+ expect(page).not_to have_button "Vote", disabled: :all
end
end
@@ -461,10 +461,10 @@ describe "Ballots" do
visit budget_investments_path(budget, heading_id: new_york.id)
within("#budget_investment_#{investment.id}") do
- hover_over_ballot
+ click_button "Vote"
expect(page).to have_content "Only verified users can vote on investments"
- expect(page).to have_button "Vote", disabled: true, obscured: true
+ expect(page).not_to have_button "Vote", disabled: :all
end
end
@@ -476,9 +476,10 @@ describe "Ballots" do
visit budget_investments_path(budget, heading_id: new_york.id)
within("#budget_investment_#{investment.id}") do
- hover_over_ballot
+ click_button "Vote"
- expect_message_organizations_cannot_vote
+ expect(page).to have_content "Organization"
+ expect(page).not_to have_button "Vote", disabled: :all
end
end
@@ -512,10 +513,10 @@ describe "Ballots" do
visit budget_investments_path(budget, heading: new_york)
within("#budget_investment_#{bi2.id}") do
- hover_over_ballot
+ click_button "Vote"
expect(page).to have_content("already voted a different heading")
- expect(page).to have_button "Vote", disabled: true, obscured: true
+ expect(page).not_to have_button "Vote", disabled: :all
end
end
@@ -528,10 +529,10 @@ describe "Ballots" do
visit budget_investments_path(budget, heading_id: california.id)
within("#budget_investment_#{bi2.id}") do
- hover_over_ballot
+ click_button "Vote"
expect(page).to have_content("You have already assigned the available budget")
- expect(page).to have_button "Vote", disabled: true, obscured: true
+ expect(page).not_to have_button "Vote", disabled: :all
end
end
@@ -542,20 +543,13 @@ describe "Ballots" do
login_as(user)
visit budget_investments_path(budget, heading_id: california.id)
- within(".budget-investment", text: "Build replicants") do
- hover_over_ballot
-
- expect(page).not_to have_content("You have already assigned the available budget")
- expect(page).to have_button "Vote", obscured: false
- end
-
add_to_ballot("Build replicants")
within(".budget-investment", text: "Build terminators") do
- hover_over_ballot
+ click_button "Vote"
expect(page).to have_content("You have already assigned the available budget")
- expect(page).to have_button "Vote", disabled: true, obscured: true
+ expect(page).not_to have_button "Vote", disabled: :all
end
end
@@ -568,10 +562,11 @@ describe "Ballots" do
visit budget_investments_path(budget, heading_id: california.id)
within("#budget_investment_#{bi2.id}") do
- hover_over_ballot
+ click_button "Vote"
expect(page).to have_content("You have already assigned the available budget")
- expect(page).to have_button "Vote", disabled: true, obscured: true
+ expect(page).not_to have_button "Vote", disabled: :all
+ expect(page).not_to have_button "Remove vote"
end
within("#budget_investment_#{bi1.id}") do
@@ -580,10 +575,10 @@ describe "Ballots" do
end
within("#budget_investment_#{bi2.id}") do
- hover_over_ballot
+ click_button "Vote"
expect(page).not_to have_content("You have already assigned the available budget")
- expect(page).to have_button "Vote", obscured: false
+ expect(page).to have_button "Remove vote"
end
end
@@ -596,10 +591,10 @@ describe "Ballots" do
visit budget_investments_path(budget, heading_id: california.id)
within("#budget_investment_#{bi2.id}") do
- hover_over_ballot
+ click_button "Vote"
expect(page).to have_content("You have already assigned the available budget")
- expect(page).to have_button "Vote", disabled: true, obscured: true
+ expect(page).not_to have_button "Vote", disabled: :all
end
within("#budget_investment_#{bi1.id}_sidebar") do
@@ -609,10 +604,10 @@ describe "Ballots" do
expect(page).not_to have_css "#budget_investment_#{bi1.id}_sidebar"
within("#budget_investment_#{bi2.id}") do
- hover_over_ballot
+ click_button "Vote"
expect(page).not_to have_content("You have already assigned the available budget")
- expect(page).to have_button "Vote", obscured: false
+ expect(page).to have_button "Remove vote"
end
end
@@ -641,13 +636,13 @@ describe "Ballots" do
within("#budget_investment_#{investment1.id}") do
click_button "Vote"
+ expect(page).to have_css ".participation-not-allowed", visible: :hidden
expect(page).not_to have_content "Remove"
- expect(page).not_to have_selector(".participation-not-allowed")
- hover_over_ballot
+ click_button "Vote"
- expect(page).to have_selector(".participation-not-allowed")
- expect(page).to have_button "Vote", disabled: true, obscured: true
+ expect(page).to have_css ".participation-not-allowed"
+ expect(page).not_to have_button "Vote", disabled: :all
end
end
diff --git a/spec/system/budgets/votes_spec.rb b/spec/system/budgets/votes_spec.rb
index 8c38b5d23..15c5d4caa 100644
--- a/spec/system/budgets/votes_spec.rb
+++ b/spec/system/budgets/votes_spec.rb
@@ -229,9 +229,8 @@ describe "Votes" do
expect(page).to have_content("YOU CAN STILL CAST 1 VOTE")
within(".budget-investment", text: investment2.title) do
- find("div.ballot").hover
-
- expect(page).not_to have_content("You have already assigned the available budget")
+ expect(page).not_to have_css ".participation-not-allowed", visible: :all
+ expect(page).not_to have_content "You have already assigned the available budget"
end
visit budget_ballot_path(budget)
diff --git a/spec/system/votes_spec.rb b/spec/system/votes_spec.rb
index dc8672a01..0cf6488a0 100644
--- a/spec/system/votes_spec.rb
+++ b/spec/system/votes_spec.rb
@@ -252,8 +252,11 @@ describe "Votes" do
visit debates_path
within("#debate_#{debate.id}") do
- find("div.votes").hover
- expect_message_you_need_to_sign_in
+ click_button "I agree"
+
+ expect(page).to have_content "You must sign in or sign up to continue"
+ expect(page).to have_button "I agree", disabled: true
+ expect(page).to have_button "I disagree", disabled: true
end
end
@@ -262,14 +265,18 @@ describe "Votes" do
visit proposals_path
within("#proposal_#{proposal.id}") do
- find("div.supports").hover
- expect_message_you_need_to_sign_in
+ click_button "Support"
+
+ expect(page).to have_content "You must sign in or sign up to continue"
+ expect(page).not_to have_button "Support", disabled: :all
end
visit proposal_path(proposal)
within("#proposal_#{proposal.id}") do
- find("div.supports").hover
- expect_message_you_need_to_sign_in
+ click_button "Support"
+
+ expect(page).to have_content "You must sign in or sign up to continue"
+ expect(page).not_to have_button "Support", disabled: :all
end
end
@@ -310,14 +317,18 @@ describe "Votes" do
visit debates_path
within("#debate_#{debate.id}") do
- find("div.votes").hover
- expect_message_to_many_anonymous_votes
+ click_button "I agree"
+
+ expect(page).to have_content "Too many anonymous votes to admit vote"
+ expect(page).to have_button "I agree", disabled: true
end
visit debate_path(debate)
within("#debate_#{debate.id}") do
- find("div.votes").hover
- expect_message_to_many_anonymous_votes
+ click_button "I agree"
+
+ expect(page).to have_content "Too many anonymous votes to admit vote"
+ expect(page).to have_button "I agree", disabled: true
end
end
@@ -329,14 +340,18 @@ describe "Votes" do
visit proposals_path
within("#proposal_#{proposal.id}") do
- find("div.supports").hover
- expect_message_only_verified_can_vote_proposals
+ click_button "Support"
+
+ expect(page).to have_content "Only verified users can vote on proposals"
+ expect(page).not_to have_button "Support", disabled: :all
end
visit proposal_path(proposal)
within("#proposal_#{proposal.id}") do
- find("div.supports").hover
- expect_message_only_verified_can_vote_proposals
+ click_button "Support"
+
+ expect(page).to have_content "Only verified users can vote on proposals"
+ expect(page).not_to have_button "Support", disabled: :all
end
end
end