Merge pull request #3290 from consul/budget-heading-alert
[Backport] Include heading names in "headings limit reached" alert
This commit is contained in:
@@ -257,7 +257,7 @@ class Budget
|
|||||||
end
|
end
|
||||||
|
|
||||||
def can_vote_in_another_heading?(user)
|
def can_vote_in_another_heading?(user)
|
||||||
headings_voted_by_user(user).count < group.max_votable_headings
|
user.headings_voted_within_group(group).count < group.max_votable_headings
|
||||||
end
|
end
|
||||||
|
|
||||||
def headings_voted_by_user(user)
|
def headings_voted_by_user(user)
|
||||||
@@ -265,7 +265,7 @@ class Budget
|
|||||||
end
|
end
|
||||||
|
|
||||||
def voted_in?(heading, user)
|
def voted_in?(heading, user)
|
||||||
headings_voted_by_user(user).include?(heading.id)
|
user.headings_voted_within_group(group).where(id: heading.id).exists?
|
||||||
end
|
end
|
||||||
|
|
||||||
def ballotable_by?(user)
|
def ballotable_by?(user)
|
||||||
|
|||||||
@@ -127,6 +127,14 @@ class User < ActiveRecord::Base
|
|||||||
votes.for_budget_investments(Budget::Investment.where(group: group)).exists?
|
votes.for_budget_investments(Budget::Investment.where(group: group)).exists?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def headings_voted_within_group(group)
|
||||||
|
Budget::Heading.order("name").where(id: voted_investments.by_group(group).pluck(:heading_id))
|
||||||
|
end
|
||||||
|
|
||||||
|
def voted_investments
|
||||||
|
Budget::Investment.where(id: votes.for_budget_investments.pluck(:votable_id))
|
||||||
|
end
|
||||||
|
|
||||||
def administrator?
|
def administrator?
|
||||||
administrator.present?
|
administrator.present?
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -35,8 +35,9 @@
|
|||||||
count: investment.group.max_votable_headings,
|
count: investment.group.max_votable_headings,
|
||||||
verify_account: link_to(t("votes.verify_account"), verification_path),
|
verify_account: link_to(t("votes.verify_account"), verification_path),
|
||||||
signin: link_to(t("votes.signin"), new_user_session_path),
|
signin: link_to(t("votes.signin"), new_user_session_path),
|
||||||
signup: link_to(t("votes.signup"), new_user_registration_path)
|
signup: link_to(t("votes.signup"), new_user_registration_path),
|
||||||
).html_safe %>
|
supported_headings: (current_user && current_user.headings_voted_within_group(investment.group).map(&:name).to_sentence)
|
||||||
|
).html_safe %>
|
||||||
</small>
|
</small>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ ActsAsVotable::Vote.class_eval do
|
|||||||
where(votable_type: 'SpendingProposal', votable_id: spending_proposals)
|
where(votable_type: 'SpendingProposal', votable_id: spending_proposals)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.for_budget_investments(budget_investments)
|
def self.for_budget_investments(budget_investments=Budget::Investment.all)
|
||||||
where(votable_type: 'Budget::Investment', votable_id: budget_investments)
|
where(votable_type: 'Budget::Investment', votable_id: budget_investments)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -770,8 +770,8 @@ en:
|
|||||||
unfeasible: Unfeasible investment projects can not be supported
|
unfeasible: Unfeasible investment projects can not be supported
|
||||||
not_voting_allowed: Voting phase is closed
|
not_voting_allowed: Voting phase is closed
|
||||||
different_heading_assigned:
|
different_heading_assigned:
|
||||||
one: "You can only support investment projects in %{count} district"
|
one: "You can only support investment projects in %{count} district. You have already supported investments in %{supported_headings}."
|
||||||
other: "You can only support investment projects in %{count} districts"
|
other: "You can only support investment projects in %{count} districts. You have already supported investments in %{supported_headings}."
|
||||||
welcome:
|
welcome:
|
||||||
feed:
|
feed:
|
||||||
most_active:
|
most_active:
|
||||||
|
|||||||
@@ -769,8 +769,8 @@ es:
|
|||||||
unfeasible: No se pueden votar propuestas inviables.
|
unfeasible: No se pueden votar propuestas inviables.
|
||||||
not_voting_allowed: El periodo de votación está cerrado.
|
not_voting_allowed: El periodo de votación está cerrado.
|
||||||
different_heading_assigned:
|
different_heading_assigned:
|
||||||
one: "Sólo puedes apoyar proyectos de gasto de %{count} distrito"
|
one: "Sólo puedes apoyar proyectos de gasto de %{count} distrito. Ya has apoyado en %{supported_headings}."
|
||||||
other: "Sólo puedes apoyar proyectos de gasto de %{count} distritos"
|
other: "Sólo puedes apoyar proyectos de gasto de %{count} distritos. Ya has apoyado en %{supported_headings}."
|
||||||
welcome:
|
welcome:
|
||||||
feed:
|
feed:
|
||||||
most_active:
|
most_active:
|
||||||
|
|||||||
@@ -1,72 +1,70 @@
|
|||||||
require 'rails_helper'
|
require "rails_helper"
|
||||||
|
|
||||||
feature 'Votes' do
|
feature "Votes" do
|
||||||
|
|
||||||
background do
|
|
||||||
@manuela = create(:user, verified_at: Time.current)
|
|
||||||
end
|
|
||||||
|
|
||||||
feature 'Investments' do
|
|
||||||
|
|
||||||
|
feature "Investments" do
|
||||||
|
let(:manuela) { create(:user, verified_at: Time.current) }
|
||||||
let(:budget) { create(:budget, phase: "selecting") }
|
let(:budget) { create(:budget, phase: "selecting") }
|
||||||
let(:group) { create(:budget_group, budget: budget) }
|
let(:group) { create(:budget_group, budget: budget) }
|
||||||
let(:heading) { create(:budget_heading, group: group) }
|
let(:heading) { create(:budget_heading, group: group) }
|
||||||
|
|
||||||
background { login_as(@manuela) }
|
background { login_as(manuela) }
|
||||||
|
|
||||||
feature 'Index' do
|
feature "Index" do
|
||||||
|
|
||||||
scenario "Index shows user votes on proposals" do
|
scenario "Index shows user votes on proposals" do
|
||||||
investment1 = create(:budget_investment, heading: heading)
|
investment1 = create(:budget_investment, heading: heading)
|
||||||
investment2 = create(:budget_investment, heading: heading)
|
investment2 = create(:budget_investment, heading: heading)
|
||||||
investment3 = create(:budget_investment, heading: heading)
|
investment3 = create(:budget_investment, heading: heading)
|
||||||
create(:vote, voter: @manuela, votable: investment1, vote_flag: true)
|
create(:vote, voter: manuela, votable: investment1, vote_flag: true)
|
||||||
|
|
||||||
visit budget_investments_path(budget, heading_id: heading.id)
|
visit budget_investments_path(budget, heading_id: heading.id)
|
||||||
|
|
||||||
within("#budget-investments") do
|
within("#budget-investments") do
|
||||||
within("#budget_investment_#{investment1.id}_votes") do
|
within("#budget_investment_#{investment1.id}_votes") do
|
||||||
expect(page).to have_content "You have already supported this investment project. Share it!"
|
expect(page).to have_content "You have already supported this investment project. "\
|
||||||
|
"Share it!"
|
||||||
end
|
end
|
||||||
|
|
||||||
within("#budget_investment_#{investment2.id}_votes") do
|
within("#budget_investment_#{investment2.id}_votes") do
|
||||||
expect(page).not_to have_content "You have already supported this investment project. Share it!"
|
expect(page).not_to have_content "You have already supported this investment project. "\
|
||||||
|
"Share it!"
|
||||||
end
|
end
|
||||||
|
|
||||||
within("#budget_investment_#{investment3.id}_votes") do
|
within("#budget_investment_#{investment3.id}_votes") do
|
||||||
expect(page).not_to have_content "You have already supported this investment project. Share it!"
|
expect(page).not_to have_content "You have already supported this investment project. "\
|
||||||
|
"Share it!"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Create from spending proposal index', :js do
|
scenario "Create from spending proposal index", :js do
|
||||||
investment = create(:budget_investment, heading: heading, budget: budget)
|
create(:budget_investment, heading: heading, budget: budget)
|
||||||
|
|
||||||
visit budget_investments_path(budget, heading_id: heading.id)
|
visit budget_investments_path(budget, heading_id: heading.id)
|
||||||
|
|
||||||
within('.supports') do
|
within(".supports") do
|
||||||
find(".in-favor a").click
|
find(".in-favor a").click
|
||||||
|
|
||||||
expect(page).to have_content "1 support"
|
expect(page).to have_content "1 support"
|
||||||
expect(page).to have_content "You have already supported this investment project. Share it!"
|
expect(page).to have_content "You have already supported this investment project. "\
|
||||||
|
"Share it!"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
feature 'Single spending proposal' do
|
feature "Single spending proposal" do
|
||||||
background do
|
let(:investment) { create(:budget_investment, budget: budget, heading: heading)}
|
||||||
@investment = create(:budget_investment, budget: budget, heading: heading)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'Show no votes' do
|
scenario "Show no votes" do
|
||||||
visit budget_investment_path(budget, @investment)
|
visit budget_investment_path(budget, investment)
|
||||||
expect(page).to have_content "No supports"
|
expect(page).to have_content "No supports"
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Trying to vote multiple times', :js do
|
scenario "Trying to vote multiple times", :js do
|
||||||
visit budget_investment_path(budget, @investment)
|
visit budget_investment_path(budget, investment)
|
||||||
|
|
||||||
within('.supports') do
|
within(".supports") do
|
||||||
find(".in-favor a").click
|
find(".in-favor a").click
|
||||||
expect(page).to have_content "1 support"
|
expect(page).to have_content "1 support"
|
||||||
|
|
||||||
@@ -74,20 +72,24 @@ feature 'Votes' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Create from proposal show', :js do
|
scenario "Create from proposal show", :js do
|
||||||
visit budget_investment_path(budget, @investment)
|
visit budget_investment_path(budget, investment)
|
||||||
|
|
||||||
within('.supports') do
|
within(".supports") do
|
||||||
find(".in-favor a").click
|
find(".in-favor a").click
|
||||||
|
|
||||||
expect(page).to have_content "1 support"
|
expect(page).to have_content "1 support"
|
||||||
expect(page).to have_content "You have already supported this investment project. Share it!"
|
expect(page).to have_content "You have already supported this investment project. "\
|
||||||
|
"Share it!"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Disable voting on spending proposals', :js do
|
scenario "Disable voting on spending proposals", :js do
|
||||||
login_as(@manuela)
|
manuela = create(:user, verified_at: Time.current)
|
||||||
|
|
||||||
|
login_as(manuela)
|
||||||
|
|
||||||
budget.update(phase: "reviewing")
|
budget.update(phase: "reviewing")
|
||||||
investment = create(:budget_investment, budget: budget, heading: heading)
|
investment = create(:budget_investment, budget: budget, heading: heading)
|
||||||
|
|
||||||
@@ -122,53 +124,71 @@ feature 'Votes' do
|
|||||||
visit budget_investments_path(budget, heading_id: new_york.id)
|
visit budget_investments_path(budget, heading_id: new_york.id)
|
||||||
|
|
||||||
within("#budget_investment_#{new_york_investment.id}") do
|
within("#budget_investment_#{new_york_investment.id}") do
|
||||||
accept_confirm { find('.in-favor a').click }
|
accept_confirm { find(".in-favor a").click }
|
||||||
|
|
||||||
expect(page).to have_content "1 support"
|
expect(page).to have_content "1 support"
|
||||||
expect(page).to have_content "You have already supported this investment project. Share it!"
|
expect(page).to have_content "You have already supported this investment project. "\
|
||||||
|
"Share it!"
|
||||||
end
|
end
|
||||||
|
|
||||||
visit budget_investments_path(budget, heading_id: san_francisco.id)
|
visit budget_investments_path(budget, heading_id: san_francisco.id)
|
||||||
|
|
||||||
within("#budget_investment_#{san_francisco_investment.id}") do
|
within("#budget_investment_#{san_francisco_investment.id}") do
|
||||||
find('.in-favor a').click
|
find(".in-favor a").click
|
||||||
|
|
||||||
expect(page).to have_content "1 support"
|
expect(page).to have_content "1 support"
|
||||||
expect(page).to have_content "You have already supported this investment project. Share it!"
|
expect(page).to have_content "You have already supported this investment project. "\
|
||||||
|
"Share it!"
|
||||||
end
|
end
|
||||||
|
|
||||||
visit budget_investments_path(budget, heading_id: third_heading.id)
|
visit budget_investments_path(budget, heading_id: third_heading.id)
|
||||||
|
|
||||||
within("#budget_investment_#{third_heading_investment.id}") do
|
within("#budget_investment_#{third_heading_investment.id}") do
|
||||||
find('.in-favor a').click
|
find(".in-favor a").click
|
||||||
|
|
||||||
expect(page).to have_content "You can only support investment projects in 2 districts"
|
expect(page).to have_content "You can only support investment projects in 2 districts. "\
|
||||||
|
"You have already supported investments in"
|
||||||
|
|
||||||
|
participation = find(".participation-not-allowed")
|
||||||
|
headings = participation.text
|
||||||
|
.match(/You have already supported investments in (.+) and (.+)\./)&.captures
|
||||||
|
|
||||||
|
expect(headings).to match_array [new_york.name, san_francisco.name]
|
||||||
|
|
||||||
expect(page).not_to have_content "1 support"
|
expect(page).not_to have_content "1 support"
|
||||||
expect(page).not_to have_content "You have already supported this investment project. Share it!"
|
expect(page).not_to have_content "You have already supported this investment project. "\
|
||||||
|
"Share it!"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "From show", :js do
|
scenario "From show", :js do
|
||||||
visit budget_investment_path(budget, new_york_investment)
|
visit budget_investment_path(budget, new_york_investment)
|
||||||
|
|
||||||
accept_confirm { find('.in-favor a').click }
|
accept_confirm { find(".in-favor a").click }
|
||||||
expect(page).to have_content "1 support"
|
expect(page).to have_content "1 support"
|
||||||
expect(page).to have_content "You have already supported this investment project. Share it!"
|
expect(page).to have_content "You have already supported this investment project. Share it!"
|
||||||
|
|
||||||
visit budget_investment_path(budget, san_francisco_investment)
|
visit budget_investment_path(budget, san_francisco_investment)
|
||||||
|
|
||||||
find('.in-favor a').click
|
find(".in-favor a").click
|
||||||
expect(page).to have_content "1 support"
|
expect(page).to have_content "1 support"
|
||||||
expect(page).to have_content "You have already supported this investment project. Share it!"
|
expect(page).to have_content "You have already supported this investment project. Share it!"
|
||||||
|
|
||||||
visit budget_investment_path(budget, third_heading_investment)
|
visit budget_investment_path(budget, third_heading_investment)
|
||||||
|
|
||||||
find('.in-favor a').click
|
find(".in-favor a").click
|
||||||
expect(page).to have_content "You can only support investment projects in 2 districts"
|
expect(page).to have_content "You can only support investment projects in 2 districts. "\
|
||||||
|
"You have already supported investments in"
|
||||||
|
|
||||||
|
participation = find(".participation-not-allowed")
|
||||||
|
headings = participation.text
|
||||||
|
.match(/You have already supported investments in (.+) and (.+)\./)&.captures
|
||||||
|
|
||||||
|
expect(headings).to match_array [new_york.name, san_francisco.name]
|
||||||
|
|
||||||
expect(page).not_to have_content "1 support"
|
expect(page).not_to have_content "1 support"
|
||||||
expect(page).not_to have_content "You have already supported this investment project. Share it!"
|
expect(page).not_to have_content "You have already supported this investment project. "\
|
||||||
|
"Share it!"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,42 @@
|
|||||||
require 'rails_helper'
|
require "rails_helper"
|
||||||
|
|
||||||
describe User do
|
describe User do
|
||||||
|
|
||||||
|
describe "#headings_voted_within_group" do
|
||||||
|
it "returns the headings voted by a user ordered by name" do
|
||||||
|
user1 = create(:user)
|
||||||
|
user2 = create(:user)
|
||||||
|
|
||||||
|
budget = create(:budget)
|
||||||
|
group = create(:budget_group, budget: budget)
|
||||||
|
|
||||||
|
new_york = create(:budget_heading, group: group, name: "New york")
|
||||||
|
san_franciso = create(:budget_heading, group: group, name: "San Franciso")
|
||||||
|
wyoming = create(:budget_heading, group: group, name: "Wyoming")
|
||||||
|
another_heading = create(:budget_heading, group: group)
|
||||||
|
|
||||||
|
new_york_investment = create(:budget_investment, heading: new_york)
|
||||||
|
san_franciso_investment = create(:budget_investment, heading: san_franciso)
|
||||||
|
wyoming_investment = create(:budget_investment, heading: wyoming)
|
||||||
|
|
||||||
|
create(:vote, votable: wyoming_investment, voter: user1)
|
||||||
|
create(:vote, votable: san_franciso_investment, voter: user1)
|
||||||
|
create(:vote, votable: new_york_investment, voter: user1)
|
||||||
|
|
||||||
|
headings_names = "#{new_york.name}, #{san_franciso.name}, and #{wyoming.name}"
|
||||||
|
|
||||||
|
expect(user1.headings_voted_within_group(group)).to include(new_york)
|
||||||
|
expect(user1.headings_voted_within_group(group)).to include(san_franciso)
|
||||||
|
expect(user1.headings_voted_within_group(group)).to include(wyoming)
|
||||||
|
expect(user1.headings_voted_within_group(group)).not_to include(another_heading)
|
||||||
|
expect(user1.headings_voted_within_group(group).map(&:name).to_sentence).to eq(headings_names)
|
||||||
|
|
||||||
|
expect(user2.headings_voted_within_group(group)).not_to include(new_york)
|
||||||
|
expect(user2.headings_voted_within_group(group)).not_to include(san_franciso)
|
||||||
|
expect(user2.headings_voted_within_group(group)).not_to include(another_heading)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "#debate_votes" do
|
describe "#debate_votes" do
|
||||||
let(:user) { create(:user) }
|
let(:user) { create(:user) }
|
||||||
|
|
||||||
@@ -72,39 +107,39 @@ describe User do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'preferences' do
|
describe "preferences" do
|
||||||
describe 'email_on_comment' do
|
describe "email_on_comment" do
|
||||||
it 'is false by default' do
|
it "is false by default" do
|
||||||
expect(subject.email_on_comment).to eq(false)
|
expect(subject.email_on_comment).to eq(false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'email_on_comment_reply' do
|
describe "email_on_comment_reply" do
|
||||||
it 'is false by default' do
|
it "is false by default" do
|
||||||
expect(subject.email_on_comment_reply).to eq(false)
|
expect(subject.email_on_comment_reply).to eq(false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'subscription_to_website_newsletter' do
|
describe "subscription_to_website_newsletter" do
|
||||||
it 'is true by default' do
|
it "is true by default" do
|
||||||
expect(subject.newsletter).to eq(true)
|
expect(subject.newsletter).to eq(true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'email_digest' do
|
describe "email_digest" do
|
||||||
it 'is true by default' do
|
it "is true by default" do
|
||||||
expect(subject.email_digest).to eq(true)
|
expect(subject.email_digest).to eq(true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'email_on_direct_message' do
|
describe "email_on_direct_message" do
|
||||||
it 'is true by default' do
|
it "is true by default" do
|
||||||
expect(subject.email_on_direct_message).to eq(true)
|
expect(subject.email_on_direct_message).to eq(true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'official_position_badge' do
|
describe "official_position_badge" do
|
||||||
it 'is false by default' do
|
it "is false by default" do
|
||||||
expect(subject.official_position_badge).to eq(false)
|
expect(subject.official_position_badge).to eq(false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -175,7 +210,7 @@ describe User do
|
|||||||
expect(subject.organization?).to be false
|
expect(subject.organization?).to be false
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'when it is an organization' do
|
describe "when it is an organization" do
|
||||||
before { create(:organization, user: subject) }
|
before { create(:organization, user: subject) }
|
||||||
|
|
||||||
it "is true when the user is an organization" do
|
it "is true when the user is an organization" do
|
||||||
@@ -193,7 +228,7 @@ describe User do
|
|||||||
expect(subject).not_to be_verified_organization
|
expect(subject).not_to be_verified_organization
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'when it is an organization' do
|
describe "when it is an organization" do
|
||||||
before { create(:organization, user: subject) }
|
before { create(:organization, user: subject) }
|
||||||
|
|
||||||
it "is false when the user is not a verified organization" do
|
it "is false when the user is not a verified organization" do
|
||||||
@@ -208,12 +243,12 @@ describe User do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "organization_attributes" do
|
describe "organization_attributes" do
|
||||||
before { subject.organization_attributes = {name: 'org', responsible_name: 'julia'} }
|
before { subject.organization_attributes = {name: "org", responsible_name: "julia"} }
|
||||||
|
|
||||||
it "triggers the creation of an associated organization" do
|
it "triggers the creation of an associated organization" do
|
||||||
expect(subject.organization).to be
|
expect(subject.organization).to be
|
||||||
expect(subject.organization.name).to eq('org')
|
expect(subject.organization.name).to eq("org")
|
||||||
expect(subject.organization.responsible_name).to eq('julia')
|
expect(subject.organization.responsible_name).to eq("julia")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "deactivates the validation of username, and activates the validation of organization" do
|
it "deactivates the validation of username, and activates the validation of organization" do
|
||||||
@@ -292,7 +327,7 @@ describe User do
|
|||||||
# We will use empleados.madrid.es as the officials' domain
|
# We will use empleados.madrid.es as the officials' domain
|
||||||
# Subdomains are also accepted
|
# Subdomains are also accepted
|
||||||
|
|
||||||
Setting['email_domain_for_officials'] = 'officials.madrid.es'
|
Setting["email_domain_for_officials"] = "officials.madrid.es"
|
||||||
user1 = create(:user, email: "john@officials.madrid.es", confirmed_at: Time.current)
|
user1 = create(:user, email: "john@officials.madrid.es", confirmed_at: Time.current)
|
||||||
user2 = create(:user, email: "john@yes.officials.madrid.es", confirmed_at: Time.current)
|
user2 = create(:user, email: "john@yes.officials.madrid.es", confirmed_at: Time.current)
|
||||||
user3 = create(:user, email: "john@unofficials.madrid.es", confirmed_at: Time.current)
|
user3 = create(:user, email: "john@unofficials.madrid.es", confirmed_at: Time.current)
|
||||||
@@ -304,7 +339,7 @@ describe User do
|
|||||||
expect(user4.has_official_email?).to eq(false)
|
expect(user4.has_official_email?).to eq(false)
|
||||||
|
|
||||||
# We reset the officials' domain setting
|
# We reset the officials' domain setting
|
||||||
Setting.find_by(key: 'email_domain_for_officials').update(value: '')
|
Setting.find_by(key: "email_domain_for_officials").update(value: "")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -461,10 +496,10 @@ describe User do
|
|||||||
reset_password_token: "token2",
|
reset_password_token: "token2",
|
||||||
email_verification_token: "token3")
|
email_verification_token: "token3")
|
||||||
|
|
||||||
user.erase('a test')
|
user.erase("a test")
|
||||||
user.reload
|
user.reload
|
||||||
|
|
||||||
expect(user.erase_reason).to eq('a test')
|
expect(user.erase_reason).to eq("a test")
|
||||||
expect(user.erased_at).to be
|
expect(user.erased_at).to be
|
||||||
|
|
||||||
expect(user.username).to be_nil
|
expect(user.username).to be_nil
|
||||||
@@ -495,7 +530,7 @@ describe User do
|
|||||||
user = create(:user)
|
user = create(:user)
|
||||||
identity = create(:identity, user: user)
|
identity = create(:identity, user: user)
|
||||||
|
|
||||||
user.erase('an identity test')
|
user.erase("an identity test")
|
||||||
|
|
||||||
expect(Identity.exists?(identity.id)).not_to be
|
expect(Identity.exists?(identity.id)).not_to be
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user