diff --git a/app/controllers/admin/poll/booth_assignments_controller.rb b/app/controllers/admin/poll/booth_assignments_controller.rb index 13a6955c9..0fc6e386a 100644 --- a/app/controllers/admin/poll/booth_assignments_controller.rb +++ b/app/controllers/admin/poll/booth_assignments_controller.rb @@ -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 diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index ba2e848dd..dd7fd46b9 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -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| diff --git a/app/models/abilities/tracker.rb b/app/models/abilities/tracker.rb index 37279c82d..a755d26fb 100644 --- a/app/models/abilities/tracker.rb +++ b/app/models/abilities/tracker.rb @@ -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 diff --git a/config/api.yml b/config/api.yml index 20dd8c7a7..0814d5552 100644 --- a/config/api.yml +++ b/config/api.yml @@ -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 diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 6529b19bb..e47a1090f 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -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" diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index a87554c0d..5c76fb624 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -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" diff --git a/spec/features/admin/admin_notifications_spec.rb b/spec/features/admin/admin_notifications_spec.rb index 9d6007b4f..9020e21be 100644 --- a/spec/features/admin/admin_notifications_spec.rb +++ b/spec/features/admin/admin_notifications_spec.rb @@ -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) diff --git a/spec/features/admin/budget_investments_spec.rb b/spec/features/admin/budget_investments_spec.rb index 187bd3287..485a1ead1 100644 --- a/spec/features/admin/budget_investments_spec.rb +++ b/spec/features/admin/budget_investments_spec.rb @@ -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) diff --git a/spec/features/admin/emails/newsletters_spec.rb b/spec/features/admin/emails/newsletters_spec.rb index 0cdfab879..751fb89a7 100644 --- a/spec/features/admin/emails/newsletters_spec.rb +++ b/spec/features/admin/emails/newsletters_spec.rb @@ -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" } diff --git a/spec/features/admin/poll/shifts_spec.rb b/spec/features/admin/poll/shifts_spec.rb index bbde7be25..2720bb32c 100644 --- a/spec/features/admin/poll/shifts_spec.rb +++ b/spec/features/admin/poll/shifts_spec.rb @@ -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) diff --git a/spec/features/admin/stats_spec.rb b/spec/features/admin/stats_spec.rb index 7abf9db3c..1f1c8275f 100644 --- a/spec/features/admin/stats_spec.rb +++ b/spec/features/admin/stats_spec.rb @@ -388,8 +388,6 @@ describe "Stats" do end scenario "Participants by poll" do - oa = create(:poll_officer_assignment) - poll1 = create(:poll) poll2 = create(:poll) diff --git a/spec/features/admin/system_emails_spec.rb b/spec/features/admin/system_emails_spec.rb index cfd71b9bc..c31899113 100644 --- a/spec/features/admin/system_emails_spec.rb +++ b/spec/features/admin/system_emails_spec.rb @@ -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 diff --git a/spec/features/budgets/investments_spec.rb b/spec/features/budgets/investments_spec.rb index 97e31f2fa..58525cc80 100644 --- a/spec/features/budgets/investments_spec.rb +++ b/spec/features/budgets/investments_spec.rb @@ -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 diff --git a/spec/features/direct_messages_spec.rb b/spec/features/direct_messages_spec.rb index 2872d252b..dbf7d0ebf 100644 --- a/spec/features/direct_messages_spec.rb +++ b/spec/features/direct_messages_spec.rb @@ -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) diff --git a/spec/features/polls/answers_spec.rb b/spec/features/polls/answers_spec.rb index 67d46fb16..35043ec4d 100644 --- a/spec/features/polls/answers_spec.rb +++ b/spec/features/polls/answers_spec.rb @@ -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 diff --git a/spec/features/polls/voter_spec.rb b/spec/features/polls/voter_spec.rb index 77e14e17d..391cb6489 100644 --- a/spec/features/polls/voter_spec.rb +++ b/spec/features/polls/voter_spec.rb @@ -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 diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index fa22d6d07..52c1c15e4 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -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") diff --git a/spec/lib/graphql_spec.rb b/spec/lib/graphql_spec.rb index 4c4144140..d3a02cb54 100644 --- a/spec/lib/graphql_spec.rb +++ b/spec/lib/graphql_spec.rb @@ -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([]) diff --git a/spec/models/poll/shift_spec.rb b/spec/models/poll/shift_spec.rb index 7edebfeca..5baaede91 100644 --- a/spec/models/poll/shift_spec.rb +++ b/spec/models/poll/shift_spec.rb @@ -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) diff --git a/spec/models/signature_spec.rb b/spec/models/signature_spec.rb index 3a3bebcd7..f194f3d22 100644 --- a/spec/models/signature_spec.rb +++ b/spec/models/signature_spec.rb @@ -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