diff --git a/app/controllers/admin/poll/booth_assignments_controller.rb b/app/controllers/admin/poll/booth_assignments_controller.rb index 13a6955c979..0fc6e386a6b 100644 --- a/app/controllers/admin/poll/booth_assignments_controller.rb +++ b/app/controllers/admin/poll/booth_assignments_controller.rb @@ -29,11 +29,8 @@ def create @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 @@ def destroy @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 ba2e848dd0a..dd7fd46b982 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -25,7 +25,6 @@ def show .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 37279c82d1c..a755d26fbcd 100644 --- a/app/models/abilities/tracker.rb +++ b/app/models/abilities/tracker.rb @@ -3,8 +3,6 @@ class Tracker 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 20dd8c7a776..0814d55527b 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 6529b19bb15..e47a1090f65 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 a87554c0d64..5c76fb624c1 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 9d6007b4f38..9020e21bebc 100644 --- a/spec/features/admin/admin_notifications_spec.rb +++ b/spec/features/admin/admin_notifications_spec.rb @@ -189,8 +189,6 @@ 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 187bd328711..485a1ead172 100644 --- a/spec/features/admin/budget_investments_spec.rb +++ b/spec/features/admin/budget_investments_spec.rb @@ -1715,27 +1715,7 @@ 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 0cdfab879d1..751fb89a722 100644 --- a/spec/features/admin/emails/newsletters_spec.rb +++ b/spec/features/admin/emails/newsletters_spec.rb @@ -130,7 +130,6 @@ 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 bbde7be256d..2720bb32cd7 100644 --- a/spec/features/admin/poll/shifts_spec.rb +++ b/spec/features/admin/poll/shifts_spec.rb @@ -8,7 +8,6 @@ end scenario "Show" do - poll = create(:poll) officer = create(:poll_officer) booth1 = create(:poll_booth) @@ -246,7 +245,6 @@ end scenario "Destroy an officer" do - poll = create(:poll) booth = create(:poll_booth) officer = create(:poll_officer) @@ -261,7 +259,6 @@ 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 7abf9db3ce4..1f1c8275f65 100644 --- a/spec/features/admin/stats_spec.rb +++ b/spec/features/admin/stats_spec.rb @@ -388,8 +388,6 @@ 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 cfd71b9bc94..c31899113ce 100644 --- a/spec/features/admin/system_emails_spec.rb +++ b/spec/features/admin/system_emails_spec.rb @@ -214,8 +214,6 @@ 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 97e31f2fa2e..58525cc8069 100644 --- a/spec/features/budgets/investments_spec.rb +++ b/spec/features/budgets/investments_spec.rb @@ -1760,7 +1760,6 @@ def investments_order 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 2872d252beb..dbf7d0ebfde 100644 --- a/spec/features/direct_messages_spec.rb +++ b/spec/features/direct_messages_spec.rb @@ -60,7 +60,6 @@ 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 67d46fb16d2..35043ec4d9b 100644 --- a/spec/features/polls/answers_spec.rb +++ b/spec/features/polls/answers_spec.rb @@ -39,12 +39,11 @@ 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 @@ 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 77e14e17db2..391cb648953 100644 --- a/spec/features/polls/voter_spec.rb +++ b/spec/features/polls/voter_spec.rb @@ -50,8 +50,6 @@ 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 fa22d6d07cc..52c1c15e470 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -119,7 +119,7 @@ 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 4c414414090..d3a02cb54a3 100644 --- a/spec/lib/graphql_spec.rb +++ b/spec/lib/graphql_spec.rb @@ -49,12 +49,6 @@ def extract_fields(response, collection_name, field_chain) 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 @@ def extract_fields(response, collection_name, field_chain) 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 @@ def extract_fields(response, collection_name, field_chain) 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 @@ def extract_fields(response, collection_name, field_chain) 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 7edebfeca3c..5baaede9159 100644 --- a/spec/models/poll/shift_spec.rb +++ b/spec/models/poll/shift_spec.rb @@ -58,7 +58,6 @@ 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 3a3bebcd71b..f194f3d2271 100644 --- a/spec/models/signature_spec.rb +++ b/spec/models/signature_spec.rb @@ -183,7 +183,6 @@ 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