Merge pull request #3718 from consul/remove_obsolete_code
Remove unused and obsolete code
This commit is contained in:
@@ -29,11 +29,8 @@ class Admin::Poll::BoothAssignmentsController < Admin::Poll::BaseController
|
||||
@booth_assignment = ::Poll::BoothAssignment.new(poll: @poll,
|
||||
booth: @booth)
|
||||
|
||||
if @booth_assignment.save
|
||||
notice = t("admin.poll_booth_assignments.flash.create")
|
||||
else
|
||||
notice = t("admin.poll_booth_assignments.flash.error_create")
|
||||
end
|
||||
@booth_assignment.save
|
||||
|
||||
respond_to do |format|
|
||||
format.js { render layout: false }
|
||||
end
|
||||
@@ -44,11 +41,8 @@ class Admin::Poll::BoothAssignmentsController < Admin::Poll::BaseController
|
||||
@booth = Poll::Booth.find(booth_assignment_params[:booth_id])
|
||||
@booth_assignment = ::Poll::BoothAssignment.find(params[:id])
|
||||
|
||||
if @booth_assignment.destroy
|
||||
notice = t("admin.poll_booth_assignments.flash.destroy")
|
||||
else
|
||||
notice = t("admin.poll_booth_assignments.flash.error_destroy")
|
||||
end
|
||||
@booth_assignment.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.js { render layout: false }
|
||||
end
|
||||
|
||||
@@ -25,7 +25,6 @@ class PollsController < ApplicationController
|
||||
.where.not(description: "").order(:given_order)
|
||||
|
||||
@answers_by_question_id = {}
|
||||
poll_answers = ::Poll::Answer.by_question(@poll.question_ids).by_author(current_user&.id)
|
||||
|
||||
@last_pair_question_answers = {}
|
||||
@questions.each do |question|
|
||||
|
||||
@@ -3,8 +3,6 @@ module Abilities
|
||||
include CanCan::Ability
|
||||
|
||||
def initialize(user)
|
||||
tracker = user.tracker
|
||||
|
||||
can :index, Budget
|
||||
can [:index, :show, :edit], Budget::Investment
|
||||
can :manage, Milestone
|
||||
|
||||
@@ -5,7 +5,6 @@ User:
|
||||
public_debates: [Debate]
|
||||
public_proposals: [Proposal]
|
||||
public_comments: [Comment]
|
||||
# organization: Organization
|
||||
Debate:
|
||||
fields:
|
||||
id: integer
|
||||
@@ -81,8 +80,3 @@ Vote:
|
||||
votable_type: string
|
||||
public_created_at: string
|
||||
vote_flag: boolean
|
||||
# Organization:
|
||||
# fields:
|
||||
# id: integer
|
||||
# user_id: integer
|
||||
# name: string
|
||||
|
||||
@@ -1028,11 +1028,6 @@ en:
|
||||
poll_booth_assignments:
|
||||
alert:
|
||||
shifts: "There are shifts associated to this booth. If you remove the booth assignment, the shifts will be also deleted. Continue?"
|
||||
flash:
|
||||
destroy: "Booth not assigned anymore"
|
||||
create: "Booth assigned"
|
||||
error_destroy: "An error ocurred when removing booth assignment"
|
||||
error_create: "An error ocurred when assigning booth to the poll"
|
||||
show:
|
||||
location: "Location"
|
||||
officers: "Officers"
|
||||
|
||||
@@ -1029,11 +1029,6 @@ es:
|
||||
poll_booth_assignments:
|
||||
alert:
|
||||
shifts: "Hay turnos asignados para esta urna. Si la desasignas, esos turnos se eliminarán. ¿Deseas continuar?"
|
||||
flash:
|
||||
destroy: "Urna desasignada"
|
||||
create: "Urna asignada"
|
||||
error_destroy: "Se ha producido un error al desasignar la urna"
|
||||
error_create: "Se ha producido un error al intentar asignar la urna"
|
||||
show:
|
||||
location: "Ubicación"
|
||||
officers: "Presidentes de mesa"
|
||||
|
||||
@@ -189,8 +189,6 @@ describe "Admin Notifications" do
|
||||
scenario "A draft Admin notification can be sent", :js do
|
||||
2.times { create(:user) }
|
||||
notification = create(:admin_notification, segment_recipient: :all_users)
|
||||
total_users = notification.list_of_recipients.count
|
||||
confirm_message = "Are you sure you want to send this notification to #{total_users} users?"
|
||||
|
||||
visit admin_admin_notification_path(notification)
|
||||
|
||||
|
||||
@@ -1715,27 +1715,7 @@ describe "Admin budget investments" do
|
||||
context "Selecting csv" do
|
||||
|
||||
scenario "Downloading CSV file" do
|
||||
admin = create(:administrator, user: create(:user, username: "Admin"))
|
||||
valuator = create(:valuator, user: create(:user, username: "Valuator"))
|
||||
valuator_group = create(:valuator_group, name: "Valuator Group")
|
||||
budget_group = create(:budget_group, name: "Budget Group", budget: budget)
|
||||
first_budget_heading = create(:budget_heading, group: budget_group, name: "Budget Heading")
|
||||
second_budget_heading = create(:budget_heading, group: budget_group, name: "Other Heading")
|
||||
first_investment = create(:budget_investment, :feasible, :selected, title: "Le Investment",
|
||||
budget: budget, group: budget_group,
|
||||
heading: first_budget_heading,
|
||||
cached_votes_up: 88, price: 99,
|
||||
valuators: [],
|
||||
valuator_groups: [valuator_group],
|
||||
administrator: admin,
|
||||
visible_to_valuators: true)
|
||||
second_investment = create(:budget_investment, :unfeasible, title: "Alt Investment",
|
||||
budget: budget, group: budget_group,
|
||||
heading: second_budget_heading,
|
||||
cached_votes_up: 66, price: 88,
|
||||
valuators: [valuator],
|
||||
valuator_groups: [],
|
||||
visible_to_valuators: false)
|
||||
create(:budget_investment, budget: budget)
|
||||
|
||||
visit admin_budget_budget_investments_path(budget)
|
||||
|
||||
|
||||
@@ -130,7 +130,6 @@ describe "Admin newsletter emails" do
|
||||
scenario "Sends newsletter emails", :js do
|
||||
newsletter = create(:newsletter)
|
||||
visit admin_newsletter_path(newsletter)
|
||||
total_users = newsletter.list_of_recipient_emails.count
|
||||
|
||||
accept_confirm { click_link "Send" }
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ describe "Admin shifts" do
|
||||
end
|
||||
|
||||
scenario "Show" do
|
||||
poll = create(:poll)
|
||||
officer = create(:poll_officer)
|
||||
|
||||
booth1 = create(:poll_booth)
|
||||
@@ -246,7 +245,6 @@ describe "Admin shifts" do
|
||||
end
|
||||
|
||||
scenario "Destroy an officer" do
|
||||
poll = create(:poll)
|
||||
booth = create(:poll_booth)
|
||||
officer = create(:poll_officer)
|
||||
|
||||
@@ -261,7 +259,6 @@ describe "Admin shifts" do
|
||||
end
|
||||
|
||||
scenario "Empty" do
|
||||
poll = create(:poll)
|
||||
booth = create(:poll_booth)
|
||||
|
||||
visit new_admin_booth_shift_path(booth)
|
||||
|
||||
@@ -388,8 +388,6 @@ describe "Stats" do
|
||||
end
|
||||
|
||||
scenario "Participants by poll" do
|
||||
oa = create(:poll_officer_assignment)
|
||||
|
||||
poll1 = create(:poll)
|
||||
poll2 = create(:poll)
|
||||
|
||||
|
||||
@@ -214,8 +214,6 @@ describe "System Emails" do
|
||||
|
||||
expect(page).to have_content "Invitation to CONSUL"
|
||||
expect(page).to have_content "Thank you for applying to join CONSUL!"
|
||||
|
||||
registration_url = new_user_registration_url(track_id: 172943750183759812)
|
||||
expect(page).to have_link "Complete registration"
|
||||
end
|
||||
|
||||
|
||||
@@ -1760,7 +1760,6 @@ describe "Budget Investments" do
|
||||
scenario "Due to being unfeasible" do
|
||||
user = create(:user, :level_two)
|
||||
investment = create(:budget_investment, :selected, heading: heading)
|
||||
heading2 = create(:budget_heading, group: group)
|
||||
|
||||
ballot = create(:budget_ballot, user: user, budget: budget)
|
||||
ballot.investments << investment
|
||||
|
||||
@@ -60,7 +60,6 @@ describe "Direct messages" do
|
||||
end
|
||||
|
||||
scenario "User not logged in" do
|
||||
sender = create(:user)
|
||||
receiver = create(:user)
|
||||
|
||||
visit new_user_direct_message_path(receiver)
|
||||
|
||||
@@ -39,12 +39,11 @@ describe "Answers" do
|
||||
end
|
||||
|
||||
scenario "Add video to answer" do
|
||||
answer1 = create(:poll_question_answer, question: question)
|
||||
answer2 = create(:poll_question_answer, question: question)
|
||||
answer = create(:poll_question_answer, question: question)
|
||||
|
||||
visit admin_question_path(question)
|
||||
|
||||
within("#poll_question_answer_#{answer1.id}") do
|
||||
within("#poll_question_answer_#{answer.id}") do
|
||||
click_link "Video list"
|
||||
end
|
||||
|
||||
@@ -55,7 +54,7 @@ describe "Answers" do
|
||||
|
||||
click_button "Save"
|
||||
|
||||
within("#poll_question_answer_video_#{answer1.videos.last.id}") do
|
||||
within("#poll_question_answer_video_#{answer.videos.last.id}") do
|
||||
expect(page).to have_content "Awesome project video"
|
||||
expect(page).to have_content "https://www.youtube.com/watch?v=123"
|
||||
end
|
||||
|
||||
@@ -50,8 +50,6 @@ describe "Voter" do
|
||||
end
|
||||
|
||||
scenario "Voting in booth", :js do
|
||||
user = create(:user, :in_census)
|
||||
|
||||
login_through_form_as_officer(officer.user)
|
||||
|
||||
visit new_officing_residence_path
|
||||
|
||||
@@ -119,7 +119,7 @@ describe "Proposals" do
|
||||
proposal_with_image = create(:proposal)
|
||||
image = create(:image, imageable: proposal_with_image)
|
||||
|
||||
visit proposals_path(id: proposal)
|
||||
visit proposals_path
|
||||
|
||||
within("#proposal_#{proposal.id}") do
|
||||
expect(page).not_to have_css("div.with-image")
|
||||
|
||||
@@ -49,12 +49,6 @@ describe "Consul Schema" do
|
||||
expect(dig(response, "data.proposal.title")).to eq(proposal.title)
|
||||
end
|
||||
|
||||
xit "returns has_one associations" do
|
||||
organization = create(:organization)
|
||||
response = execute("{ user(id: #{organization.user_id}) { organization { name } } }")
|
||||
expect(dig(response, "data.user.organization.name")).to eq(organization.name)
|
||||
end
|
||||
|
||||
it "returns belongs_to associations" do
|
||||
response = execute("{ proposal(id: #{proposal.id}) { public_author { username } } }")
|
||||
expect(dig(response, "data.proposal.public_author.username")).to eq(proposal.public_author.username)
|
||||
@@ -72,15 +66,6 @@ describe "Consul Schema" do
|
||||
expect(comment_bodies).to match_array([comment_1.body, comment_2.body])
|
||||
end
|
||||
|
||||
xit "executes deeply nested queries" do
|
||||
org_user = create(:user)
|
||||
organization = create(:organization, user: org_user)
|
||||
org_proposal = create(:proposal, author: org_user)
|
||||
response = execute("{ proposal(id: #{org_proposal.id}) { public_author { organization { name } } } }")
|
||||
|
||||
expect(dig(response, "data.proposal.public_author.organization.name")).to eq(organization.name)
|
||||
end
|
||||
|
||||
it "hides confidential fields of Int type" do
|
||||
response = execute("{ user(id: #{user.id}) { failed_census_calls_count } }")
|
||||
expect(hidden_field?(response, "failed_census_calls_count")).to be_truthy
|
||||
@@ -157,18 +142,6 @@ describe "Consul Schema" do
|
||||
expect(received_titles).to match_array [visible_proposal.title]
|
||||
end
|
||||
|
||||
xit "only returns proposals of the Human Rights proceeding" do
|
||||
proposal = create(:proposal)
|
||||
human_rights_proposal = create(:proposal, proceeding: "Derechos Humanos", sub_proceeding: "Right to have a job")
|
||||
other_proceeding_proposal = create(:proposal)
|
||||
other_proceeding_proposal.update_attribute(:proceeding, "Another proceeding")
|
||||
|
||||
response = execute("{ proposals { edges { node { title } } } }")
|
||||
received_titles = extract_fields(response, "proposals", "title")
|
||||
|
||||
expect(received_titles).to match_array [proposal.title, human_rights_proposal.title]
|
||||
end
|
||||
|
||||
it "includes proposals of authors even if public activity is set to false" do
|
||||
visible_author = create(:user, public_activity: true)
|
||||
hidden_author = create(:user, public_activity: false)
|
||||
@@ -556,17 +529,6 @@ describe "Consul Schema" do
|
||||
expect(received_tags).to match_array ["Health", "Transportation"]
|
||||
end
|
||||
|
||||
xit "does not display tags for proceeding's proposals" do
|
||||
valid_proceeding_proposal = create(:proposal, proceeding: "Derechos Humanos", sub_proceeding: "Right to a Home", tag_list: "Health")
|
||||
invalid_proceeding_proposal = create(:proposal, tag_list: "Animals")
|
||||
invalid_proceeding_proposal.update_attribute("proceeding", "Random")
|
||||
|
||||
response = execute("{ tags { edges { node { name } } } }")
|
||||
received_tags = extract_fields(response, "tags", "name")
|
||||
|
||||
expect(received_tags).to match_array ["Health"]
|
||||
end
|
||||
|
||||
it "does not display tags for taggings that are not public" do
|
||||
proposal = create(:proposal, tag_list: "Health")
|
||||
allow(ActsAsTaggableOn::Tag).to receive(:public_for_api).and_return([])
|
||||
|
||||
@@ -58,7 +58,6 @@ describe Poll::Shift do
|
||||
|
||||
it "creates and destroy corresponding officer_assignments" do
|
||||
poll2 = create(:poll)
|
||||
poll3 = create(:poll)
|
||||
|
||||
booth_assignment1 = create(:poll_booth_assignment, poll: poll, booth: booth)
|
||||
booth_assignment2 = create(:poll_booth_assignment, poll: poll2, booth: booth)
|
||||
|
||||
@@ -183,7 +183,6 @@ describe Signature do
|
||||
it "creates a user with that document number" do
|
||||
create(:geozone, census_code: "01")
|
||||
signature = create(:signature, document_number: "12345678Z")
|
||||
proposal = signature.signable
|
||||
|
||||
signature.verify
|
||||
|
||||
|
||||
Reference in New Issue
Block a user