From db97f9d08c33a86359479bfc0cd8b2cdf83a7ab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 24 Oct 2019 15:48:37 +0200 Subject: [PATCH] Add and apply rubocop rules for empty lines We were very inconsistent regarding these rules. Personally I prefer no empty lines around blocks, clases, etc... as recommended by the Ruby style guide [1], and they're the default values in rubocop, so those are the settings I'm applying. The exception is the `private` access modifier, since we were leaving empty lines around it most of the time. That's the default rubocop rule as well. Personally I don't have a strong preference about this one. [1] https://rubystyle.guide/#empty-lines-around-bodies --- .rubocop_basic.yml | 18 +++++++++++ app/controllers/account_controller.rb | 1 - app/controllers/admin/activity_controller.rb | 1 - app/controllers/admin/api/stats_controller.rb | 1 - app/controllers/admin/base_controller.rb | 1 - .../admin/budget_groups_controller.rb | 1 - .../admin/budget_headings_controller.rb | 1 - .../admin/budget_phases_controller.rb | 1 - app/controllers/admin/budgets_controller.rb | 1 - app/controllers/admin/comments_controller.rb | 2 -- app/controllers/admin/dashboard_controller.rb | 2 -- app/controllers/admin/debates_controller.rb | 1 - app/controllers/admin/geozones_controller.rb | 1 - .../hidden_budget_investments_controller.rb | 1 - .../admin/hidden_comments_controller.rb | 1 - .../admin/hidden_debates_controller.rb | 1 - .../admin/hidden_proposals_controller.rb | 1 - .../admin/hidden_users_controller.rb | 1 - app/controllers/admin/homepage_controller.rb | 2 -- .../admin/legislation/base_controller.rb | 1 - .../admin/legislation/proposals_controller.rb | 1 - .../local_census_records/base_controller.rb | 1 - .../admin/milestone_statuses_controller.rb | 1 - .../admin/newsletters_controller.rb | 1 - app/controllers/admin/officials_controller.rb | 2 -- .../admin/organizations_controller.rb | 1 - .../admin/poll/active_polls_controller.rb | 1 - app/controllers/admin/poll/base_controller.rb | 1 - .../poll/booth_assignments_controller.rb | 2 -- .../admin/poll/booths_controller.rb | 1 - .../poll/officer_assignments_controller.rb | 2 -- .../admin/poll/officers_controller.rb | 1 - .../admin/poll/shifts_controller.rb | 1 - .../proposal_notifications_controller.rb | 2 -- app/controllers/admin/proposals_controller.rb | 1 - .../admin/signature_sheets_controller.rb | 2 -- .../site_customization/base_controller.rb | 1 - .../site_customization/cards_controller.rb | 1 - .../documents_controller.rb | 1 - .../information_texts_controller.rb | 1 - app/controllers/admin/stats_controller.rb | 1 - .../admin/system_emails_controller.rb | 1 - app/controllers/admin/tags_controller.rb | 1 - app/controllers/admin/trackers_controller.rb | 1 + .../admin/valuator_groups_controller.rb | 2 -- app/controllers/admin/valuators_controller.rb | 1 - .../admin/verifications_controller.rb | 2 -- .../admin/widget/base_controller.rb | 1 - .../admin/widget/feeds_controller.rb | 2 -- .../budgets/ballot/lines_controller.rb | 1 - app/controllers/budgets/ballots_controller.rb | 1 - .../budgets/executions_controller.rb | 1 + .../budgets/investments_controller.rb | 3 -- app/controllers/budgets/results_controller.rb | 1 - app/controllers/budgets/stats_controller.rb | 2 -- app/controllers/budgets_controller.rb | 1 - app/controllers/concerns/flag_actions.rb | 1 - app/controllers/concerns/image_attributes.rb | 1 - app/controllers/concerns/moderate_actions.rb | 1 - app/controllers/concerns/polymorphic.rb | 2 -- .../concerns/remotely_translatable.rb | 2 -- app/controllers/concerns/search.rb | 1 - app/controllers/debates_controller.rb | 1 - app/controllers/direct_uploads_controller.rb | 1 - app/controllers/documents_controller.rb | 1 - app/controllers/follows_controller.rb | 1 - app/controllers/images_controller.rb | 1 - app/controllers/installation_controller.rb | 2 -- .../legislation/annotations_controller.rb | 1 - .../legislation/draft_versions_controller.rb | 1 - .../legislation/proposals_controller.rb | 1 - .../management/account_controller.rb | 2 -- app/controllers/management/base_controller.rb | 1 - .../budgets/investments_controller.rb | 1 - .../management/budgets_controller.rb | 1 - .../management/dashboard_controller.rb | 2 -- .../document_verifications_controller.rb | 2 -- .../email_verifications_controller.rb | 2 -- .../management/proposals_controller.rb | 1 - .../management/sessions_controller.rb | 1 - .../management/user_invites_controller.rb | 2 -- .../management/users_controller.rb | 2 -- app/controllers/moderation/base_controller.rb | 1 - .../budgets/investments_controller.rb | 1 - .../moderation/dashboard_controller.rb | 2 -- .../moderation/debates_controller.rb | 1 - .../moderation/users_controller.rb | 2 -- app/controllers/notifications_controller.rb | 1 - .../officing/ballot_sheets_controller.rb | 2 -- app/controllers/officing/booth_controller.rb | 1 - .../officing/dashboard_controller.rb | 2 -- app/controllers/officing/polls_controller.rb | 1 - .../officing/residence_controller.rb | 2 -- .../officing/results_controller.rb | 1 - app/controllers/officing/voters_controller.rb | 1 - .../organizations/registrations_controller.rb | 2 -- app/controllers/polls/answers_controller.rb | 2 -- app/controllers/polls/questions_controller.rb | 2 -- app/controllers/polls_controller.rb | 1 - .../proposal_notifications_controller.rb | 1 - .../remote_translations_controller.rb | 1 - app/controllers/tags_controller.rb | 2 -- app/controllers/tracking/base_controller.rb | 1 - ...budget_investment_milestones_controller.rb | 1 - ...get_investment_progress_bars_controller.rb | 1 - .../tracking/budget_investments_controller.rb | 1 - .../proposal_milestones_controller.rb | 1 - .../proposal_progress_bars_controller.rb | 2 +- .../users/confirmations_controller.rb | 2 -- .../users/omniauth_callbacks_controller.rb | 2 -- .../users/registrations_controller.rb | 1 - app/controllers/users/sessions_controller.rb | 2 -- app/controllers/users_controller.rb | 1 - app/controllers/valuation/base_controller.rb | 1 - .../budget_investments_controller.rb | 1 - .../verification/letter_controller.rb | 1 - .../verification/sms_controller.rb | 1 - .../verification/verified_user_controller.rb | 1 - app/controllers/verification_controller.rb | 1 - app/controllers/welcome_controller.rb | 1 - app/helpers/accessibility_helper.rb | 2 -- .../admin_budget_investments_helper.rb | 2 -- app/helpers/admin_helper.rb | 2 -- app/helpers/application_helper.rb | 2 -- app/helpers/ballots_helper.rb | 2 -- app/helpers/banners_helper.rb | 2 -- app/helpers/budget_executions_helper.rb | 2 -- app/helpers/budget_headings_helper.rb | 2 -- app/helpers/budgets_helper.rb | 1 - app/helpers/cache_keys_helper.rb | 2 -- app/helpers/change_log_helper.rb | 2 -- app/helpers/comments_helper.rb | 2 -- app/helpers/communities_helper.rb | 1 - app/helpers/debates_helper.rb | 2 -- app/helpers/direct_uploads_helper.rb | 2 -- app/helpers/documentables_helper.rb | 1 - app/helpers/documents_helper.rb | 1 - app/helpers/download_settings_helper.rb | 3 -- app/helpers/embed_videos_helper.rb | 2 -- app/helpers/feeds_helper.rb | 2 -- app/helpers/flags_helper.rb | 2 -- app/helpers/followables_helper.rb | 2 -- app/helpers/follows_helper.rb | 2 -- app/helpers/geozones_helper.rb | 2 -- app/helpers/globalize_helper.rb | 1 - app/helpers/imageables_helper.rb | 2 -- app/helpers/images_helper.rb | 2 -- app/helpers/layouts_helper.rb | 2 -- app/helpers/legislation_helper.rb | 1 - app/helpers/locales_helper.rb | 2 -- app/helpers/mailer_helper.rb | 1 - app/helpers/management_helper.rb | 2 -- app/helpers/map_locations_helper.rb | 2 -- app/helpers/officers_helper.rb | 2 -- app/helpers/officing_helper.rb | 2 -- app/helpers/poll_recounts_helper.rb | 2 -- app/helpers/polls_helper.rb | 1 - app/helpers/proposals_helper.rb | 1 - app/helpers/remote_translations_helper.rb | 1 - app/helpers/search_helper.rb | 2 -- app/helpers/settings_helper.rb | 2 -- app/helpers/shifts_helper.rb | 1 - app/helpers/signature_sheets_helper.rb | 2 -- app/helpers/stats_helper.rb | 1 - app/helpers/tags_helper.rb | 2 -- app/helpers/text_with_links_helper.rb | 2 -- app/helpers/trackers_helper.rb | 2 -- app/helpers/tracks_helper.rb | 2 -- app/helpers/users_helper.rb | 2 -- app/helpers/valuation_helper.rb | 2 -- app/helpers/valuators_helper.rb | 1 - app/helpers/verification_helper.rb | 2 -- app/helpers/votes_helper.rb | 2 -- app/helpers/welcome_helper.rb | 2 -- app/mailers/dashboard/mailer.rb | 1 - app/mailers/mailer.rb | 1 - app/models/ability.rb | 1 - app/models/ahoy/data_source.rb | 3 -- app/models/banner.rb | 1 - app/models/budget.rb | 2 -- app/models/budget/ballot.rb | 1 - app/models/budget/investment/change_log.rb | 1 - app/models/budget/reclassification.rb | 1 - app/models/budget/result.rb | 2 -- app/models/comment_notifier.rb | 1 - app/models/concerns/communitable.rb | 1 - app/models/concerns/conflictable.rb | 1 - app/models/concerns/documentable.rb | 1 - .../budget_investment_csv.rb | 2 -- .../concerns/download_settings/comment_csv.rb | 2 -- .../concerns/download_settings/debate_csv.rb | 2 -- .../legislation_process_csv.rb | 2 -- .../download_settings/proposal_csv.rb | 2 -- app/models/concerns/filterable.rb | 3 -- app/models/concerns/flaggable.rb | 1 - app/models/concerns/followable.rb | 1 - app/models/concerns/graphqlable.rb | 3 -- app/models/concerns/mappable.rb | 2 -- app/models/concerns/measurable.rb | 3 -- app/models/concerns/search_cache.rb | 1 - app/models/concerns/searchable.rb | 1 - app/models/custom/verification/residence.rb | 2 -- app/models/dashboard/action.rb | 1 + app/models/direct_message.rb | 1 - app/models/direct_upload.rb | 1 - app/models/document.rb | 1 - app/models/download_setting.rb | 1 - app/models/evaluation_comment_notifier.rb | 1 + app/models/flag.rb | 1 - app/models/geozone.rb | 1 - app/models/image.rb | 1 - app/models/legislation/process/phase.rb | 2 -- app/models/legislation/process/publication.rb | 2 -- app/models/map_location.rb | 2 -- app/models/milestone.rb | 1 - app/models/notification.rb | 2 -- app/models/officing/residence.rb | 1 - app/models/organization.rb | 2 -- app/models/poll/answer.rb | 1 - app/models/poll/ballot.rb | 1 - app/models/poll/ballot_sheet.rb | 1 - app/models/poll/officer.rb | 1 - app/models/poll/officer_assignment.rb | 1 - app/models/poll/pair_answer.rb | 1 - app/models/poll/partial_result.rb | 1 - app/models/poll/question/answer.rb | 1 - app/models/poll/recount.rb | 1 - app/models/poll/stats.rb | 1 - app/models/poll/voter.rb | 2 -- app/models/progress_bar.rb | 1 - app/models/proposal_notification.rb | 1 - app/models/remote_translation.rb | 1 - app/models/signature.rb | 1 - app/models/site_customization/image.rb | 1 - app/models/tag_cloud.rb | 2 -- app/models/topic.rb | 1 - app/models/user.rb | 2 -- app/models/valuator.rb | 1 - app/models/verification/email.rb | 1 - app/models/verification/letter.rb | 1 - .../verification/management/document.rb | 1 - .../verification/management/managed_user.rb | 1 - app/models/verification/residence.rb | 1 - app/models/widget/feed.rb | 1 - .../processes/resume_to_xlsx.xlsx.axlsx | 1 - config/environments/test.rb | 1 - config/initializers/acts_as_taggable_on.rb | 4 --- config/initializers/ahoy.rb | 1 - config/initializers/i18n_pluralize.rb | 2 -- config/initializers/vote_extensions.rb | 1 - config/routes.rb | 1 - config/routes/admin.rb | 1 - config/routes/legislation.rb | 1 - config/sitemap.rb | 1 - db/dev_seeds/polls.rb | 3 -- db/dev_seeds/widgets.rb | 1 - doc/api/examples/ruby/example_2.rb | 1 - lib/active_model/dates.rb | 2 -- lib/acts_as_paranoid_aliases.rb | 2 -- lib/census_api.rb | 2 -- lib/census_caller.rb | 1 - lib/comment_tree.rb | 1 - lib/document_parser.rb | 2 -- lib/email_digest.rb | 2 -- lib/evaluation_comment_email.rb | 1 + lib/graph_ql/api_types_creator.rb | 3 -- lib/graph_ql/query_type_creator.rb | 3 -- lib/local_census.rb | 2 -- lib/manager_authenticator.rb | 1 - lib/merged_comment_tree.rb | 1 - lib/remote_census_api.rb | 2 -- .../microsoft/available_locales.rb | 2 -- lib/remote_translations/microsoft/client.rb | 1 - .../microsoft/sentences_parser.rb | 2 -- lib/score_calculator.rb | 2 -- lib/sms_api.rb | 1 - lib/tag_sanitizer.rb | 1 - lib/tasks/budgets.rake | 3 -- lib/tasks/dashboards.rake | 1 - lib/tasks/votes.rake | 2 -- lib/wysiwyg_sanitizer.rb | 1 - .../admin/api/stats_controller_spec.rb | 1 - .../application_controller_spec.rb | 4 --- .../budgets/ballots/lines_controller_spec.rb | 4 --- spec/controllers/comments_controller_spec.rb | 1 - spec/controllers/concerns/has_filters_spec.rb | 1 - spec/controllers/concerns/has_orders_spec.rb | 1 - .../concerns/remotely_translatable_spec.rb | 4 --- spec/controllers/debates_controller_spec.rb | 1 - .../installation_controller_spec.rb | 1 - .../annotations_controller_spec.rb | 3 -- .../legislation/answers_controller_spec.rb | 2 -- .../management/base_controller_spec.rb | 3 -- .../management/sessions_controller_spec.rb | 3 -- .../management/users_controller_spec.rb | 2 -- spec/controllers/pages_controller_spec.rb | 3 -- .../related_contents_controller_spec.rb | 2 -- .../remote_translation_controller_spec.rb | 2 -- .../users/registrations_controller_spec.rb | 4 --- spec/customization_engine_spec.rb | 2 -- spec/factories/votation_type.rb | 1 - spec/features/account_spec.rb | 3 -- spec/features/admin/activity_spec.rb | 1 - .../admin/admin_notifications_spec.rb | 1 - spec/features/admin/administrators_spec.rb | 2 -- spec/features/admin/banners_spec.rb | 1 - spec/features/admin/budget_groups_spec.rb | 12 ------- spec/features/admin/budget_headings_spec.rb | 11 ------- .../features/admin/budget_investments_spec.rb | 14 -------- spec/features/admin/budget_phases_spec.rb | 1 - spec/features/admin/budgets_spec.rb | 16 ---------- spec/features/admin/change_log_spec.rb | 1 - spec/features/admin/comments_spec.rb | 2 -- .../dashboard/administrator_tasks_spec.rb | 1 - spec/features/admin/debates_spec.rb | 2 -- spec/features/admin/download_settings_spec.rb | 14 -------- .../admin/emails/emails_download_spec.rb | 2 -- .../features/admin/emails/newsletters_spec.rb | 1 - spec/features/admin/feature_flags_spec.rb | 2 -- spec/features/admin/geozones_spec.rb | 1 - .../admin/hidden_budget_investments_spec.rb | 2 -- spec/features/admin/hidden_proposals_spec.rb | 2 -- spec/features/admin/hidden_users_spec.rb | 2 -- spec/features/admin/homepage/homepage_spec.rb | 6 ---- .../admin/legislation/draft_versions_spec.rb | 4 --- .../admin/legislation/processes_spec.rb | 6 ---- .../admin/legislation/proposals_spec.rb | 3 -- .../admin/legislation/questions_spec.rb | 4 --- .../local_census_records/imports_spec.rb | 1 - .../admin/local_census_records_spec.rb | 1 - spec/features/admin/managers_spec.rb | 1 - .../features/admin/milestone_statuses_spec.rb | 2 -- spec/features/admin/moderators_spec.rb | 1 - spec/features/admin/organizations_spec.rb | 2 -- spec/features/admin/poll/active_polls_spec.rb | 2 -- .../admin/poll/booth_assigments_spec.rb | 4 --- spec/features/admin/poll/booths_spec.rb | 1 - .../admin/poll/officer_assignments_spec.rb | 2 -- spec/features/admin/poll/officers_spec.rb | 1 - spec/features/admin/poll/polls_spec.rb | 11 ------- .../poll/questions/answers/answers_spec.rb | 2 -- .../answers/documents/documents_spec.rb | 2 -- .../questions/answers/images/images_spec.rb | 2 -- .../questions/answers/videos/videos_spec.rb | 2 -- spec/features/admin/poll/questions_spec.rb | 3 -- spec/features/admin/poll/shifts_spec.rb | 2 -- .../admin/proposal_notifications_spec.rb | 2 -- spec/features/admin/proposals_spec.rb | 4 --- spec/features/admin/settings_spec.rb | 12 ------- spec/features/admin/signature_sheets_spec.rb | 5 --- .../site_customization/content_blocks_spec.rb | 1 - .../site_customization/documents_spec.rb | 2 -- .../admin/site_customization/images_spec.rb | 1 - .../information_texts_spec.rb | 3 -- .../admin/site_customization/pages_spec.rb | 3 -- spec/features/admin/stats_spec.rb | 18 ----------- spec/features/admin/system_emails_spec.rb | 11 ------- spec/features/admin/tags_spec.rb | 2 -- spec/features/admin/valuator_groups_spec.rb | 3 -- spec/features/admin/valuators_spec.rb | 2 -- spec/features/admin/verifications_spec.rb | 2 -- spec/features/admin/widgets/cards_spec.rb | 4 --- spec/features/admin_spec.rb | 1 - spec/features/banners_spec.rb | 1 - .../budget_polls/ballot_sheets_spec.rb | 10 ------ spec/features/budget_polls/budgets_spec.rb | 6 ---- spec/features/budget_polls/officing_spec.rb | 2 -- spec/features/budget_polls/polls_spec.rb | 5 --- spec/features/budget_polls/questions_spec.rb | 2 -- spec/features/budget_polls/voter_spec.rb | 1 - spec/features/budgets/ballots_spec.rb | 14 -------- spec/features/budgets/budgets_spec.rb | 13 -------- spec/features/budgets/executions_spec.rb | 7 ---- spec/features/budgets/groups_spec.rb | 3 -- spec/features/budgets/investments_spec.rb | 31 ------------------ spec/features/budgets/results_spec.rb | 2 -- spec/features/budgets/stats_spec.rb | 3 -- spec/features/budgets/votes_spec.rb | 4 --- spec/features/campaigns_spec.rb | 1 - spec/features/ckeditor_spec.rb | 2 -- .../comments/budget_investments_spec.rb | 4 --- .../budget_investments_valuation_spec.rb | 2 -- spec/features/comments/debates_spec.rb | 2 -- .../comments/legislation_annotations_spec.rb | 3 -- .../comments/legislation_questions_spec.rb | 4 --- spec/features/comments/polls_spec.rb | 3 -- spec/features/comments/proposals_spec.rb | 2 -- spec/features/comments/topics_spec.rb | 4 --- spec/features/communities_spec.rb | 3 -- spec/features/dashboard/dashboard_spec.rb | 2 -- spec/features/debates_spec.rb | 16 ---------- spec/features/direct_messages_spec.rb | 6 ---- spec/features/emails_spec.rb | 15 --------- spec/features/help_page_spec.rb | 2 -- spec/features/home_spec.rb | 6 ---- .../legislation/draft_versions_spec.rb | 2 -- spec/features/legislation/processes_spec.rb | 3 -- spec/features/legislation/proposals_spec.rb | 1 - spec/features/legislation/resume_spec.rb | 5 --- spec/features/localization_spec.rb | 3 -- spec/features/management/account_spec.rb | 2 -- .../management/budget_investments_spec.rb | 8 ----- .../management/document_verifications_spec.rb | 14 -------- .../management/email_verifications_spec.rb | 2 -- spec/features/management/localization_spec.rb | 1 - .../features/management/managed_users_spec.rb | 3 -- spec/features/management/proposals_spec.rb | 5 --- spec/features/management/users_spec.rb | 2 -- .../moderation/budget_investments_spec.rb | 4 --- spec/features/moderation/comments_spec.rb | 2 -- spec/features/moderation/debates_spec.rb | 2 -- .../moderation/legislation_proposals_spec.rb | 1 - .../moderation/proposal_notifications_spec.rb | 2 -- spec/features/moderation/proposals_spec.rb | 2 -- spec/features/moderation/users_spec.rb | 2 -- spec/features/notifications_spec.rb | 3 -- spec/features/official_positions_spec.rb | 3 -- spec/features/officing/booth_spec.rb | 2 -- spec/features/officing/residence_spec.rb | 9 ------ spec/features/officing/results_spec.rb | 1 - spec/features/officing/voters_spec.rb | 2 -- spec/features/organizations_spec.rb | 1 - spec/features/polls/answers_spec.rb | 3 -- spec/features/polls/polls_spec.rb | 5 --- spec/features/polls/questions_spec.rb | 1 - spec/features/polls/votation_type_spec.rb | 9 ------ spec/features/polls/voter_spec.rb | 4 --- spec/features/proposal_ballots_spec.rb | 2 -- spec/features/proposal_notifications_spec.rb | 9 ------ spec/features/proposals_spec.rb | 27 ---------------- spec/features/registration_form_spec.rb | 2 -- spec/features/remote_translations_spec.rb | 6 ---- spec/features/sessions_spec.rb | 2 -- .../site_customization/custom_pages_spec.rb | 1 - .../information_texts_spec.rb | 1 - spec/features/social_media_meta_tags_spec.rb | 4 --- spec/features/stats_spec.rb | 4 --- spec/features/tags/budget_investments_spec.rb | 8 ----- spec/features/tags/debates_spec.rb | 5 --- spec/features/tags/proposals_spec.rb | 6 ---- spec/features/tags_spec.rb | 4 --- spec/features/topics_spec.rb | 12 ------- .../tracking/budget_investments_spec.rb | 10 ------ spec/features/tracking/budgets_spec.rb | 3 -- spec/features/tracks_spec.rb | 2 -- spec/features/user_invites_spec.rb | 2 -- spec/features/users_auth_spec.rb | 8 ----- spec/features/users_spec.rb | 7 ---- .../valuation/budget_investments_spec.rb | 3 -- spec/features/valuation/budgets_spec.rb | 3 -- spec/features/valuation_spec.rb | 1 - spec/features/verification/email_spec.rb | 1 - spec/features/verification/letter_spec.rb | 3 -- .../level_two_verification_spec.rb | 2 -- spec/features/verification/residence_spec.rb | 1 - spec/features/verification/sms_spec.rb | 2 -- .../verification/verification_path_spec.rb | 2 -- .../verification/verified_user_spec.rb | 2 -- spec/features/votes_spec.rb | 4 --- spec/features/welcome_spec.rb | 4 --- spec/helpers/admin_helper_spec.rb | 4 --- spec/helpers/application_helper_spec.rb | 2 -- .../helpers/budget_investments_helper_spec.rb | 3 -- spec/helpers/comments_helper_spec.rb | 2 -- spec/helpers/geozones_helper_spec.rb | 2 -- spec/helpers/locales_helper_spec.rb | 3 -- spec/helpers/proposals_helper_spec.rb | 3 -- spec/helpers/settings_helper_spec.rb | 4 --- spec/helpers/signature_sheets_helper_spec.rb | 6 ---- spec/helpers/text_helper_spec.rb | 2 -- spec/helpers/users_helper_spec.rb | 2 -- spec/helpers/verification_helper_spec.rb | 2 -- spec/helpers/votes_helper_spec.rb | 2 -- spec/i18n_spec.rb | 1 - spec/lib/acts_as_paranoid_aliases_spec.rb | 2 -- spec/lib/acts_as_taggable_on_spec.rb | 4 --- spec/lib/admin_wysiwyg_sanitizer_spec.rb | 2 -- spec/lib/cache_spec.rb | 2 -- spec/lib/census_api_spec.rb | 1 - spec/lib/document_parser_spec.rb | 2 -- spec/lib/email_digests_spec.rb | 9 ------ spec/lib/evaluation_comment_email_spec.rb | 2 -- spec/lib/graphql_spec.rb | 8 ----- spec/lib/local_census_spec.rb | 1 - spec/lib/remote_census_api_spec.rb | 7 ---- spec/lib/remote_translations/caller_spec.rb | 5 --- .../microsoft/client_spec.rb | 7 ---- spec/lib/reply_email_spec.rb | 3 -- spec/lib/tag_sanitizer_spec.rb | 2 -- spec/lib/tasks/budgets_spec.rb | 1 - spec/lib/tasks/dashboards_spec.rb | 6 ---- spec/lib/user_segments_spec.rb | 1 - spec/lib/wysiwyg_sanitizer_spec.rb | 3 -- spec/mailers/dashboard/mailer_spec.rb | 5 --- spec/models/abilities/common_spec.rb | 1 - spec/models/activity_spec.rb | 2 -- spec/models/admin_notification_spec.rb | 1 - spec/models/administrator_spec.rb | 2 -- spec/models/banner_spec.rb | 2 -- spec/models/budget/ballot/line_spec.rb | 7 ---- spec/models/budget/ballot_spec.rb | 6 ---- spec/models/budget/group_spec.rb | 2 -- spec/models/budget/heading_spec.rb | 7 ---- spec/models/budget/investment_spec.rb | 26 --------------- spec/models/budget/phase_spec.rb | 1 - spec/models/budget/reclassified_vote_spec.rb | 2 -- spec/models/budget/result_spec.rb | 1 - spec/models/budget_spec.rb | 5 --- spec/models/comment_spec.rb | 3 -- spec/models/community_spec.rb | 2 -- spec/models/concerns/sluggable.rb | 1 - .../custom/verification/residence_spec.rb | 4 --- spec/models/dashboard/action_spec.rb | 6 ---- spec/models/debate_spec.rb | 19 ----------- spec/models/direct_message_spec.rb | 4 --- spec/models/direct_upload_spec.rb | 7 ---- spec/models/document_spec.rb | 1 - spec/models/flag_spec.rb | 3 -- spec/models/follow_spec.rb | 2 -- spec/models/image_spec.rb | 2 -- .../legislation/people_proposals_spec.rb | 1 - spec/models/legislation/process/phase_spec.rb | 2 -- spec/models/legislation/process_spec.rb | 4 --- spec/models/legislation/proposal_spec.rb | 1 - spec/models/legislation/question_spec.rb | 1 - .../local_census_records/import_spec.rb | 1 - spec/models/lock_spec.rb | 2 -- spec/models/map_location_spec.rb | 3 -- spec/models/milestone/status_spec.rb | 1 - spec/models/newsletter_spec.rb | 2 -- spec/models/notification_spec.rb | 7 ---- spec/models/officing/residence_spec.rb | 6 ---- spec/models/organization_spec.rb | 1 - spec/models/poll/answer_spec.rb | 4 --- spec/models/poll/ballot_sheet_spec.rb | 4 --- spec/models/poll/ballot_spec.rb | 5 --- spec/models/poll/booth_spec.rb | 2 -- spec/models/poll/officer_spec.rb | 1 - spec/models/poll/pair_answer_spec.rb | 8 ----- spec/models/poll/partial_result_spec.rb | 2 -- spec/models/poll/poll_spec.rb | 6 ---- spec/models/poll/question_spec.rb | 4 --- spec/models/poll/recount_spec.rb | 2 -- spec/models/poll/shift_spec.rb | 5 --- spec/models/poll/voter_spec.rb | 5 --- spec/models/proposal_notification_spec.rb | 11 ------- spec/models/proposal_spec.rb | 32 ------------------- spec/models/related_content_spec.rb | 2 -- spec/models/remote_translation_spec.rb | 3 -- spec/models/setting_spec.rb | 2 -- spec/models/signature_sheet_spec.rb | 6 ---- spec/models/signature_spec.rb | 15 --------- spec/models/tag_cloud_spec.rb | 3 -- spec/models/tag_spec.rb | 1 - spec/models/topic_spec.rb | 2 -- spec/models/user_spec.rb | 17 ---------- spec/models/valuator_group_spec.rb | 1 - spec/models/valuator_spec.rb | 3 -- spec/models/verification/letter_spec.rb | 7 ---- .../verification/management/document_spec.rb | 5 --- .../verification/management/email_spec.rb | 1 - spec/models/verification/residence_spec.rb | 6 ---- spec/models/verification/sms_spec.rb | 1 - spec/models/vote_spec.rb | 1 - spec/models/widget/card_spec.rb | 3 -- spec/models/widget/feed_spec.rb | 8 ----- spec/shared/features/documentable.rb | 7 ---- spec/shared/features/followable.rb | 3 -- spec/shared/features/imageable.rb | 2 -- spec/shared/features/imageable_destroy.rb | 3 -- spec/shared/features/mappable.rb | 8 ----- spec/shared/features/nested_documentable.rb | 3 -- spec/shared/features/nested_imageable.rb | 3 -- spec/shared/features/notifiable_in_app.rb | 3 -- spec/shared/features/relationable.rb | 2 -- spec/shared/features/remotely_translatable.rb | 17 ---------- spec/shared/models/acts_as_imageable.rb | 7 ---- spec/shared/models/acts_as_paranoid.rb | 1 - spec/shared/models/document_validations.rb | 1 - spec/shared/models/image_validations.rb | 1 - spec/shared/models/map_validations.rb | 6 ---- spec/shared/models/notifiable.rb | 8 ----- spec/support/common_actions/budgets.rb | 1 - spec/support/verifiable.rb | 2 -- spec/views/welcome/index.html.erb_spec.rb | 4 --- 585 files changed, 24 insertions(+), 1645 deletions(-) diff --git a/.rubocop_basic.yml b/.rubocop_basic.yml index 94d7c4916..f9dc1ecbd 100644 --- a/.rubocop_basic.yml +++ b/.rubocop_basic.yml @@ -31,6 +31,24 @@ Capybara/FeatureMethods: FactoryBot/AttributeDefinedStatically: Enabled: true +Layout/EmptyLineBetweenDefs: + Enabled: true + +Layout/EmptyLinesAroundAccessModifier: + Enabled: true + +Layout/EmptyLinesAroundBlockBody: + Enabled: true + +Layout/EmptyLinesAroundClassBody: + Enabled: true + +Layout/EmptyLinesAroundMethodBody: + Enabled: true + +Layout/EmptyLinesAroundModuleBody: + Enabled: true + Layout/IndentationConsistency: EnforcedStyle: indented_internal_methods diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index a82017f16..48acfb043 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -32,5 +32,4 @@ class AccountController < ApplicationController end params.require(:account).permit(*attributes) end - end diff --git a/app/controllers/admin/activity_controller.rb b/app/controllers/admin/activity_controller.rb index 44357c5fb..5cb86abc5 100644 --- a/app/controllers/admin/activity_controller.rb +++ b/app/controllers/admin/activity_controller.rb @@ -5,5 +5,4 @@ class Admin::ActivityController < Admin::BaseController @activity = Activity.for_render.send(@current_filter) .order(created_at: :desc).page(params[:page]) end - end diff --git a/app/controllers/admin/api/stats_controller.rb b/app/controllers/admin/api/stats_controller.rb index b336965ee..e13fe7ebf 100644 --- a/app/controllers/admin/api/stats_controller.rb +++ b/app/controllers/admin/api/stats_controller.rb @@ -1,5 +1,4 @@ class Admin::Api::StatsController < Admin::Api::BaseController - def show unless params[:event].present? || params[:visits].present? || diff --git a/app/controllers/admin/base_controller.rb b/app/controllers/admin/base_controller.rb index 569dfbe0c..633668e7a 100644 --- a/app/controllers/admin/base_controller.rb +++ b/app/controllers/admin/base_controller.rb @@ -10,5 +10,4 @@ class Admin::BaseController < ApplicationController def verify_administrator raise CanCan::AccessDenied unless current_user&.administrator? end - end diff --git a/app/controllers/admin/budget_groups_controller.rb b/app/controllers/admin/budget_groups_controller.rb index 5256aa3bc..1a19d5296 100644 --- a/app/controllers/admin/budget_groups_controller.rb +++ b/app/controllers/admin/budget_groups_controller.rb @@ -61,5 +61,4 @@ class Admin::BudgetGroupsController < Admin::BaseController valid_attributes = [:max_votable_headings] params.require(:budget_group).permit(*valid_attributes, translation_params(Budget::Group)) end - end diff --git a/app/controllers/admin/budget_headings_controller.rb b/app/controllers/admin/budget_headings_controller.rb index 399407524..3dd8ab33c 100644 --- a/app/controllers/admin/budget_headings_controller.rb +++ b/app/controllers/admin/budget_headings_controller.rb @@ -66,5 +66,4 @@ class Admin::BudgetHeadingsController < Admin::BaseController valid_attributes = [:price, :population, :allow_custom_content, :latitude, :longitude] params.require(:budget_heading).permit(*valid_attributes, translation_params(Budget::Heading)) end - end diff --git a/app/controllers/admin/budget_phases_controller.rb b/app/controllers/admin/budget_phases_controller.rb index 0979e852f..1ff8dcedb 100644 --- a/app/controllers/admin/budget_phases_controller.rb +++ b/app/controllers/admin/budget_phases_controller.rb @@ -25,5 +25,4 @@ class Admin::BudgetPhasesController < Admin::BaseController valid_attributes = [:starts_at, :ends_at, :enabled] params.require(:budget_phase).permit(*valid_attributes, translation_params(Budget::Phase)) end - end diff --git a/app/controllers/admin/budgets_controller.rb b/app/controllers/admin/budgets_controller.rb index ccd35d547..7fe4f1555 100644 --- a/app/controllers/admin/budgets_controller.rb +++ b/app/controllers/admin/budgets_controller.rb @@ -109,5 +109,4 @@ class Admin::BudgetsController < Admin::BaseController def load_valuators @valuators = Valuator.includes(:user).all.order(description: :asc).order("users.email ASC") end - end diff --git a/app/controllers/admin/comments_controller.rb b/app/controllers/admin/comments_controller.rb index 37f66f727..5a96634d3 100644 --- a/app/controllers/admin/comments_controller.rb +++ b/app/controllers/admin/comments_controller.rb @@ -1,5 +1,4 @@ class Admin::CommentsController < Admin::BaseController - include DownloadSettingsHelper def index @@ -16,5 +15,4 @@ class Admin::CommentsController < Admin::BaseController end end end - end diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb index f7aa5c440..311d07713 100644 --- a/app/controllers/admin/dashboard_controller.rb +++ b/app/controllers/admin/dashboard_controller.rb @@ -1,6 +1,4 @@ class Admin::DashboardController < Admin::BaseController - def index end - end diff --git a/app/controllers/admin/debates_controller.rb b/app/controllers/admin/debates_controller.rb index 05fee888a..b119d26e4 100644 --- a/app/controllers/admin/debates_controller.rb +++ b/app/controllers/admin/debates_controller.rb @@ -16,5 +16,4 @@ class Admin::DebatesController < Admin::BaseController def resource_model Debate end - end diff --git a/app/controllers/admin/geozones_controller.rb b/app/controllers/admin/geozones_controller.rb index 31ce38bed..6e3b0843a 100644 --- a/app/controllers/admin/geozones_controller.rb +++ b/app/controllers/admin/geozones_controller.rb @@ -1,5 +1,4 @@ class Admin::GeozonesController < Admin::BaseController - respond_to :html load_and_authorize_resource diff --git a/app/controllers/admin/hidden_budget_investments_controller.rb b/app/controllers/admin/hidden_budget_investments_controller.rb index 08b95dffc..c55ab3ef6 100644 --- a/app/controllers/admin/hidden_budget_investments_controller.rb +++ b/app/controllers/admin/hidden_budget_investments_controller.rb @@ -30,5 +30,4 @@ class Admin::HiddenBudgetInvestmentsController < Admin::BaseController def load_investment @investment = Budget::Investment.with_hidden.find(params[:id]) end - end diff --git a/app/controllers/admin/hidden_comments_controller.rb b/app/controllers/admin/hidden_comments_controller.rb index e17926b36..b3f64688f 100644 --- a/app/controllers/admin/hidden_comments_controller.rb +++ b/app/controllers/admin/hidden_comments_controller.rb @@ -25,5 +25,4 @@ class Admin::HiddenCommentsController < Admin::BaseController def load_comment @comment = Comment.not_valuations.with_hidden.find(params[:id]) end - end diff --git a/app/controllers/admin/hidden_debates_controller.rb b/app/controllers/admin/hidden_debates_controller.rb index 84374f63c..de9610972 100644 --- a/app/controllers/admin/hidden_debates_controller.rb +++ b/app/controllers/admin/hidden_debates_controller.rb @@ -28,5 +28,4 @@ class Admin::HiddenDebatesController < Admin::BaseController def load_debate @debate = Debate.with_hidden.find(params[:id]) end - end diff --git a/app/controllers/admin/hidden_proposals_controller.rb b/app/controllers/admin/hidden_proposals_controller.rb index 7442c0626..9dea18a07 100644 --- a/app/controllers/admin/hidden_proposals_controller.rb +++ b/app/controllers/admin/hidden_proposals_controller.rb @@ -29,5 +29,4 @@ class Admin::HiddenProposalsController < Admin::BaseController def load_proposal @proposal = Proposal.with_hidden.find(params[:id]) end - end diff --git a/app/controllers/admin/hidden_users_controller.rb b/app/controllers/admin/hidden_users_controller.rb index 6035d5804..31578c94e 100644 --- a/app/controllers/admin/hidden_users_controller.rb +++ b/app/controllers/admin/hidden_users_controller.rb @@ -29,5 +29,4 @@ class Admin::HiddenUsersController < Admin::BaseController def load_user @user = User.with_hidden.find(params[:id]) end - end diff --git a/app/controllers/admin/homepage_controller.rb b/app/controllers/admin/homepage_controller.rb index 4c70827d4..e6d5b4aed 100644 --- a/app/controllers/admin/homepage_controller.rb +++ b/app/controllers/admin/homepage_controller.rb @@ -1,5 +1,4 @@ class Admin::HomepageController < Admin::BaseController - def show load_header load_feeds @@ -24,5 +23,4 @@ class Admin::HomepageController < Admin::BaseController def load_feeds @feeds = Widget::Feed.order("created_at") end - end diff --git a/app/controllers/admin/legislation/base_controller.rb b/app/controllers/admin/legislation/base_controller.rb index b6c62f426..22badf745 100644 --- a/app/controllers/admin/legislation/base_controller.rb +++ b/app/controllers/admin/legislation/base_controller.rb @@ -10,5 +10,4 @@ class Admin::Legislation::BaseController < Admin::BaseController def namespace "admin" end - end diff --git a/app/controllers/admin/legislation/proposals_controller.rb b/app/controllers/admin/legislation/proposals_controller.rb index 44a1dd192..c2711aa99 100644 --- a/app/controllers/admin/legislation/proposals_controller.rb +++ b/app/controllers/admin/legislation/proposals_controller.rb @@ -1,5 +1,4 @@ class Admin::Legislation::ProposalsController < Admin::Legislation::BaseController - has_orders %w[id title supports], only: :index load_and_authorize_resource :process, class: "Legislation::Process" diff --git a/app/controllers/admin/local_census_records/base_controller.rb b/app/controllers/admin/local_census_records/base_controller.rb index bcc2e382a..a506e0cdf 100644 --- a/app/controllers/admin/local_census_records/base_controller.rb +++ b/app/controllers/admin/local_census_records/base_controller.rb @@ -6,5 +6,4 @@ class Admin::LocalCensusRecords::BaseController < Admin::BaseController def namespace "admin" end - end diff --git a/app/controllers/admin/milestone_statuses_controller.rb b/app/controllers/admin/milestone_statuses_controller.rb index ccffa6669..f4defb2b3 100644 --- a/app/controllers/admin/milestone_statuses_controller.rb +++ b/app/controllers/admin/milestone_statuses_controller.rb @@ -1,5 +1,4 @@ class Admin::MilestoneStatusesController < Admin::BaseController - before_action :load_status, only: [:edit, :update, :destroy] def index diff --git a/app/controllers/admin/newsletters_controller.rb b/app/controllers/admin/newsletters_controller.rb index ab5dc227e..3b9887160 100644 --- a/app/controllers/admin/newsletters_controller.rb +++ b/app/controllers/admin/newsletters_controller.rb @@ -1,5 +1,4 @@ class Admin::NewslettersController < Admin::BaseController - def index @newsletters = Newsletter.all end diff --git a/app/controllers/admin/officials_controller.rb b/app/controllers/admin/officials_controller.rb index 0b21b8533..1b96a9365 100644 --- a/app/controllers/admin/officials_controller.rb +++ b/app/controllers/admin/officials_controller.rb @@ -1,5 +1,4 @@ class Admin::OfficialsController < Admin::BaseController - def index @officials = User.officials.page(params[:page]).for_render end @@ -29,5 +28,4 @@ class Admin::OfficialsController < Admin::BaseController def user_params params.require(:user).permit(:official_position, :official_level) end - end diff --git a/app/controllers/admin/organizations_controller.rb b/app/controllers/admin/organizations_controller.rb index 117d7037a..a001e6875 100644 --- a/app/controllers/admin/organizations_controller.rb +++ b/app/controllers/admin/organizations_controller.rb @@ -26,5 +26,4 @@ class Admin::OrganizationsController < Admin::BaseController @organization.reject redirect_to request.query_parameters.merge(action: :index) end - end diff --git a/app/controllers/admin/poll/active_polls_controller.rb b/app/controllers/admin/poll/active_polls_controller.rb index 5dbc5cff7..02a8c97dc 100644 --- a/app/controllers/admin/poll/active_polls_controller.rb +++ b/app/controllers/admin/poll/active_polls_controller.rb @@ -31,5 +31,4 @@ class Admin::Poll::ActivePollsController < Admin::Poll::BaseController def active_poll_params params.require(:active_poll).permit(translation_params(ActivePoll)) end - end diff --git a/app/controllers/admin/poll/base_controller.rb b/app/controllers/admin/poll/base_controller.rb index c58e4f23c..47b2f2b5f 100644 --- a/app/controllers/admin/poll/base_controller.rb +++ b/app/controllers/admin/poll/base_controller.rb @@ -6,5 +6,4 @@ class Admin::Poll::BaseController < Admin::BaseController def namespace "admin" end - end diff --git a/app/controllers/admin/poll/booth_assignments_controller.rb b/app/controllers/admin/poll/booth_assignments_controller.rb index d932bd806..a784c5bd9 100644 --- a/app/controllers/admin/poll/booth_assignments_controller.rb +++ b/app/controllers/admin/poll/booth_assignments_controller.rb @@ -1,5 +1,4 @@ class Admin::Poll::BoothAssignmentsController < Admin::Poll::BaseController - before_action :load_poll, except: [:create, :destroy] def index @@ -74,5 +73,4 @@ class Admin::Poll::BoothAssignmentsController < Admin::Poll::BaseController def load_search @search = search_params[:search] end - end diff --git a/app/controllers/admin/poll/booths_controller.rb b/app/controllers/admin/poll/booths_controller.rb index 9f80a0de4..d9101eac7 100644 --- a/app/controllers/admin/poll/booths_controller.rb +++ b/app/controllers/admin/poll/booths_controller.rb @@ -41,5 +41,4 @@ class Admin::Poll::BoothsController < Admin::Poll::BaseController def booth_params params.require(:poll_booth).permit(:name, :location) end - end diff --git a/app/controllers/admin/poll/officer_assignments_controller.rb b/app/controllers/admin/poll/officer_assignments_controller.rb index b23795d52..8b3d21e0c 100644 --- a/app/controllers/admin/poll/officer_assignments_controller.rb +++ b/app/controllers/admin/poll/officer_assignments_controller.rb @@ -1,5 +1,4 @@ class Admin::Poll::OfficerAssignmentsController < Admin::Poll::BaseController - before_action :load_poll before_action :redirect_if_blank_required_params, only: [:by_officer] before_action :load_booth_assignment, only: [:create] @@ -66,5 +65,4 @@ class Admin::Poll::OfficerAssignmentsController < Admin::Poll::BaseController def load_search @search = search_params[:search] end - end diff --git a/app/controllers/admin/poll/officers_controller.rb b/app/controllers/admin/poll/officers_controller.rb index e0fc47189..9cf752126 100644 --- a/app/controllers/admin/poll/officers_controller.rb +++ b/app/controllers/admin/poll/officers_controller.rb @@ -29,5 +29,4 @@ class Admin::Poll::OfficersController < Admin::Poll::BaseController @officer.destroy! redirect_to admin_officers_path end - end diff --git a/app/controllers/admin/poll/shifts_controller.rb b/app/controllers/admin/poll/shifts_controller.rb index acfc7371a..c85d9064a 100644 --- a/app/controllers/admin/poll/shifts_controller.rb +++ b/app/controllers/admin/poll/shifts_controller.rb @@ -1,5 +1,4 @@ class Admin::Poll::ShiftsController < Admin::Poll::BaseController - before_action :load_booth before_action :load_officer diff --git a/app/controllers/admin/proposal_notifications_controller.rb b/app/controllers/admin/proposal_notifications_controller.rb index f83cb1580..a591eef83 100644 --- a/app/controllers/admin/proposal_notifications_controller.rb +++ b/app/controllers/admin/proposal_notifications_controller.rb @@ -1,5 +1,4 @@ class Admin::ProposalNotificationsController < Admin::BaseController - has_filters %w[without_confirmed_hide all with_confirmed_hide], only: :index before_action :load_proposal, only: [:confirm_hide, :restore] @@ -28,5 +27,4 @@ class Admin::ProposalNotificationsController < Admin::BaseController def load_proposal @proposal_notification = ProposalNotification.with_hidden.find(params[:id]) end - end diff --git a/app/controllers/admin/proposals_controller.rb b/app/controllers/admin/proposals_controller.rb index f764761c6..2ff35428e 100644 --- a/app/controllers/admin/proposals_controller.rb +++ b/app/controllers/admin/proposals_controller.rb @@ -38,5 +38,4 @@ class Admin::ProposalsController < Admin::BaseController def proposal_params params.require(:proposal).permit(:selected) end - end diff --git a/app/controllers/admin/signature_sheets_controller.rb b/app/controllers/admin/signature_sheets_controller.rb index a8201b0e4..354d073ee 100644 --- a/app/controllers/admin/signature_sheets_controller.rb +++ b/app/controllers/admin/signature_sheets_controller.rb @@ -1,5 +1,4 @@ class Admin::SignatureSheetsController < Admin::BaseController - def index @signature_sheets = SignatureSheet.all.order(created_at: :desc) end @@ -29,5 +28,4 @@ class Admin::SignatureSheetsController < Admin::BaseController def signature_sheet_params params.require(:signature_sheet).permit(:signable_type, :signable_id, :required_fields_to_verify) end - end diff --git a/app/controllers/admin/site_customization/base_controller.rb b/app/controllers/admin/site_customization/base_controller.rb index 18422f66e..fb3dcccc7 100644 --- a/app/controllers/admin/site_customization/base_controller.rb +++ b/app/controllers/admin/site_customization/base_controller.rb @@ -6,5 +6,4 @@ class Admin::SiteCustomization::BaseController < Admin::BaseController def namespace "admin" end - end diff --git a/app/controllers/admin/site_customization/cards_controller.rb b/app/controllers/admin/site_customization/cards_controller.rb index c0d06018e..f377283fc 100644 --- a/app/controllers/admin/site_customization/cards_controller.rb +++ b/app/controllers/admin/site_customization/cards_controller.rb @@ -5,5 +5,4 @@ class Admin::SiteCustomization::CardsController < Admin::SiteCustomization::Base @page = ::SiteCustomization::Page.find(params[:page_id]) @cards = @page.cards end - end diff --git a/app/controllers/admin/site_customization/documents_controller.rb b/app/controllers/admin/site_customization/documents_controller.rb index a8ebbd772..ab1b8bc68 100644 --- a/app/controllers/admin/site_customization/documents_controller.rb +++ b/app/controllers/admin/site_customization/documents_controller.rb @@ -1,5 +1,4 @@ class Admin::SiteCustomization::DocumentsController < Admin::SiteCustomization::BaseController - def index @documents = Document.admin.page(params[:page]) end diff --git a/app/controllers/admin/site_customization/information_texts_controller.rb b/app/controllers/admin/site_customization/information_texts_controller.rb index 2099029bd..6d91ab5fa 100644 --- a/app/controllers/admin/site_customization/information_texts_controller.rb +++ b/app/controllers/admin/site_customization/information_texts_controller.rb @@ -23,7 +23,6 @@ class Admin::SiteCustomization::InformationTextsController < Admin::SiteCustomiz end end end - end redirect_to admin_site_customization_information_texts_path, diff --git a/app/controllers/admin/stats_controller.rb b/app/controllers/admin/stats_controller.rb index 29ff8db6a..94fa1da7f 100644 --- a/app/controllers/admin/stats_controller.rb +++ b/app/controllers/admin/stats_controller.rb @@ -1,5 +1,4 @@ class Admin::StatsController < Admin::BaseController - def show @event_types = Ahoy::Event.pluck(:name).uniq.sort diff --git a/app/controllers/admin/system_emails_controller.rb b/app/controllers/admin/system_emails_controller.rb index f70c4bd53..0baf0970a 100644 --- a/app/controllers/admin/system_emails_controller.rb +++ b/app/controllers/admin/system_emails_controller.rb @@ -1,5 +1,4 @@ class Admin::SystemEmailsController < Admin::BaseController - before_action :load_system_email, only: [:view, :preview_pending, :moderate_pending] def index diff --git a/app/controllers/admin/tags_controller.rb b/app/controllers/admin/tags_controller.rb index eebd93f6d..7c49561c4 100644 --- a/app/controllers/admin/tags_controller.rb +++ b/app/controllers/admin/tags_controller.rb @@ -27,5 +27,4 @@ class Admin::TagsController < Admin::BaseController def find_tag @tag = Tag.category.find(params[:id]) end - end diff --git a/app/controllers/admin/trackers_controller.rb b/app/controllers/admin/trackers_controller.rb index 071e26d12..c244d052f 100644 --- a/app/controllers/admin/trackers_controller.rb +++ b/app/controllers/admin/trackers_controller.rb @@ -45,6 +45,7 @@ class Admin::TrackersController < Admin::BaseController end private + def set_tracker @tracker = Tracker.find(params[:id]) end diff --git a/app/controllers/admin/valuator_groups_controller.rb b/app/controllers/admin/valuator_groups_controller.rb index a21450219..8a58c9e31 100644 --- a/app/controllers/admin/valuator_groups_controller.rb +++ b/app/controllers/admin/valuator_groups_controller.rb @@ -1,5 +1,4 @@ class Admin::ValuatorGroupsController < Admin::BaseController - def index @groups = ValuatorGroup.all.page(params[:page]) end @@ -48,5 +47,4 @@ class Admin::ValuatorGroupsController < Admin::BaseController def group_params params.require(:valuator_group).permit(:name) end - end diff --git a/app/controllers/admin/valuators_controller.rb b/app/controllers/admin/valuators_controller.rb index d44d0d200..fdfaab799 100644 --- a/app/controllers/admin/valuators_controller.rb +++ b/app/controllers/admin/valuators_controller.rb @@ -50,5 +50,4 @@ class Admin::ValuatorsController < Admin::BaseController params.require(:valuator).permit(:user_id, :description, :valuator_group_id, :can_comment, :can_edit_dossier) end - end diff --git a/app/controllers/admin/verifications_controller.rb b/app/controllers/admin/verifications_controller.rb index 8ff249772..939add888 100644 --- a/app/controllers/admin/verifications_controller.rb +++ b/app/controllers/admin/verifications_controller.rb @@ -1,5 +1,4 @@ class Admin::VerificationsController < Admin::BaseController - def index @users = User.incomplete_verification.page(params[:page]) end @@ -10,5 +9,4 @@ class Admin::VerificationsController < Admin::BaseController .for_render render :index end - end diff --git a/app/controllers/admin/widget/base_controller.rb b/app/controllers/admin/widget/base_controller.rb index 1f9aeffc4..bc72bf389 100644 --- a/app/controllers/admin/widget/base_controller.rb +++ b/app/controllers/admin/widget/base_controller.rb @@ -6,5 +6,4 @@ class Admin::Widget::BaseController < Admin::BaseController def namespace "admin" end - end diff --git a/app/controllers/admin/widget/feeds_controller.rb b/app/controllers/admin/widget/feeds_controller.rb index 70af52244..0f41ad5d1 100644 --- a/app/controllers/admin/widget/feeds_controller.rb +++ b/app/controllers/admin/widget/feeds_controller.rb @@ -1,5 +1,4 @@ class Admin::Widget::FeedsController < Admin::BaseController - def update @feed = ::Widget::Feed.find(params[:id]) @feed.update!(feed_params) @@ -12,5 +11,4 @@ class Admin::Widget::FeedsController < Admin::BaseController def feed_params params.require(:widget_feed).permit(:limit) end - end diff --git a/app/controllers/budgets/ballot/lines_controller.rb b/app/controllers/budgets/ballot/lines_controller.rb index 242c3848d..58e9c43f4 100644 --- a/app/controllers/budgets/ballot/lines_controller.rb +++ b/app/controllers/budgets/ballot/lines_controller.rb @@ -78,7 +78,6 @@ module Budgets end @map_location = MapLocation.load_from_heading(@heading) end - end end end diff --git a/app/controllers/budgets/ballots_controller.rb b/app/controllers/budgets/ballots_controller.rb index 0a7b1ce03..7015c8285 100644 --- a/app/controllers/budgets/ballots_controller.rb +++ b/app/controllers/budgets/ballots_controller.rb @@ -26,6 +26,5 @@ module Budgets def store_referer session[:ballot_referer] = request.referer end - end end diff --git a/app/controllers/budgets/executions_controller.rb b/app/controllers/budgets/executions_controller.rb index d19094fe4..9e846ac34 100644 --- a/app/controllers/budgets/executions_controller.rb +++ b/app/controllers/budgets/executions_controller.rb @@ -25,6 +25,7 @@ module Budgets end private + def investments_by_heading base = @budget.investments.winners base = base.joins(milestones: :translations).includes(:milestones) diff --git a/app/controllers/budgets/investments_controller.rb b/app/controllers/budgets/investments_controller.rb index 59a1c930e..9728c8ef3 100644 --- a/app/controllers/budgets/investments_controller.rb +++ b/app/controllers/budgets/investments_controller.rb @@ -1,6 +1,5 @@ module Budgets class InvestmentsController < ApplicationController - include FeatureFlags include CommentableActions include FlagActions @@ -187,7 +186,5 @@ module Budgets def load_map @map_location = MapLocation.load_from_heading(@heading) end - end - end diff --git a/app/controllers/budgets/results_controller.rb b/app/controllers/budgets/results_controller.rb index b55a9d841..d7e6eb320 100644 --- a/app/controllers/budgets/results_controller.rb +++ b/app/controllers/budgets/results_controller.rb @@ -34,6 +34,5 @@ module Budgets @heading = headings.find_by_slug_or_id(params[:heading_id]) || headings.first end end - end end diff --git a/app/controllers/budgets/stats_controller.rb b/app/controllers/budgets/stats_controller.rb index 964974125..0ce61c108 100644 --- a/app/controllers/budgets/stats_controller.rb +++ b/app/controllers/budgets/stats_controller.rb @@ -1,6 +1,5 @@ module Budgets class StatsController < ApplicationController - before_action :load_budget load_and_authorize_resource :budget @@ -15,6 +14,5 @@ module Budgets def load_budget @budget = Budget.find_by_slug_or_id! params[:budget_id] end - end end diff --git a/app/controllers/budgets_controller.rb b/app/controllers/budgets_controller.rb index 19f1e69be..9fb0b0bf6 100644 --- a/app/controllers/budgets_controller.rb +++ b/app/controllers/budgets_controller.rb @@ -25,5 +25,4 @@ class BudgetsController < ApplicationController def load_budget @budget = Budget.find_by_slug_or_id! params[:id] end - end diff --git a/app/controllers/concerns/flag_actions.rb b/app/controllers/concerns/flag_actions.rb index 4662d1ccb..5984c24e0 100644 --- a/app/controllers/concerns/flag_actions.rb +++ b/app/controllers/concerns/flag_actions.rb @@ -30,5 +30,4 @@ module FlagActions instance_variable_get("@#{resource_model.to_s.downcase}") end end - end diff --git a/app/controllers/concerns/image_attributes.rb b/app/controllers/concerns/image_attributes.rb index a46128c4c..f0dd02bfd 100644 --- a/app/controllers/concerns/image_attributes.rb +++ b/app/controllers/concerns/image_attributes.rb @@ -4,5 +4,4 @@ module ImageAttributes def image_attributes [:id, :title, :attachment, :cached_attachment, :user_id, :_destroy] end - end diff --git a/app/controllers/concerns/moderate_actions.rb b/app/controllers/concerns/moderate_actions.rb index 52e0a02cf..b95829740 100644 --- a/app/controllers/concerns/moderate_actions.rb +++ b/app/controllers/concerns/moderate_actions.rb @@ -56,5 +56,4 @@ module ModerateActions def author_id :author_id end - end diff --git a/app/controllers/concerns/polymorphic.rb b/app/controllers/concerns/polymorphic.rb index d69ca25f9..2a5188c26 100644 --- a/app/controllers/concerns/polymorphic.rb +++ b/app/controllers/concerns/polymorphic.rb @@ -1,5 +1,4 @@ module Polymorphic - private def resource @@ -31,5 +30,4 @@ module Polymorphic def strong_params send("#{resource_name}_params") end - end diff --git a/app/controllers/concerns/remotely_translatable.rb b/app/controllers/concerns/remotely_translatable.rb index 4f030ff6c..35662b5fb 100644 --- a/app/controllers/concerns/remotely_translatable.rb +++ b/app/controllers/concerns/remotely_translatable.rb @@ -1,5 +1,4 @@ module RemotelyTranslatable - private def detect_remote_translations(*args) @@ -25,5 +24,4 @@ module RemotelyTranslatable args.compact - [feeds] + feeds.map(&:items) end - end diff --git a/app/controllers/concerns/search.rb b/app/controllers/concerns/search.rb index ff010a76f..51dbb7f67 100644 --- a/app/controllers/concerns/search.rb +++ b/app/controllers/concerns/search.rb @@ -53,5 +53,4 @@ module Search params[:order] = "relevance" end end - end diff --git a/app/controllers/debates_controller.rb b/app/controllers/debates_controller.rb index b83f2ddc2..67ff502d4 100644 --- a/app/controllers/debates_controller.rb +++ b/app/controllers/debates_controller.rb @@ -73,5 +73,4 @@ class DebatesController < ApplicationController @recommended_debates = Debate.recommendations(current_user).sort_by_random.limit(3) end end - end diff --git a/app/controllers/direct_uploads_controller.rb b/app/controllers/direct_uploads_controller.rb index 425c43200..a127967c7 100644 --- a/app/controllers/direct_uploads_controller.rb +++ b/app/controllers/direct_uploads_controller.rb @@ -44,5 +44,4 @@ class DirectUploadsController < ApplicationController .permit(:resource, :resource_type, :resource_id, :resource_relation, :attachment, :cached_attachment, attachment_attributes: []) end - end diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index 1d6df8d14..abb9715d4 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -22,5 +22,4 @@ class DocumentsController < ApplicationController end end end - end diff --git a/app/controllers/follows_controller.rb b/app/controllers/follows_controller.rb index a2e6c924d..325b38fb3 100644 --- a/app/controllers/follows_controller.rb +++ b/app/controllers/follows_controller.rb @@ -24,5 +24,4 @@ class FollowsController < ApplicationController def followable_translation_key(followable) followable.class.name.parameterize(separator: "_") end - end diff --git a/app/controllers/images_controller.rb b/app/controllers/images_controller.rb index e273234f2..665c7ce64 100644 --- a/app/controllers/images_controller.rb +++ b/app/controllers/images_controller.rb @@ -22,5 +22,4 @@ class ImagesController < ApplicationController end end end - end diff --git a/app/controllers/installation_controller.rb b/app/controllers/installation_controller.rb index 4a9174f53..5598085b0 100644 --- a/app/controllers/installation_controller.rb +++ b/app/controllers/installation_controller.rb @@ -1,5 +1,4 @@ class InstallationController < ApplicationController - skip_authorization_check def details @@ -19,5 +18,4 @@ class InstallationController < ApplicationController def settings_feature_flags Setting.where("key LIKE 'feature.%'").each_with_object({}) { |x, n| n[x.key.remove("feature.")] = x.value } end - end diff --git a/app/controllers/legislation/annotations_controller.rb b/app/controllers/legislation/annotations_controller.rb index 9cfaadb94..2dbc68d29 100644 --- a/app/controllers/legislation/annotations_controller.rb +++ b/app/controllers/legislation/annotations_controller.rb @@ -108,5 +108,4 @@ class Legislation::AnnotationsController < Legislation::BaseController end rescue JSON::ParserError end - end diff --git a/app/controllers/legislation/draft_versions_controller.rb b/app/controllers/legislation/draft_versions_controller.rb index 7a19ab094..f2dedc4a0 100644 --- a/app/controllers/legislation/draft_versions_controller.rb +++ b/app/controllers/legislation/draft_versions_controller.rb @@ -36,5 +36,4 @@ class Legislation::DraftVersionsController < Legislation::BaseController @process.draft_versions.published end end - end diff --git a/app/controllers/legislation/proposals_controller.rb b/app/controllers/legislation/proposals_controller.rb index 4db3b0e72..74b9799da 100644 --- a/app/controllers/legislation/proposals_controller.rb +++ b/app/controllers/legislation/proposals_controller.rb @@ -70,5 +70,4 @@ class Legislation::ProposalsController < Legislation::BaseController def load_successful_proposals @proposal_successful_exists = Legislation::Proposal.successful.exists? end - end diff --git a/app/controllers/management/account_controller.rb b/app/controllers/management/account_controller.rb index fc99b25cc..44cb3280c 100644 --- a/app/controllers/management/account_controller.rb +++ b/app/controllers/management/account_controller.rb @@ -1,5 +1,4 @@ class Management::AccountController < Management::BaseController - before_action :only_verified_users def show @@ -30,5 +29,4 @@ class Management::AccountController < Management::BaseController def only_verified_users check_verified_user t("management.account.alert.unverified_user") end - end diff --git a/app/controllers/management/base_controller.rb b/app/controllers/management/base_controller.rb index 78b0f7fc3..a5a6ed593 100644 --- a/app/controllers/management/base_controller.rb +++ b/app/controllers/management/base_controller.rb @@ -61,5 +61,4 @@ class Management::BaseController < ActionController::Base @manager_logged_in = User.find_by_manager_login(session[:manager]["login"]) end end - end diff --git a/app/controllers/management/budgets/investments_controller.rb b/app/controllers/management/budgets/investments_controller.rb index 393e4e888..1108c1997 100644 --- a/app/controllers/management/budgets/investments_controller.rb +++ b/app/controllers/management/budgets/investments_controller.rb @@ -69,5 +69,4 @@ class Management::Budgets::InvestmentsController < Management::BaseController def load_categories @categories = Tag.category.order(:name) end - end diff --git a/app/controllers/management/budgets_controller.rb b/app/controllers/management/budgets_controller.rb index b83d843e2..36f0a8f1d 100644 --- a/app/controllers/management/budgets_controller.rb +++ b/app/controllers/management/budgets_controller.rb @@ -31,5 +31,4 @@ class Management::BudgetsController < Management::BaseController def current_manager_administrator? session[:manager]["login"].match("admin") end - end diff --git a/app/controllers/management/dashboard_controller.rb b/app/controllers/management/dashboard_controller.rb index abb605341..1de5dc72c 100644 --- a/app/controllers/management/dashboard_controller.rb +++ b/app/controllers/management/dashboard_controller.rb @@ -1,6 +1,4 @@ class Management::DashboardController < Management::BaseController - def index end - end diff --git a/app/controllers/management/document_verifications_controller.rb b/app/controllers/management/document_verifications_controller.rb index 5280e6d29..590e7bb11 100644 --- a/app/controllers/management/document_verifications_controller.rb +++ b/app/controllers/management/document_verifications_controller.rb @@ -1,5 +1,4 @@ class Management::DocumentVerificationsController < Management::BaseController - before_action :clean_document_number, only: :check before_action :set_document, only: :check @@ -48,5 +47,4 @@ class Management::DocumentVerificationsController < Management::BaseController return if params[:document_verification][:document_number].blank? params[:document_verification][:document_number] = params[:document_verification][:document_number].gsub(/[^a-z0-9]+/i, "").upcase end - end diff --git a/app/controllers/management/email_verifications_controller.rb b/app/controllers/management/email_verifications_controller.rb index ef304de26..816edd926 100644 --- a/app/controllers/management/email_verifications_controller.rb +++ b/app/controllers/management/email_verifications_controller.rb @@ -1,5 +1,4 @@ class Management::EmailVerificationsController < Management::BaseController - def new @email_verification = Verification::Management::Email.new(email_verification_params) end @@ -19,5 +18,4 @@ class Management::EmailVerificationsController < Management::BaseController def email_verification_params params.require(:email_verification).permit(:document_type, :document_number, :email) end - end diff --git a/app/controllers/management/proposals_controller.rb b/app/controllers/management/proposals_controller.rb index f4176c8c0..d1f8286ab 100644 --- a/app/controllers/management/proposals_controller.rb +++ b/app/controllers/management/proposals_controller.rb @@ -74,5 +74,4 @@ class Management::ProposalsController < Management::BaseController def set_comment_flags(comments) @comment_flags = managed_user ? managed_user.comment_flags(comments) : {} end - end diff --git a/app/controllers/management/sessions_controller.rb b/app/controllers/management/sessions_controller.rb index 066fc6a9f..84d9d1265 100644 --- a/app/controllers/management/sessions_controller.rb +++ b/app/controllers/management/sessions_controller.rb @@ -43,5 +43,4 @@ class Management::SessionsController < ActionController::Base manager = ManagerAuthenticator.new(params).auth session[:manager] = manager if manager.present? end - end diff --git a/app/controllers/management/user_invites_controller.rb b/app/controllers/management/user_invites_controller.rb index cbe3d1914..8b704d0c4 100644 --- a/app/controllers/management/user_invites_controller.rb +++ b/app/controllers/management/user_invites_controller.rb @@ -1,5 +1,4 @@ class Management::UserInvitesController < Management::BaseController - def new end @@ -9,5 +8,4 @@ class Management::UserInvitesController < Management::BaseController Mailer.user_invite(email).deliver_later end end - end diff --git a/app/controllers/management/users_controller.rb b/app/controllers/management/users_controller.rb index 93cb6f9bd..b3d525be5 100644 --- a/app/controllers/management/users_controller.rb +++ b/app/controllers/management/users_controller.rb @@ -1,5 +1,4 @@ class Management::UsersController < Management::BaseController - def new @user = User.new(user_params) end @@ -66,5 +65,4 @@ class Management::UsersController < Management::BaseController def user_with_email @user.skip_password_validation = true end - end diff --git a/app/controllers/moderation/base_controller.rb b/app/controllers/moderation/base_controller.rb index 39d5b19ab..46af9ce1e 100644 --- a/app/controllers/moderation/base_controller.rb +++ b/app/controllers/moderation/base_controller.rb @@ -11,5 +11,4 @@ class Moderation::BaseController < ApplicationController def verify_moderator raise CanCan::AccessDenied unless current_user&.moderator? || current_user&.administrator? end - end diff --git a/app/controllers/moderation/budgets/investments_controller.rb b/app/controllers/moderation/budgets/investments_controller.rb index 8944c78fa..088407bd8 100644 --- a/app/controllers/moderation/budgets/investments_controller.rb +++ b/app/controllers/moderation/budgets/investments_controller.rb @@ -20,5 +20,4 @@ class Moderation::Budgets::InvestmentsController < Moderation::BaseController def resource_model Budget::Investment end - end diff --git a/app/controllers/moderation/dashboard_controller.rb b/app/controllers/moderation/dashboard_controller.rb index ceaddd6f4..420b1b883 100644 --- a/app/controllers/moderation/dashboard_controller.rb +++ b/app/controllers/moderation/dashboard_controller.rb @@ -1,6 +1,4 @@ class Moderation::DashboardController < Moderation::BaseController - def index end - end diff --git a/app/controllers/moderation/debates_controller.rb b/app/controllers/moderation/debates_controller.rb index a85d300d2..bef48d2b6 100644 --- a/app/controllers/moderation/debates_controller.rb +++ b/app/controllers/moderation/debates_controller.rb @@ -16,5 +16,4 @@ class Moderation::DebatesController < Moderation::BaseController def resource_model Debate end - end diff --git a/app/controllers/moderation/users_controller.rb b/app/controllers/moderation/users_controller.rb index 2fdf34437..d0ee29f83 100644 --- a/app/controllers/moderation/users_controller.rb +++ b/app/controllers/moderation/users_controller.rb @@ -1,5 +1,4 @@ class Moderation::UsersController < Moderation::BaseController - before_action :load_users, only: :index load_and_authorize_resource @@ -29,5 +28,4 @@ class Moderation::UsersController < Moderation::BaseController @user.block Activity.log(current_user, :block, @user) end - end diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index ce257ae7d..7510d94bb 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -42,5 +42,4 @@ class NotificationsController < ApplicationController polymorphic_hierarchy_path(notification.linkable_resource) end end - end diff --git a/app/controllers/officing/ballot_sheets_controller.rb b/app/controllers/officing/ballot_sheets_controller.rb index 835e8a23b..ec1d74002 100644 --- a/app/controllers/officing/ballot_sheets_controller.rb +++ b/app/controllers/officing/ballot_sheets_controller.rb @@ -1,5 +1,4 @@ class Officing::BallotSheetsController < Officing::BaseController - before_action :verify_booth before_action :load_poll before_action :load_officer_assignments, only: [:new, :create] @@ -66,5 +65,4 @@ class Officing::BallotSheetsController < Officing::BaseController def ballot_sheet_params params.permit(:data, :poll_id, :officer_assignment_id) end - end diff --git a/app/controllers/officing/booth_controller.rb b/app/controllers/officing/booth_controller.rb index 6da408e67..724c12b64 100644 --- a/app/controllers/officing/booth_controller.rb +++ b/app/controllers/officing/booth_controller.rb @@ -20,5 +20,4 @@ class Officing::BoothController < Officing::BaseController def set_booth(booth) session[:booth_id] = booth.id end - end diff --git a/app/controllers/officing/dashboard_controller.rb b/app/controllers/officing/dashboard_controller.rb index 4d80a974a..ec5292203 100644 --- a/app/controllers/officing/dashboard_controller.rb +++ b/app/controllers/officing/dashboard_controller.rb @@ -1,6 +1,4 @@ class Officing::DashboardController < Officing::BaseController - def index end - end diff --git a/app/controllers/officing/polls_controller.rb b/app/controllers/officing/polls_controller.rb index 69bc9eb64..f1a763776 100644 --- a/app/controllers/officing/polls_controller.rb +++ b/app/controllers/officing/polls_controller.rb @@ -15,5 +15,4 @@ class Officing::PollsController < Officing::BaseController [] end end - end diff --git a/app/controllers/officing/residence_controller.rb b/app/controllers/officing/residence_controller.rb index 38f7e3d9d..39f6c7c56 100644 --- a/app/controllers/officing/residence_controller.rb +++ b/app/controllers/officing/residence_controller.rb @@ -1,5 +1,4 @@ class Officing::ResidenceController < Officing::BaseController - before_action :load_officer_assignment before_action :verify_officer_assignment before_action :verify_booth @@ -23,5 +22,4 @@ class Officing::ResidenceController < Officing::BaseController params.require(:residence).permit(:document_number, :document_type, :year_of_birth, :date_of_birth, :postal_code) end - end diff --git a/app/controllers/officing/results_controller.rb b/app/controllers/officing/results_controller.rb index cba0d6b0b..a85af1fe5 100644 --- a/app/controllers/officing/results_controller.rb +++ b/app/controllers/officing/results_controller.rb @@ -116,5 +116,4 @@ class Officing::ResultsController < Officing::BaseController def index_params params.permit(:booth_assignment_id, :date) end - end diff --git a/app/controllers/officing/voters_controller.rb b/app/controllers/officing/voters_controller.rb index 8ed778b2d..777d88b2f 100644 --- a/app/controllers/officing/voters_controller.rb +++ b/app/controllers/officing/voters_controller.rb @@ -38,5 +38,4 @@ class Officing::VotersController < Officing::BaseController .where(final: false) .first end - end diff --git a/app/controllers/organizations/registrations_controller.rb b/app/controllers/organizations/registrations_controller.rb index 0fd45e9f7..2a770e2da 100644 --- a/app/controllers/organizations/registrations_controller.rb +++ b/app/controllers/organizations/registrations_controller.rb @@ -1,5 +1,4 @@ class Organizations::RegistrationsController < Devise::RegistrationsController - invisible_captcha only: [:create], honeypot: :address, scope: :user def new @@ -35,5 +34,4 @@ class Organizations::RegistrationsController < Devise::RegistrationsController params.require(:user).permit(:email, :password, :phone_number, :password_confirmation, :terms_of_service, organization_attributes: [:name, :responsible_name]) end - end diff --git a/app/controllers/polls/answers_controller.rb b/app/controllers/polls/answers_controller.rb index faa440cd8..3efd7afc7 100644 --- a/app/controllers/polls/answers_controller.rb +++ b/app/controllers/polls/answers_controller.rb @@ -1,5 +1,4 @@ class Polls::AnswersController < ApplicationController - load_and_authorize_resource :poll load_and_authorize_resource :question, class: "Poll::Question" authorize_resource :answer, class: "Poll::Answer" @@ -66,5 +65,4 @@ class Polls::AnswersController < ApplicationController @answers = @question.question_answers.visibles end end - end diff --git a/app/controllers/polls/questions_controller.rb b/app/controllers/polls/questions_controller.rb index 675c6ffa5..49299fd7e 100644 --- a/app/controllers/polls/questions_controller.rb +++ b/app/controllers/polls/questions_controller.rb @@ -1,5 +1,4 @@ class Polls::QuestionsController < ApplicationController - load_and_authorize_resource :poll load_and_authorize_resource :question, class: "Poll::Question" @@ -77,5 +76,4 @@ class Polls::QuestionsController < ApplicationController @answers = @question.question_answers.visibles end end - end diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index dd7fd46b9..16c59c003 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -78,5 +78,4 @@ class PollsController < ApplicationController def generate_and_store_new_pair(question) Poll::PairAnswer.generate_pair(question, current_user) end - end diff --git a/app/controllers/proposal_notifications_controller.rb b/app/controllers/proposal_notifications_controller.rb index 5c81a34ef..8b98b9b41 100644 --- a/app/controllers/proposal_notifications_controller.rb +++ b/app/controllers/proposal_notifications_controller.rb @@ -29,5 +29,4 @@ class ProposalNotificationsController < ApplicationController def proposal_notification_params params.require(:proposal_notification).permit(:title, :body, :proposal_id) end - end diff --git a/app/controllers/remote_translations_controller.rb b/app/controllers/remote_translations_controller.rb index a82f4e9e3..b2cfd6b34 100644 --- a/app/controllers/remote_translations_controller.rb +++ b/app/controllers/remote_translations_controller.rb @@ -28,5 +28,4 @@ class RemoteTranslationsController < ApplicationController def translations_enqueued?(remote_translation) RemoteTranslation.remote_translation_enqueued?(remote_translation) end - end diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index fc9ac5797..6e9ae5495 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -1,5 +1,4 @@ class TagsController < ApplicationController - load_and_authorize_resource respond_to :json @@ -7,5 +6,4 @@ class TagsController < ApplicationController @tags = Tag.search(params[:search]).map(&:name) respond_with @tags end - end diff --git a/app/controllers/tracking/base_controller.rb b/app/controllers/tracking/base_controller.rb index f42ac9f5c..2e459bc7b 100644 --- a/app/controllers/tracking/base_controller.rb +++ b/app/controllers/tracking/base_controller.rb @@ -11,5 +11,4 @@ class Tracking::BaseController < ApplicationController def verify_tracker raise CanCan::AccessDenied unless current_user&.tracker? || current_user&.administrator? end - end diff --git a/app/controllers/tracking/budget_investment_milestones_controller.rb b/app/controllers/tracking/budget_investment_milestones_controller.rb index 3abd27e40..25ad0cab6 100644 --- a/app/controllers/tracking/budget_investment_milestones_controller.rb +++ b/app/controllers/tracking/budget_investment_milestones_controller.rb @@ -1,5 +1,4 @@ class Tracking::BudgetInvestmentMilestonesController < Tracking::MilestonesController - private def milestoneable diff --git a/app/controllers/tracking/budget_investment_progress_bars_controller.rb b/app/controllers/tracking/budget_investment_progress_bars_controller.rb index b949f11f1..c41aab035 100644 --- a/app/controllers/tracking/budget_investment_progress_bars_controller.rb +++ b/app/controllers/tracking/budget_investment_progress_bars_controller.rb @@ -1,5 +1,4 @@ class Tracking::BudgetInvestmentProgressBarsController < Tracking::ProgressBarsController - before_action :restrict_access_to_assigned_items private diff --git a/app/controllers/tracking/budget_investments_controller.rb b/app/controllers/tracking/budget_investments_controller.rb index 88315685c..c6556c085 100644 --- a/app/controllers/tracking/budget_investments_controller.rb +++ b/app/controllers/tracking/budget_investments_controller.rb @@ -77,5 +77,4 @@ class Tracking::BudgetInvestmentsController < Tracking::BaseController def heading_params params.permit(:heading_id) end - end diff --git a/app/controllers/tracking/proposal_milestones_controller.rb b/app/controllers/tracking/proposal_milestones_controller.rb index eb3c294f2..c0507d4bf 100644 --- a/app/controllers/tracking/proposal_milestones_controller.rb +++ b/app/controllers/tracking/proposal_milestones_controller.rb @@ -1,5 +1,4 @@ class Tracking::ProposalMilestonesController < Tracking::MilestonesController - private def milestoneable diff --git a/app/controllers/tracking/proposal_progress_bars_controller.rb b/app/controllers/tracking/proposal_progress_bars_controller.rb index 46d43474a..f402b5b85 100644 --- a/app/controllers/tracking/proposal_progress_bars_controller.rb +++ b/app/controllers/tracking/proposal_progress_bars_controller.rb @@ -1,6 +1,6 @@ class Tracking::ProposalProgressBarsController < Tracking::ProgressBarsController - private + def progressable Proposal.find(params[:proposal_id]) end diff --git a/app/controllers/users/confirmations_controller.rb b/app/controllers/users/confirmations_controller.rb index 553e07743..45f9dddf5 100644 --- a/app/controllers/users/confirmations_controller.rb +++ b/app/controllers/users/confirmations_controller.rb @@ -1,5 +1,4 @@ class Users::ConfirmationsController < Devise::ConfirmationsController - # new action, PATCH does not exist in the default Devise::ConfirmationsController # PATCH /resource/confirmation def update @@ -55,5 +54,4 @@ class Users::ConfirmationsController < Devise::ConfirmationsController def set_official_position resource.add_official_position! (Setting["official_level_1_name"]), 1 end - end diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index 6108ed5ef..66e6811fa 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -1,5 +1,4 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController - def twitter sign_in_with :twitter_login, :twitter end @@ -43,5 +42,4 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController def save_user @user.save || @user.save_requiring_finish_signup end - end diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index 56211a65f..3c2865cc1 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -76,5 +76,4 @@ class Users::RegistrationsController < Devise::RegistrationsController def after_inactive_sign_up_path_for(resource_or_scope) users_sign_up_success_path end - end diff --git a/app/controllers/users/sessions_controller.rb b/app/controllers/users/sessions_controller.rb index d16f9c87e..0ce16a5a4 100644 --- a/app/controllers/users/sessions_controller.rb +++ b/app/controllers/users/sessions_controller.rb @@ -1,5 +1,4 @@ class Users::SessionsController < Devise::SessionsController - private def after_sign_in_path_for(resource) @@ -19,5 +18,4 @@ class Users::SessionsController < Devise::SessionsController stored_path = session[stored_location_key_for(resource)] || "" stored_path[0..5] == "/email" end - end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 690b74f68..fdec3f4bb 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -101,5 +101,4 @@ class UsersController < ApplicationController all_user_comments end end - end diff --git a/app/controllers/valuation/base_controller.rb b/app/controllers/valuation/base_controller.rb index bfb865cbe..85a700f78 100644 --- a/app/controllers/valuation/base_controller.rb +++ b/app/controllers/valuation/base_controller.rb @@ -11,5 +11,4 @@ class Valuation::BaseController < ApplicationController def verify_valuator raise CanCan::AccessDenied unless current_user&.valuator? || current_user&.administrator? end - end diff --git a/app/controllers/valuation/budget_investments_controller.rb b/app/controllers/valuation/budget_investments_controller.rb index 07bcd641a..3c71e904e 100644 --- a/app/controllers/valuation/budget_investments_controller.rb +++ b/app/controllers/valuation/budget_investments_controller.rb @@ -128,5 +128,4 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController @investment.errors.empty? end - end diff --git a/app/controllers/verification/letter_controller.rb b/app/controllers/verification/letter_controller.rb index ce0c9747e..95a4f7661 100644 --- a/app/controllers/verification/letter_controller.rb +++ b/app/controllers/verification/letter_controller.rb @@ -55,5 +55,4 @@ class Verification::LetterController < ApplicationController sign_in(user) end end - end diff --git a/app/controllers/verification/sms_controller.rb b/app/controllers/verification/sms_controller.rb index 3ced3ab87..9dd598acc 100644 --- a/app/controllers/verification/sms_controller.rb +++ b/app/controllers/verification/sms_controller.rb @@ -68,5 +68,4 @@ class Verification::SmsController < ApplicationController redirect_to new_letter_path, notice: t("verification.sms.update.flash.level_two.success") end end - end diff --git a/app/controllers/verification/verified_user_controller.rb b/app/controllers/verification/verified_user_controller.rb index bc55f19f4..4cca4153e 100644 --- a/app/controllers/verification/verified_user_controller.rb +++ b/app/controllers/verification/verified_user_controller.rb @@ -20,5 +20,4 @@ class Verification::VerifiedUserController < ApplicationController data end - end diff --git a/app/controllers/verification_controller.rb b/app/controllers/verification_controller.rb index f4d630130..344f573b5 100644 --- a/app/controllers/verification_controller.rb +++ b/app/controllers/verification_controller.rb @@ -29,5 +29,4 @@ class VerificationController < ApplicationController { path: new_residence_path } end end - end diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index fee05dfd1..4e3081e73 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -37,5 +37,4 @@ class WelcomeController < ApplicationController @recommended_debates = Debate.recommendations(current_user).sort_by_recommendations.limit(3) @recommended_proposals = Proposal.recommendations(current_user).sort_by_recommendations.limit(3) end - end diff --git a/app/helpers/accessibility_helper.rb b/app/helpers/accessibility_helper.rb index a224f9a9b..b53ada9ad 100644 --- a/app/helpers/accessibility_helper.rb +++ b/app/helpers/accessibility_helper.rb @@ -1,7 +1,5 @@ module AccessibilityHelper - def css_for_aria_hidden(reason) reason.present? ? "true" : "" end - end diff --git a/app/helpers/admin_budget_investments_helper.rb b/app/helpers/admin_budget_investments_helper.rb index aa33961aa..e58a709f2 100644 --- a/app/helpers/admin_budget_investments_helper.rb +++ b/app/helpers/admin_budget_investments_helper.rb @@ -1,5 +1,4 @@ module AdminBudgetInvestmentsHelper - def advanced_menu_visibility if params[:advanced_filters].empty? && params["min_total_supports"].blank? && @@ -13,5 +12,4 @@ module AdminBudgetInvestmentsHelper def init_advanced_menu params[:advanced_filters] = [] unless params[:advanced_filters] end - end diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index 9f3a21c7e..96d1e9e48 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -1,5 +1,4 @@ module AdminHelper - def side_menu if namespace == "moderation/budgets" render "/moderation/menu" @@ -114,5 +113,4 @@ module AdminHelper def namespace controller.class.name.downcase.split("::").first end - end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index cb4fb879c..411b30827 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,5 +1,4 @@ module ApplicationHelper - def home_page? return false if user_signed_in? # Using path because fullpath yields false negatives since it contains @@ -76,5 +75,4 @@ module ApplicationHelper def management_controller? controller.class.to_s.include?("Management") end - end diff --git a/app/helpers/ballots_helper.rb b/app/helpers/ballots_helper.rb index e29010230..c6fde9c57 100644 --- a/app/helpers/ballots_helper.rb +++ b/app/helpers/ballots_helper.rb @@ -1,7 +1,5 @@ module BallotsHelper - def progress_bar_width(amount_available, amount_spent) (amount_spent / amount_available.to_f * 100).to_s + "%" end - end diff --git a/app/helpers/banners_helper.rb b/app/helpers/banners_helper.rb index 59cd07c1a..06dcb67fb 100644 --- a/app/helpers/banners_helper.rb +++ b/app/helpers/banners_helper.rb @@ -1,5 +1,4 @@ module BannersHelper - def has_banners? @banners.present? && @banners.count > 0 end @@ -19,5 +18,4 @@ module BannersHelper def banner_font_color_or_default @banner.font_color.presence || banner_default_font_color end - end diff --git a/app/helpers/budget_executions_helper.rb b/app/helpers/budget_executions_helper.rb index ee6d286ab..8b2123ccc 100644 --- a/app/helpers/budget_executions_helper.rb +++ b/app/helpers/budget_executions_helper.rb @@ -1,5 +1,4 @@ module BudgetExecutionsHelper - def filters_select_counts(status) @budget.investments.winners.with_milestone_status_id(status).count end @@ -14,5 +13,4 @@ module BudgetExecutionsHelper investment.milestones.order_by_publication_date .select { |milestone| milestone.image.present? }.last end - end diff --git a/app/helpers/budget_headings_helper.rb b/app/helpers/budget_headings_helper.rb index fc014131b..70a417559 100644 --- a/app/helpers/budget_headings_helper.rb +++ b/app/helpers/budget_headings_helper.rb @@ -1,5 +1,4 @@ module BudgetHeadingsHelper - def budget_heading_select_options(budget) budget.headings.sort_by_name.map do |heading| [heading.name_scoped_by_group, heading.id] @@ -11,5 +10,4 @@ module BudgetHeadingsHelper heading_path = budget_investments_path(budget, heading_id: assigned_heading&.id) link_to(assigned_heading.name, heading_path) end - end diff --git a/app/helpers/budgets_helper.rb b/app/helpers/budgets_helper.rb index 14ce89af8..92589fc73 100644 --- a/app/helpers/budgets_helper.rb +++ b/app/helpers/budgets_helper.rb @@ -1,5 +1,4 @@ module BudgetsHelper - def show_links_to_budget_investments(budget) ["balloting", "reviewing_ballots", "finished"].include? budget.phase end diff --git a/app/helpers/cache_keys_helper.rb b/app/helpers/cache_keys_helper.rb index 9b37807fb..bf62a2df0 100644 --- a/app/helpers/cache_keys_helper.rb +++ b/app/helpers/cache_keys_helper.rb @@ -1,5 +1,4 @@ module CacheKeysHelper - def locale_and_user_status(authorable = nil) @cache_key_user ||= calculate_user_status(authorable) "#{I18n.locale}/#{@cache_key_user}" @@ -26,5 +25,4 @@ module CacheKeysHelper def commentable_cache_key(commentable) "#{commentable.class.name}-#{commentable.id}" end - end diff --git a/app/helpers/change_log_helper.rb b/app/helpers/change_log_helper.rb index 7730951a0..f6bea8c3f 100644 --- a/app/helpers/change_log_helper.rb +++ b/app/helpers/change_log_helper.rb @@ -1,8 +1,6 @@ module ChangeLogHelper - def show_investment_log @log = Budget::Investment::ChangeLog.find_by(id: params[:id]) render "admin/change_logs/show" end - end diff --git a/app/helpers/comments_helper.rb b/app/helpers/comments_helper.rb index ab81c76c6..0516aee07 100644 --- a/app/helpers/comments_helper.rb +++ b/app/helpers/comments_helper.rb @@ -1,5 +1,4 @@ module CommentsHelper - def comment_tree_title_text(commentable) if commentable.class == Legislation::Question t("legislation.questions.comments.comments_title") @@ -83,5 +82,4 @@ module CommentsHelper t("comments.comments_closed") end end - end diff --git a/app/helpers/communities_helper.rb b/app/helpers/communities_helper.rb index 744749a68..9d0cd61e4 100644 --- a/app/helpers/communities_helper.rb +++ b/app/helpers/communities_helper.rb @@ -1,5 +1,4 @@ module CommunitiesHelper - def community_title(community) community.from_proposal? ? community.proposal.title : community.investment.title end diff --git a/app/helpers/debates_helper.rb b/app/helpers/debates_helper.rb index 7771a2561..4059263c6 100644 --- a/app/helpers/debates_helper.rb +++ b/app/helpers/debates_helper.rb @@ -1,5 +1,4 @@ module DebatesHelper - def has_featured? Debate.all.featured.count > 0 end @@ -27,5 +26,4 @@ module DebatesHelper def debates_secondary_view debates_current_view == "default" ? "minimal" : "default" end - end diff --git a/app/helpers/direct_uploads_helper.rb b/app/helpers/direct_uploads_helper.rb index 54a6c958b..eabb0425e 100644 --- a/app/helpers/direct_uploads_helper.rb +++ b/app/helpers/direct_uploads_helper.rb @@ -1,5 +1,4 @@ module DirectUploadsHelper - def render_destroy_upload_link(direct_upload) label = direct_upload.resource_relation == "image" ? "images" : "documents" link_to t("#{label}.form.delete_button"), @@ -14,5 +13,4 @@ module DirectUploadsHelper remote: true, class: "delete remove-cached-attachment" end - end diff --git a/app/helpers/documentables_helper.rb b/app/helpers/documentables_helper.rb index 98ce55b59..be827159d 100644 --- a/app/helpers/documentables_helper.rb +++ b/app/helpers/documentables_helper.rb @@ -1,5 +1,4 @@ module DocumentablesHelper - def documentable_class(documentable) documentable.class.name.parameterize(separator: "_") end diff --git a/app/helpers/documents_helper.rb b/app/helpers/documents_helper.rb index eeb517f46..46db4522d 100644 --- a/app/helpers/documents_helper.rb +++ b/app/helpers/documents_helper.rb @@ -1,5 +1,4 @@ module DocumentsHelper - def document_attachment_file_name(document) document.attachment_file_name end diff --git a/app/helpers/download_settings_helper.rb b/app/helpers/download_settings_helper.rb index 535c81824..3ac737361 100644 --- a/app/helpers/download_settings_helper.rb +++ b/app/helpers/download_settings_helper.rb @@ -1,5 +1,4 @@ module DownloadSettingsHelper - def get_model(resource_name) case resource_name when "legislation_processes" @@ -36,12 +35,10 @@ module DownloadSettingsHelper end def get_resource(resource) - resource.to_s.pluralize.downcase end def get_config params[:config].present? && !params[:config].nil? ? params[:config] : 0 end - end diff --git a/app/helpers/embed_videos_helper.rb b/app/helpers/embed_videos_helper.rb index a786e4b15..07207d4de 100644 --- a/app/helpers/embed_videos_helper.rb +++ b/app/helpers/embed_videos_helper.rb @@ -1,5 +1,4 @@ module EmbedVideosHelper - VIMEO_REGEX = /vimeo.*(staffpicks\/|channels\/|videos\/|video\/|\/)([^#\&\?]*).*/ YOUTUBE_REGEX = /youtu.*(be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/ @@ -37,5 +36,4 @@ module EmbedVideosHelper return if video_url.match(YOUTUBE_REGEX) errors.add(:video_url, :invalid) end - end diff --git a/app/helpers/feeds_helper.rb b/app/helpers/feeds_helper.rb index a863de56c..b5882e22f 100644 --- a/app/helpers/feeds_helper.rb +++ b/app/helpers/feeds_helper.rb @@ -1,5 +1,4 @@ module FeedsHelper - def feed_debates?(feed) feed.kind == "debates" end @@ -27,5 +26,4 @@ module FeedsHelper def feed_debates_and_proposals_enabled? feed_debates_enabled? && feed_proposals_enabled? end - end diff --git a/app/helpers/flags_helper.rb b/app/helpers/flags_helper.rb index c02dcefad..602970b33 100644 --- a/app/helpers/flags_helper.rb +++ b/app/helpers/flags_helper.rb @@ -1,5 +1,4 @@ module FlagsHelper - def show_flag_action?(flaggable) current_user && !own_flaggable?(flaggable) && !flagged?(flaggable) end @@ -25,5 +24,4 @@ module FlagsHelper flaggable.author_id == current_user.id end end - end diff --git a/app/helpers/followables_helper.rb b/app/helpers/followables_helper.rb index 80292c8c3..ee01d9aee 100644 --- a/app/helpers/followables_helper.rb +++ b/app/helpers/followables_helper.rb @@ -1,5 +1,4 @@ module FollowablesHelper - def followable_type_title(followable_type) t("activerecord.models.#{followable_type.underscore}.other") end @@ -28,5 +27,4 @@ module FollowablesHelper def find_or_build_follow(user, followable) Follow.find_or_initialize_by(user: user, followable: followable) end - end diff --git a/app/helpers/follows_helper.rb b/app/helpers/follows_helper.rb index 1508e4c25..f1d36328a 100644 --- a/app/helpers/follows_helper.rb +++ b/app/helpers/follows_helper.rb @@ -1,5 +1,4 @@ module FollowsHelper - def follow_text(followable) entity = followable.class.name.underscore t("shared.follow_entity", entity: t("activerecord.models.#{entity}.one").downcase) @@ -9,5 +8,4 @@ module FollowsHelper entity = followable.class.name.underscore t("shared.unfollow_entity", entity: t("activerecord.models.#{entity}.one").downcase) end - end diff --git a/app/helpers/geozones_helper.rb b/app/helpers/geozones_helper.rb index c898760bf..cf53a086e 100644 --- a/app/helpers/geozones_helper.rb +++ b/app/helpers/geozones_helper.rb @@ -1,5 +1,4 @@ module GeozonesHelper - def geozone_name(geozonable) geozonable.geozone ? geozonable.geozone.name : t("geozones.none") end @@ -7,5 +6,4 @@ module GeozonesHelper def geozone_select_options Geozone.all.order(name: :asc).collect { |g| [g.name, g.id] } end - end diff --git a/app/helpers/globalize_helper.rb b/app/helpers/globalize_helper.rb index 5b1fd508c..362214251 100644 --- a/app/helpers/globalize_helper.rb +++ b/app/helpers/globalize_helper.rb @@ -1,5 +1,4 @@ module GlobalizeHelper - def options_for_select_language(resource) options_for_select(available_locales(resource), selected_locale(resource)) end diff --git a/app/helpers/imageables_helper.rb b/app/helpers/imageables_helper.rb index 520041778..529ee9cd7 100644 --- a/app/helpers/imageables_helper.rb +++ b/app/helpers/imageables_helper.rb @@ -1,5 +1,4 @@ module ImageablesHelper - def can_destroy_image?(imageable) imageable.image.present? && can?(:destroy, imageable.image) end @@ -38,5 +37,4 @@ module ImageablesHelper t "images.form.note", accepted_content_types: imageable_humanized_accepted_content_types, max_file_size: imageable_max_file_size end - end diff --git a/app/helpers/images_helper.rb b/app/helpers/images_helper.rb index 4d5b620f2..81144f54f 100644 --- a/app/helpers/images_helper.rb +++ b/app/helpers/images_helper.rb @@ -1,5 +1,4 @@ module ImagesHelper - def image_absolute_url(image, version) return "" unless image if Paperclip::Attachment.default_options[:storage] == :filesystem @@ -66,5 +65,4 @@ module ImagesHelper "direct_upload[resource_id]": imageable.id, "direct_upload[resource_relation]": "image") end - end diff --git a/app/helpers/layouts_helper.rb b/app/helpers/layouts_helper.rb index b88547d8a..3f5034e9c 100644 --- a/app/helpers/layouts_helper.rb +++ b/app/helpers/layouts_helper.rb @@ -1,5 +1,4 @@ module LayoutsHelper - def layout_menu_link_to(text, path, is_active, options) if is_active content_tag(:span, t("shared.you_are_in"), class: "show-for-sr") + " " + @@ -8,5 +7,4 @@ module LayoutsHelper link_to(text, path, options) end end - end diff --git a/app/helpers/legislation_helper.rb b/app/helpers/legislation_helper.rb index 5dd916571..2aab71f27 100644 --- a/app/helpers/legislation_helper.rb +++ b/app/helpers/legislation_helper.rb @@ -47,5 +47,4 @@ module LegislationHelper "background: #{@process.background_color};color: #{@process.font_color};" end end - end diff --git a/app/helpers/locales_helper.rb b/app/helpers/locales_helper.rb index 3ae6bb5ef..46fe7519d 100644 --- a/app/helpers/locales_helper.rb +++ b/app/helpers/locales_helper.rb @@ -1,7 +1,5 @@ module LocalesHelper - def name_for_locale(locale) I18n.t("i18n.language.name", locale: locale, fallback: false, default: locale.to_s) end - end diff --git a/app/helpers/mailer_helper.rb b/app/helpers/mailer_helper.rb index 1f6f4d3a6..8a0e1e2f1 100644 --- a/app/helpers/mailer_helper.rb +++ b/app/helpers/mailer_helper.rb @@ -1,5 +1,4 @@ module MailerHelper - def commentable_url(commentable) return poll_url(commentable) if commentable.is_a?(Poll) return debate_url(commentable) if commentable.is_a?(Debate) diff --git a/app/helpers/management_helper.rb b/app/helpers/management_helper.rb index 05c6552f8..a75fa87c1 100644 --- a/app/helpers/management_helper.rb +++ b/app/helpers/management_helper.rb @@ -1,5 +1,4 @@ module ManagementHelper - def menu_users? ["users", "email_verifications", "document_verifications"].include?(controller_name) end @@ -42,5 +41,4 @@ module ManagementHelper def menu_user_invites? controller_name == "user_invites" end - end diff --git a/app/helpers/map_locations_helper.rb b/app/helpers/map_locations_helper.rb index d0f51f5f6..62f552da1 100644 --- a/app/helpers/map_locations_helper.rb +++ b/app/helpers/map_locations_helper.rb @@ -1,5 +1,4 @@ module MapLocationsHelper - def map_location_available?(map_location) map_location.present? && map_location.available? end @@ -66,5 +65,4 @@ module MapLocationsHelper options[:marker_longitude] = map_location.longitude if map_location.longitude.present? options end - end diff --git a/app/helpers/officers_helper.rb b/app/helpers/officers_helper.rb index 1218af80e..94eaf1145 100644 --- a/app/helpers/officers_helper.rb +++ b/app/helpers/officers_helper.rb @@ -1,5 +1,4 @@ module OfficersHelper - def officer_label(officer) truncate([officer.name, officer.email].compact.join(" - "), length: 100) end @@ -15,5 +14,4 @@ module OfficersHelper def no_shifts? current_user.poll_officer.officer_assignments.where(date: Time.current.to_date).blank? end - end diff --git a/app/helpers/officing_helper.rb b/app/helpers/officing_helper.rb index 184ad9751..2ed64fcac 100644 --- a/app/helpers/officing_helper.rb +++ b/app/helpers/officing_helper.rb @@ -1,5 +1,4 @@ module OfficingHelper - def booths_for_officer_select_options(officer_assignments) options = [] officer_assignments.each do |oa| @@ -15,5 +14,4 @@ module OfficingHelper return nil if params[:questions][question_id.to_s].blank? params[:questions][question_id.to_s][answer_index.to_s] end - end diff --git a/app/helpers/poll_recounts_helper.rb b/app/helpers/poll_recounts_helper.rb index 9524c06d7..8e92e7a1f 100644 --- a/app/helpers/poll_recounts_helper.rb +++ b/app/helpers/poll_recounts_helper.rb @@ -1,5 +1,4 @@ module PollRecountsHelper - def total_recounts_by_booth(booth_assignment) if booth_assignment.recounts.any? booth_assignment.recounts.sum(:total_amount) + @@ -7,5 +6,4 @@ module PollRecountsHelper booth_assignment.recounts.sum(:null_amount) end end - end diff --git a/app/helpers/polls_helper.rb b/app/helpers/polls_helper.rb index 963367a4f..ba158fb08 100644 --- a/app/helpers/polls_helper.rb +++ b/app/helpers/polls_helper.rb @@ -1,5 +1,4 @@ module PollsHelper - def poll_select_options(include_all = nil) options = @polls.collect do |poll| [poll.name, current_path_with_query_params(poll_id: poll.id)] diff --git a/app/helpers/proposals_helper.rb b/app/helpers/proposals_helper.rb index 1310dfc1c..e7f10f9db 100644 --- a/app/helpers/proposals_helper.rb +++ b/app/helpers/proposals_helper.rb @@ -1,5 +1,4 @@ module ProposalsHelper - def progress_bar_percentage(proposal) case proposal.cached_votes_up when 0 then 0 diff --git a/app/helpers/remote_translations_helper.rb b/app/helpers/remote_translations_helper.rb index d9435f833..90d8b7335 100644 --- a/app/helpers/remote_translations_helper.rb +++ b/app/helpers/remote_translations_helper.rb @@ -1,5 +1,4 @@ module RemoteTranslationsHelper - def display_remote_translation_info?(remote_translations, locale) remote_translations.present? && RemoteTranslations::Microsoft::AvailableLocales.include_locale?(locale) end diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index fed7454fe..fad5be141 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -1,5 +1,4 @@ module SearchHelper - def official_level_search_options options_for_select((1..5).map { |i| [setting["official_level_#{i}_name"], i] }, params[:advanced_search].try(:[], :official_level)) @@ -22,5 +21,4 @@ module SearchHelper def custom_date_range? params[:advanced_search].try(:[], :date_max).present? end - end diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb index 5d9ee2ebe..b03675c2c 100644 --- a/app/helpers/settings_helper.rb +++ b/app/helpers/settings_helper.rb @@ -1,5 +1,4 @@ module SettingsHelper - def feature?(name) setting["feature.#{name}"].presence || setting["process.#{name}"].presence end @@ -15,5 +14,4 @@ module SettingsHelper t("admin.settings.#{setting_name}") end end - end diff --git a/app/helpers/shifts_helper.rb b/app/helpers/shifts_helper.rb index 965cbde4e..f9d296fe5 100644 --- a/app/helpers/shifts_helper.rb +++ b/app/helpers/shifts_helper.rb @@ -1,5 +1,4 @@ module ShiftsHelper - def shift_vote_collection_dates(booth, polls) return [] if polls.blank? date_options((start_date(polls)..end_date(polls)), Poll::Shift.tasks[:vote_collection], booth) diff --git a/app/helpers/signature_sheets_helper.rb b/app/helpers/signature_sheets_helper.rb index 20ef2e709..0c32bd925 100644 --- a/app/helpers/signature_sheets_helper.rb +++ b/app/helpers/signature_sheets_helper.rb @@ -1,5 +1,4 @@ module SignatureSheetsHelper - def signable_options [[t("activerecord.models.proposal", count: 1), Proposal], [t("activerecord.models.budget/investment", count: 1), Budget::Investment]] @@ -48,5 +47,4 @@ module SignatureSheetsHelper text_example += "#{example_1}; #{example_2}" return text_example end - end diff --git a/app/helpers/stats_helper.rb b/app/helpers/stats_helper.rb index fe0786738..d99e3cdf2 100644 --- a/app/helpers/stats_helper.rb +++ b/app/helpers/stats_helper.rb @@ -1,5 +1,4 @@ module StatsHelper - def chart_tag(opt = {}) opt[:data] ||= {} opt[:data][:graph] = admin_api_stats_path(chart_data(opt)) diff --git a/app/helpers/tags_helper.rb b/app/helpers/tags_helper.rb index ce0445092..9dea0061d 100644 --- a/app/helpers/tags_helper.rb +++ b/app/helpers/tags_helper.rb @@ -1,5 +1,4 @@ module TagsHelper - def taggables_path(taggable_type, tag_name) case taggable_type when "debate" @@ -30,5 +29,4 @@ module TagsHelper "#" end end - end diff --git a/app/helpers/text_with_links_helper.rb b/app/helpers/text_with_links_helper.rb index f01376847..928541387 100644 --- a/app/helpers/text_with_links_helper.rb +++ b/app/helpers/text_with_links_helper.rb @@ -1,5 +1,4 @@ module TextWithLinksHelper - def sanitize_and_auto_link(text) return unless text sanitized = sanitize(text, tags: [], attributes: []) @@ -16,5 +15,4 @@ module TextWithLinksHelper def simple_format_no_tags_no_sanitize(html) simple_format(html, {}, sanitize: false) end - end diff --git a/app/helpers/trackers_helper.rb b/app/helpers/trackers_helper.rb index 39be009d8..d0e1368ed 100644 --- a/app/helpers/trackers_helper.rb +++ b/app/helpers/trackers_helper.rb @@ -1,5 +1,4 @@ module TrackersHelper - def tracker_label(tracker) truncate([tracker.name, tracker.email, tracker.description].compact.join(" - "), length: 100) end @@ -17,5 +16,4 @@ module TrackersHelper def tracker_namespace current_user.administrator? ? :admin : :tracking end - end diff --git a/app/helpers/tracks_helper.rb b/app/helpers/tracks_helper.rb index f63fe7852..305876915 100644 --- a/app/helpers/tracks_helper.rb +++ b/app/helpers/tracks_helper.rb @@ -1,5 +1,4 @@ module TracksHelper - def track_event(data = {}) track_data = "" prefix = " data-track-event-" @@ -10,5 +9,4 @@ module TracksHelper track_data end end - end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index ffce53683..f4ba9d4db 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -1,5 +1,4 @@ module UsersHelper - def humanize_document_type(document_type) case document_type when "1" @@ -72,5 +71,4 @@ module UsersHelper t("account.show.public_interests_user_title_list") end end - end diff --git a/app/helpers/valuation_helper.rb b/app/helpers/valuation_helper.rb index 428d7fb14..2ffe8ad94 100644 --- a/app/helpers/valuation_helper.rb +++ b/app/helpers/valuation_helper.rb @@ -1,5 +1,4 @@ module ValuationHelper - def valuator_or_group_select_options valuator_group_select_options + valuator_select_options end @@ -16,5 +15,4 @@ module ValuationHelper def explanation_field(field) simple_format_no_tags_no_sanitize(sanitize_and_auto_link(field)) if field.present? end - end diff --git a/app/helpers/valuators_helper.rb b/app/helpers/valuators_helper.rb index 0d9d1d715..d99f5f957 100644 --- a/app/helpers/valuators_helper.rb +++ b/app/helpers/valuators_helper.rb @@ -1,5 +1,4 @@ module ValuatorsHelper - def valuator_label(valuator) truncate([valuator.name, valuator.email, valuator.description].compact.join(" - "), length: 100) end diff --git a/app/helpers/verification_helper.rb b/app/helpers/verification_helper.rb index 54b340b8b..587e17859 100644 --- a/app/helpers/verification_helper.rb +++ b/app/helpers/verification_helper.rb @@ -1,5 +1,4 @@ module VerificationHelper - def document_types [[t("verification.residence.new.document_type.spanish_id"), 1], [t("verification.residence.new.document_type.passport"), 2], @@ -24,5 +23,4 @@ module VerificationHelper data_to_display + "*" * data_to_mask.size + "@" + email_provider end - end diff --git a/app/helpers/votes_helper.rb b/app/helpers/votes_helper.rb index 946b9bf7c..e0e4af133 100644 --- a/app/helpers/votes_helper.rb +++ b/app/helpers/votes_helper.rb @@ -1,5 +1,4 @@ module VotesHelper - def debate_percentage_of_likes(debate) debate.likes.percent_of(debate.total_votes) end @@ -27,5 +26,4 @@ module VotesHelper def voted_for?(votes, votable) votes[votable.id] end - end diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index 0412898b4..85cc2dd33 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -1,5 +1,4 @@ module WelcomeHelper - def is_active_class(index) "is-active is-in" if index.zero? end @@ -54,5 +53,4 @@ module WelcomeHelper end end end - end diff --git a/app/mailers/dashboard/mailer.rb b/app/mailers/dashboard/mailer.rb index 6bd14f110..d6bb9da5b 100644 --- a/app/mailers/dashboard/mailer.rb +++ b/app/mailers/dashboard/mailer.rb @@ -43,5 +43,4 @@ class Dashboard::Mailer < ApplicationMailer def check_deliverability mail.perform_deliveries = false unless Setting["dashboard.emails"] end - end diff --git a/app/mailers/mailer.rb b/app/mailers/mailer.rb index 2b71c63b1..f1cf3f0db 100644 --- a/app/mailers/mailer.rb +++ b/app/mailers/mailer.rb @@ -140,5 +140,4 @@ class Mailer < ApplicationMailer mail.perform_deliveries = false end end - end diff --git a/app/models/ability.rb b/app/models/ability.rb index dac06ea3f..128b000d5 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -23,5 +23,4 @@ class Ability merge Abilities::Everyone.new(user) end end - end diff --git a/app/models/ahoy/data_source.rb b/app/models/ahoy/data_source.rb index 7f68155e9..05fbca93b 100644 --- a/app/models/ahoy/data_source.rb +++ b/app/models/ahoy/data_source.rb @@ -4,7 +4,6 @@ module Ahoy class DataSource - # Adds a collection with the datasource # Name is the name of the collection and will be showed in the # chart @@ -43,7 +42,5 @@ module Ahoy def add_key(key) shared_keys.push(key) unless shared_keys.include? key end - end - end diff --git a/app/models/banner.rb b/app/models/banner.rb index 9b8ce7b3c..f4b9b1d09 100644 --- a/app/models/banner.rb +++ b/app/models/banner.rb @@ -1,5 +1,4 @@ class Banner < ApplicationRecord - acts_as_paranoid column: :hidden_at include ActsAsParanoidAliases diff --git a/app/models/budget.rb b/app/models/budget.rb index 614d124c0..1f528b102 100644 --- a/app/models/budget.rb +++ b/app/models/budget.rb @@ -1,5 +1,4 @@ class Budget < ApplicationRecord - include Measurable include Sluggable include StatsVersionable @@ -219,5 +218,4 @@ class Budget < ApplicationRecord def generate_slug? slug.nil? || drafting? end - end diff --git a/app/models/budget/ballot.rb b/app/models/budget/ballot.rb index f184e63a0..fe7277546 100644 --- a/app/models/budget/ballot.rb +++ b/app/models/budget/ballot.rb @@ -74,6 +74,5 @@ class Budget def casted_offline? budget.poll&.voted_by?(user) end - end end diff --git a/app/models/budget/investment/change_log.rb b/app/models/budget/investment/change_log.rb index d93843e26..34dbd500e 100644 --- a/app/models/budget/investment/change_log.rb +++ b/app/models/budget/investment/change_log.rb @@ -6,5 +6,4 @@ class Budget::Investment::ChangeLog < ApplicationRecord validates :field, presence: true scope :by_investment, ->(investment_id) { where(investment_id: investment_id) } - end diff --git a/app/models/budget/reclassification.rb b/app/models/budget/reclassification.rb index f698ad381..9c8c5cf1c 100644 --- a/app/models/budget/reclassification.rb +++ b/app/models/budget/reclassification.rb @@ -45,6 +45,5 @@ class Budget def ballot_lines_for_investment Budget::Ballot::Line.by_investment(id) end - end end diff --git a/app/models/budget/result.rb b/app/models/budget/result.rb index 11427c697..60a852547 100644 --- a/app/models/budget/result.rb +++ b/app/models/budget/result.rb @@ -1,6 +1,5 @@ class Budget class Result - attr_accessor :budget, :heading, :current_investment def initialize(budget, heading) @@ -48,6 +47,5 @@ class Budget def winners investments.where(winner: true) end - end end diff --git a/app/models/comment_notifier.rb b/app/models/comment_notifier.rb index be8a9d69a..0c6af89b6 100644 --- a/app/models/comment_notifier.rb +++ b/app/models/comment_notifier.rb @@ -31,5 +31,4 @@ class CommentNotifier parent_author = @comment.parent.author parent_author != @author && parent_author.email_on_comment_reply? end - end diff --git a/app/models/concerns/communitable.rb b/app/models/concerns/communitable.rb index 83844e63c..56a439c55 100644 --- a/app/models/concerns/communitable.rb +++ b/app/models/concerns/communitable.rb @@ -10,5 +10,4 @@ module Communitable community = Community.create! self.community_id = community.id end - end diff --git a/app/models/concerns/conflictable.rb b/app/models/concerns/conflictable.rb index b362ef1d1..0c6f0bf4d 100644 --- a/app/models/concerns/conflictable.rb +++ b/app/models/concerns/conflictable.rb @@ -5,5 +5,4 @@ module Conflictable return false unless flags_count > 0 && cached_votes_up > 0 cached_votes_up / flags_count.to_f < 5 end - end diff --git a/app/models/concerns/documentable.rb b/app/models/concerns/documentable.rb index eeaefc51b..220912cce 100644 --- a/app/models/concerns/documentable.rb +++ b/app/models/concerns/documentable.rb @@ -19,5 +19,4 @@ module Documentable Setting["uploads.documents.content_types"]&.split(" ") || ["application/pdf"] end end - end diff --git a/app/models/concerns/download_settings/budget_investment_csv.rb b/app/models/concerns/download_settings/budget_investment_csv.rb index 05ba06e3c..c4f19cbbc 100644 --- a/app/models/concerns/download_settings/budget_investment_csv.rb +++ b/app/models/concerns/download_settings/budget_investment_csv.rb @@ -13,7 +13,6 @@ module DownloadSettings end def to_csv(budgets, admin_attr, options = {}) - attributes = admin_attr.nil? ? [] : admin_attr CSV.generate(options) do |csv| @@ -23,6 +22,5 @@ module DownloadSettings end end end - end end diff --git a/app/models/concerns/download_settings/comment_csv.rb b/app/models/concerns/download_settings/comment_csv.rb index 581bfaae9..663bea550 100644 --- a/app/models/concerns/download_settings/comment_csv.rb +++ b/app/models/concerns/download_settings/comment_csv.rb @@ -13,7 +13,6 @@ module DownloadSettings end def to_csv(comments, admin_attr, options = {}) - attributes = admin_attr.nil? ? [] : admin_attr CSV.generate(options) do |csv| @@ -23,6 +22,5 @@ module DownloadSettings end end end - end end diff --git a/app/models/concerns/download_settings/debate_csv.rb b/app/models/concerns/download_settings/debate_csv.rb index 71380596e..6707acb9a 100644 --- a/app/models/concerns/download_settings/debate_csv.rb +++ b/app/models/concerns/download_settings/debate_csv.rb @@ -13,7 +13,6 @@ module DownloadSettings end def to_csv(debates, admin_attr, options = {}) - attributes = admin_attr.nil? ? [] : admin_attr CSV.generate(options) do |csv| @@ -23,6 +22,5 @@ module DownloadSettings end end end - end end diff --git a/app/models/concerns/download_settings/legislation_process_csv.rb b/app/models/concerns/download_settings/legislation_process_csv.rb index d2b6fe7b5..9bbed6815 100644 --- a/app/models/concerns/download_settings/legislation_process_csv.rb +++ b/app/models/concerns/download_settings/legislation_process_csv.rb @@ -13,7 +13,6 @@ module DownloadSettings end def to_csv(processes, admin_attr, options = {}) - attributes = admin_attr.nil? ? [] : admin_attr CSV.generate(options) do |csv| @@ -23,6 +22,5 @@ module DownloadSettings end end end - end end diff --git a/app/models/concerns/download_settings/proposal_csv.rb b/app/models/concerns/download_settings/proposal_csv.rb index ddb0969ea..ed1678b9a 100644 --- a/app/models/concerns/download_settings/proposal_csv.rb +++ b/app/models/concerns/download_settings/proposal_csv.rb @@ -13,7 +13,6 @@ module DownloadSettings end def to_csv(proposals, admin_attr, options = {}) - attributes = admin_attr.nil? ? [] : admin_attr CSV.generate(options) do |csv| @@ -23,6 +22,5 @@ module DownloadSettings end end end - end end diff --git a/app/models/concerns/filterable.rb b/app/models/concerns/filterable.rb index 889067dd1..7d4960c27 100644 --- a/app/models/concerns/filterable.rb +++ b/app/models/concerns/filterable.rb @@ -7,7 +7,6 @@ module Filterable end class_methods do - def filter(params) resources = all params.each do |filter, value| @@ -22,7 +21,5 @@ module Filterable return if value.blank? ["official_level", "date_range"].include?(filter) end - end - end diff --git a/app/models/concerns/flaggable.rb b/app/models/concerns/flaggable.rb index c3125c440..6e2394d5b 100644 --- a/app/models/concerns/flaggable.rb +++ b/app/models/concerns/flaggable.rb @@ -15,5 +15,4 @@ module Flaggable def ignore_flag update(ignored_flag_at: Time.current) end - end diff --git a/app/models/concerns/followable.rb b/app/models/concerns/followable.rb index e3e926d3b..9e9957949 100644 --- a/app/models/concerns/followable.rb +++ b/app/models/concerns/followable.rb @@ -13,5 +13,4 @@ module Followable def followed_by?(user) followers.include?(user) end - end diff --git a/app/models/concerns/graphqlable.rb b/app/models/concerns/graphqlable.rb index 53e5a8e0d..2284838da 100644 --- a/app/models/concerns/graphqlable.rb +++ b/app/models/concerns/graphqlable.rb @@ -2,7 +2,6 @@ module Graphqlable extend ActiveSupport::Concern class_methods do - def graphql_field_name name.gsub("::", "_").underscore.to_sym end @@ -26,11 +25,9 @@ module Graphqlable def graphql_type_description model_name.human.to_s end - end def public_created_at created_at.change(min: 0) end - end diff --git a/app/models/concerns/mappable.rb b/app/models/concerns/mappable.rb index 4762da578..a565fb199 100644 --- a/app/models/concerns/mappable.rb +++ b/app/models/concerns/mappable.rb @@ -25,7 +25,5 @@ module Mappable def skip_map? skip_map == "1" end - end - end diff --git a/app/models/concerns/measurable.rb b/app/models/concerns/measurable.rb index 9cf606e3f..affb113c2 100644 --- a/app/models/concerns/measurable.rb +++ b/app/models/concerns/measurable.rb @@ -2,7 +2,6 @@ module Measurable extend ActiveSupport::Concern class_methods do - def title_max_length @@title_max_length ||= (columns.find { |c| c.name == "title" }.limit rescue nil) || 80 end @@ -18,7 +17,5 @@ module Measurable def description_max_length 6000 end - end - end diff --git a/app/models/concerns/search_cache.rb b/app/models/concerns/search_cache.rb index c78e8643d..02634e55d 100644 --- a/app/models/concerns/search_cache.rb +++ b/app/models/concerns/search_cache.rb @@ -30,5 +30,4 @@ module SearchCache def strip_html(value) ActionController::Base.helpers.sanitize(value, tags: []) end - end diff --git a/app/models/concerns/searchable.rb b/app/models/concerns/searchable.rb index e6c8777d5..8cdbafb46 100644 --- a/app/models/concerns/searchable.rb +++ b/app/models/concerns/searchable.rb @@ -15,5 +15,4 @@ module Searchable order_within_rank: (column_names.include?("cached_votes_up") ? "#{table_name}.cached_votes_up DESC" : nil) } end - end diff --git a/app/models/custom/verification/residence.rb b/app/models/custom/verification/residence.rb index 4386b705c..95c94a99b 100644 --- a/app/models/custom/verification/residence.rb +++ b/app/models/custom/verification/residence.rb @@ -2,7 +2,6 @@ require_dependency Rails.root.join("app", "models", "verification", "residence").to_s class Verification::Residence - validate :postal_code_in_madrid validate :residence_in_madrid @@ -25,5 +24,4 @@ class Verification::Residence def valid_postal_code? postal_code =~ /^280/ end - end diff --git a/app/models/dashboard/action.rb b/app/models/dashboard/action.rb index 701d790d5..72340f0b8 100644 --- a/app/models/dashboard/action.rb +++ b/app/models/dashboard/action.rb @@ -93,6 +93,7 @@ class Dashboard::Action < ApplicationRecord end private + def self.get_actions_for_today(proposal) proposal_votes = proposal.cached_votes_up day_offset = calculate_day_offset(proposal, Date.current) diff --git a/app/models/direct_message.rb b/app/models/direct_message.rb index 442d56534..5532c95a4 100644 --- a/app/models/direct_message.rb +++ b/app/models/direct_message.rb @@ -19,5 +19,4 @@ class DirectMessage < ApplicationRecord errors.add(:title, I18n.t("activerecord.errors.models.direct_message.attributes.max_per_day.invalid")) end end - end diff --git a/app/models/direct_upload.rb b/app/models/direct_upload.rb index 277f1af6e..2d2e9c14b 100644 --- a/app/models/direct_upload.rb +++ b/app/models/direct_upload.rb @@ -62,5 +62,4 @@ class DirectUpload user: @user } end - end diff --git a/app/models/document.rb b/app/models/document.rb index 67c220e64..045370663 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -114,5 +114,4 @@ class Document < ApplicationRecord document.set_attachment_from_cached_attachment document.attachment.destroy end - end diff --git a/app/models/download_setting.rb b/app/models/download_setting.rb index 3c1382280..a95497c98 100644 --- a/app/models/download_setting.rb +++ b/app/models/download_setting.rb @@ -14,5 +14,4 @@ class DownloadSetting < ApplicationRecord end download_setting end - end diff --git a/app/models/evaluation_comment_notifier.rb b/app/models/evaluation_comment_notifier.rb index e1231298c..0e62b929f 100644 --- a/app/models/evaluation_comment_notifier.rb +++ b/app/models/evaluation_comment_notifier.rb @@ -8,6 +8,7 @@ class EvaluationCommentNotifier end private + def send_evaluation_comment_email EvaluationCommentEmail.new(@comment).to.each do |to| Mailer.evaluation_comment(@comment, to).deliver_later diff --git a/app/models/flag.rb b/app/models/flag.rb index bdb31e971..ff6cdd46a 100644 --- a/app/models/flag.rb +++ b/app/models/flag.rb @@ -25,5 +25,4 @@ class Flag < ApplicationRecord return false unless user !!by_user_and_flaggable(user, flaggable)&.first end - end diff --git a/app/models/geozone.rb b/app/models/geozone.rb index 667ec98f7..57b5e6cb4 100644 --- a/app/models/geozone.rb +++ b/app/models/geozone.rb @@ -1,5 +1,4 @@ class Geozone < ApplicationRecord - include Graphqlable has_many :proposals diff --git a/app/models/image.rb b/app/models/image.rb index 6929f5f96..aa29b7711 100644 --- a/app/models/image.rb +++ b/app/models/image.rb @@ -129,5 +129,4 @@ class Image < ApplicationRecord image.set_attachment_from_cached_attachment image.attachment.destroy end - end diff --git a/app/models/legislation/process/phase.rb b/app/models/legislation/process/phase.rb index 6f3e017ff..a6fb57b1e 100644 --- a/app/models/legislation/process/phase.rb +++ b/app/models/legislation/process/phase.rb @@ -1,5 +1,4 @@ class Legislation::Process::Phase - def initialize(start_date, end_date, enabled) @start_date = start_date @end_date = end_date @@ -17,5 +16,4 @@ class Legislation::Process::Phase def open? started? && Date.current <= @end_date end - end diff --git a/app/models/legislation/process/publication.rb b/app/models/legislation/process/publication.rb index b58f9ed41..b595e068c 100644 --- a/app/models/legislation/process/publication.rb +++ b/app/models/legislation/process/publication.rb @@ -1,5 +1,4 @@ class Legislation::Process::Publication - def initialize(publication_date, enabled) @publication_date = publication_date @enabled = enabled @@ -16,5 +15,4 @@ class Legislation::Process::Publication def open? started? end - end diff --git a/app/models/map_location.rb b/app/models/map_location.rb index 25adaeca8..3ab33af42 100644 --- a/app/models/map_location.rb +++ b/app/models/map_location.rb @@ -1,5 +1,4 @@ class MapLocation < ApplicationRecord - belongs_to :proposal, touch: true belongs_to :investment, class_name: "Budget::Investment", touch: true @@ -25,5 +24,4 @@ class MapLocation < ApplicationRecord map.longitude = heading.longitude.to_f if heading.longitude.present? map end - end diff --git a/app/models/milestone.rb b/app/models/milestone.rb index f36120fa1..8401a3a86 100644 --- a/app/models/milestone.rb +++ b/app/models/milestone.rb @@ -20,5 +20,4 @@ class Milestone < ApplicationRecord def self.title_max_length 80 end - end diff --git a/app/models/notification.rb b/app/models/notification.rb index e295c736c..10d045350 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -1,5 +1,4 @@ class Notification < ApplicationRecord - belongs_to :user, counter_cache: true belongs_to :notifiable, polymorphic: true @@ -93,5 +92,4 @@ class Notification < ApplicationRecord def self.first_batch_run_at Time.current end - end diff --git a/app/models/officing/residence.rb b/app/models/officing/residence.rb index 7ec430005..99bc61076 100644 --- a/app/models/officing/residence.rb +++ b/app/models/officing/residence.rb @@ -135,5 +135,4 @@ class Officing::Residence def random_password (0...20).map { ("a".."z").to_a[rand(26)] }.join end - end diff --git a/app/models/organization.rb b/app/models/organization.rb index 2b9be5071..32d545249 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -1,5 +1,4 @@ class Organization < ApplicationRecord - include Graphqlable belongs_to :user, touch: true @@ -65,5 +64,4 @@ class Organization < ApplicationRecord maximum: Organization.responsible_name_max_length) validator.validate(self) end - end diff --git a/app/models/poll/answer.rb b/app/models/poll/answer.rb index de8daffb1..ed9de7489 100644 --- a/app/models/poll/answer.rb +++ b/app/models/poll/answer.rb @@ -1,5 +1,4 @@ class Poll::Answer < ApplicationRecord - belongs_to :question, -> { with_hidden } belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id" diff --git a/app/models/poll/ballot.rb b/app/models/poll/ballot.rb index 55500cf02..fc1959ff0 100644 --- a/app/models/poll/ballot.rb +++ b/app/models/poll/ballot.rb @@ -32,5 +32,4 @@ class Poll::Ballot < ApplicationRecord def not_already_added?(investment) ballot.lines.where(investment: investment).blank? end - end diff --git a/app/models/poll/ballot_sheet.rb b/app/models/poll/ballot_sheet.rb index 787377419..34d735201 100644 --- a/app/models/poll/ballot_sheet.rb +++ b/app/models/poll/ballot_sheet.rb @@ -38,5 +38,4 @@ class Poll::BallotSheet < ApplicationRecord poll_ballot: poll_ballot, budget: poll.budget).first_or_create! end - end diff --git a/app/models/poll/officer.rb b/app/models/poll/officer.rb index c086c5610..5ecb7a139 100644 --- a/app/models/poll/officer.rb +++ b/app/models/poll/officer.rb @@ -32,6 +32,5 @@ class Poll def todays_booths officer_assignments.by_date(Date.current).map(&:booth).uniq end - end end diff --git a/app/models/poll/officer_assignment.rb b/app/models/poll/officer_assignment.rb index d619e5406..19aae0efb 100644 --- a/app/models/poll/officer_assignment.rb +++ b/app/models/poll/officer_assignment.rb @@ -32,6 +32,5 @@ class Poll def booth booth_assignment.booth end - end end diff --git a/app/models/poll/pair_answer.rb b/app/models/poll/pair_answer.rb index 215d638d7..73d2b2d78 100644 --- a/app/models/poll/pair_answer.rb +++ b/app/models/poll/pair_answer.rb @@ -1,5 +1,4 @@ class Poll::PairAnswer < ApplicationRecord - belongs_to :question, -> { with_hidden } belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id" belongs_to :answer_right, class_name: "Poll::Question::Answer", foreign_key: "answer_rigth_id" diff --git a/app/models/poll/partial_result.rb b/app/models/poll/partial_result.rb index cdb332558..bacd1dda1 100644 --- a/app/models/poll/partial_result.rb +++ b/app/models/poll/partial_result.rb @@ -1,5 +1,4 @@ class Poll::PartialResult < ApplicationRecord - VALID_ORIGINS = %w[web booth] belongs_to :question, -> { with_hidden } diff --git a/app/models/poll/question/answer.rb b/app/models/poll/question/answer.rb index c7ebc04f6..b24fddac1 100644 --- a/app/models/poll/question/answer.rb +++ b/app/models/poll/question/answer.rb @@ -97,5 +97,4 @@ class Poll::Question::Answer < ApplicationRecord is_most_voted = answers.none? { |a| a > total_votes } update!(most_voted: is_most_voted) end - end diff --git a/app/models/poll/recount.rb b/app/models/poll/recount.rb index 6414cbf2a..4b0626a5a 100644 --- a/app/models/poll/recount.rb +++ b/app/models/poll/recount.rb @@ -1,5 +1,4 @@ class Poll::Recount < ApplicationRecord - VALID_ORIGINS = %w[web booth letter].freeze belongs_to :author, -> { with_hidden }, class_name: "User", foreign_key: "author_id" diff --git a/app/models/poll/stats.rb b/app/models/poll/stats.rb index 4a3815dfd..6b687e3a3 100644 --- a/app/models/poll/stats.rb +++ b/app/models/poll/stats.rb @@ -120,5 +120,4 @@ class Poll::Stats def stats_cache(key, &block) Rails.cache.fetch("polls_stats/#{poll.id}/#{key}/#{version}", &block) end - end diff --git a/app/models/poll/voter.rb b/app/models/poll/voter.rb index 8b6b79fd2..02db44c25 100644 --- a/app/models/poll/voter.rb +++ b/app/models/poll/voter.rb @@ -1,6 +1,5 @@ class Poll class Voter < ApplicationRecord - VALID_ORIGINS = %w[web booth letter].freeze belongs_to :poll @@ -69,6 +68,5 @@ class Poll now.year - dob.year - (now.month > dob.month || (now.month == dob.month && now.day >= dob.day) ? 0 : 1) end end - end end diff --git a/app/models/progress_bar.rb b/app/models/progress_bar.rb index e9994f011..f60e4f2b3 100644 --- a/app/models/progress_bar.rb +++ b/app/models/progress_bar.rb @@ -19,5 +19,4 @@ class ProgressBar < ApplicationRecord validates :percentage, presence: true, inclusion: RANGE, numericality: { only_integer: true } validates_translation :title, presence: true, unless: :primary? - end diff --git a/app/models/proposal_notification.rb b/app/models/proposal_notification.rb index e3ccb67a9..a816d9ec1 100644 --- a/app/models/proposal_notification.rb +++ b/app/models/proposal_notification.rb @@ -59,5 +59,4 @@ class ProposalNotification < ApplicationRecord def set_author self.update(author_id: self.proposal.author_id) if self.proposal end - end diff --git a/app/models/remote_translation.rb b/app/models/remote_translation.rb index d669f9083..e9ef75a1c 100644 --- a/app/models/remote_translation.rb +++ b/app/models/remote_translation.rb @@ -1,5 +1,4 @@ class RemoteTranslation < ApplicationRecord - belongs_to :remote_translatable, polymorphic: true validates :remote_translatable_id, presence: true diff --git a/app/models/signature.rb b/app/models/signature.rb index 2c70db00b..0be00b3f0 100644 --- a/app/models/signature.rb +++ b/app/models/signature.rb @@ -95,5 +95,4 @@ class Signature < ApplicationRecord def document_types %w[1 2 3 4] end - end diff --git a/app/models/site_customization/image.rb b/app/models/site_customization/image.rb index bcfbdd376..0ebf1f929 100644 --- a/app/models/site_customization/image.rb +++ b/app/models/site_customization/image.rb @@ -46,5 +46,4 @@ class SiteCustomization::Image < ApplicationRecord errors.add(:image, :image_width, required_width: required_width) unless dimensions.width == required_width errors.add(:image, :image_height, required_height: required_height) unless dimensions.height == required_height end - end diff --git a/app/models/tag_cloud.rb b/app/models/tag_cloud.rb index ee3184b51..f76275558 100644 --- a/app/models/tag_cloud.rb +++ b/app/models/tag_cloud.rb @@ -1,5 +1,4 @@ class TagCloud - attr_accessor :resource_model, :scope def initialize(resource_model, scope = nil) @@ -34,5 +33,4 @@ class TagCloud def table_name resource_model.to_s.downcase.pluralize.gsub("::", "/") end - end diff --git a/app/models/topic.rb b/app/models/topic.rb index 8130c03da..fad39ee42 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -15,5 +15,4 @@ class Topic < ApplicationRecord scope :sort_by_newest, -> { order(created_at: :desc) } scope :sort_by_oldest, -> { order(created_at: :asc) } scope :sort_by_most_commented, -> { reorder(comments_count: :desc) } - end diff --git a/app/models/user.rb b/app/models/user.rb index a6abde504..5bf10c501 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,5 +1,4 @@ class User < ApplicationRecord - include Verification devise :database_authenticatable, :registerable, :confirmable, :recoverable, :rememberable, @@ -383,5 +382,4 @@ class User < ApplicationRecord maximum: User.username_max_length) validator.validate(self) end - end diff --git a/app/models/valuator.rb b/app/models/valuator.rb index 994f7ba58..d0e642c31 100644 --- a/app/models/valuator.rb +++ b/app/models/valuator.rb @@ -20,5 +20,4 @@ class Valuator < ApplicationRecord def assigned_investment_ids investment_ids + valuator_group&.investment_ids.to_a end - end diff --git a/app/models/verification/email.rb b/app/models/verification/email.rb index 91b981f24..0b24b43ed 100644 --- a/app/models/verification/email.rb +++ b/app/models/verification/email.rb @@ -33,5 +33,4 @@ class Verification::Email def self.valid_token?(user, token) Devise.token_generator.digest(User, :email_verification_token, user.email_verification_token) == token end - end diff --git a/app/models/verification/letter.rb b/app/models/verification/letter.rb index 2391b29be..70fb6324a 100644 --- a/app/models/verification/letter.rb +++ b/app/models/verification/letter.rb @@ -51,5 +51,4 @@ class Verification::Letter def generate_verification_code rand(100000..999999).to_s end - end diff --git a/app/models/verification/management/document.rb b/app/models/verification/management/document.rb index 080415e76..9ffc9ce6b 100644 --- a/app/models/verification/management/document.rb +++ b/app/models/verification/management/document.rb @@ -49,5 +49,4 @@ class Verification::Management::Document def verify user.update(verified_at: Time.current) if user? end - end diff --git a/app/models/verification/management/managed_user.rb b/app/models/verification/management/managed_user.rb index 7332b5f7e..45ed1bbab 100644 --- a/app/models/verification/management/managed_user.rb +++ b/app/models/verification/management/managed_user.rb @@ -6,5 +6,4 @@ class Verification::Management::ManagedUser find_or_initialize_by(document_type: document_type, document_number: document_number) end - end diff --git a/app/models/verification/residence.rb b/app/models/verification/residence.rb index c33de983d..840ed5b58 100644 --- a/app/models/verification/residence.rb +++ b/app/models/verification/residence.rb @@ -87,5 +87,4 @@ class Verification::Residence def clean_document_number self.document_number = document_number.gsub(/[^a-z0-9]+/i, "").upcase if document_number.present? end - end diff --git a/app/models/widget/feed.rb b/app/models/widget/feed.rb index 4dfce59f4..8947e8843 100644 --- a/app/models/widget/feed.rb +++ b/app/models/widget/feed.rb @@ -33,5 +33,4 @@ class Widget::Feed < ApplicationRecord def processes Legislation::Process.open.published.order("created_at DESC").limit(limit) end - end diff --git a/app/views/legislation/processes/resume_to_xlsx.xlsx.axlsx b/app/views/legislation/processes/resume_to_xlsx.xlsx.axlsx index b80e1d20c..6f120a3cb 100644 --- a/app/views/legislation/processes/resume_to_xlsx.xlsx.axlsx +++ b/app/views/legislation/processes/resume_to_xlsx.xlsx.axlsx @@ -33,5 +33,4 @@ wb.add_worksheet(name: "Resume") do |sheet| sheet.add_hyperlink :location => comment_url(comment), :ref => sheet.rows.last.cells.first end end - end diff --git a/config/environments/test.rb b/config/environments/test.rb index 452f78fd7..c7059f5c1 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -58,5 +58,4 @@ Rails.application.configure do Bullet.raise = true # raise an error if n+1 query occurs end end - end diff --git a/config/initializers/acts_as_taggable_on.rb b/config/initializers/acts_as_taggable_on.rb index 03f3f5efa..f1cff9c31 100644 --- a/config/initializers/acts_as_taggable_on.rb +++ b/config/initializers/acts_as_taggable_on.rb @@ -1,7 +1,5 @@ module ActsAsTaggableOn - Tagging.class_eval do - after_create :increment_tag_custom_counter after_destroy :touch_taggable, :decrement_tag_custom_counter @@ -28,7 +26,6 @@ module ActsAsTaggableOn end Tag.class_eval do - scope :category, -> { where(kind: "category") } def category? @@ -84,6 +81,5 @@ module ActsAsTaggableOn def custom_counter_field_name_for(taggable_type) "#{taggable_type.underscore.pluralize}_count" end - end end diff --git a/config/initializers/ahoy.rb b/config/initializers/ahoy.rb index a6bf60769..c3eb7109f 100644 --- a/config/initializers/ahoy.rb +++ b/config/initializers/ahoy.rb @@ -1,7 +1,6 @@ Ahoy.geocode = false class Ahoy::Store < Ahoy::Stores::ActiveRecordStore - # Track user IP def track_event(name, properties, options) super do |event| diff --git a/config/initializers/i18n_pluralize.rb b/config/initializers/i18n_pluralize.rb index 20698d6f0..fc109cae1 100644 --- a/config/initializers/i18n_pluralize.rb +++ b/config/initializers/i18n_pluralize.rb @@ -5,7 +5,6 @@ module I18n module Backend module Base - def pluralize(locale, entry, count) return entry unless entry.is_a?(Hash) && count @@ -13,7 +12,6 @@ module I18n return "#{count}" unless entry.has_key?(key) entry[key] end - end end end diff --git a/config/initializers/vote_extensions.rb b/config/initializers/vote_extensions.rb index fa0ceb6ca..2390eed14 100644 --- a/config/initializers/vote_extensions.rb +++ b/config/initializers/vote_extensions.rb @@ -32,5 +32,4 @@ ActsAsVotable::Vote.class_eval do def value vote_flag end - end diff --git a/config/routes.rb b/config/routes.rb index 1b30f8e2c..c538a12f1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,4 @@ Rails.application.routes.draw do - mount Ckeditor::Engine => "/ckeditor" mount LetterOpenerWeb::Engine, at: "/letter_opener" if Rails.env.development? diff --git a/config/routes/admin.rb b/config/routes/admin.rb index f7310709f..3863563fd 100644 --- a/config/routes/admin.rb +++ b/config/routes/admin.rb @@ -66,7 +66,6 @@ namespace :admin do end resources :budget_phases, only: [:edit, :update] - end resources :milestone_statuses, only: [:index, :new, :create, :update, :edit, :destroy] diff --git a/config/routes/legislation.rb b/config/routes/legislation.rb index b2a0aa734..9e0f2d04b 100644 --- a/config/routes/legislation.rb +++ b/config/routes/legislation.rb @@ -8,7 +8,6 @@ namespace :legislation do get :proposals get :milestones get :resume - end resources :questions, only: [:show] do diff --git a/config/sitemap.rb b/config/sitemap.rb index 7a840a1ed..405b9297d 100644 --- a/config/sitemap.rb +++ b/config/sitemap.rb @@ -38,5 +38,4 @@ SitemapGenerator::Sitemap.create do Legislation::Process.find_each do |process| add legislation_process_path(process), lastmod: process.start_date end - end diff --git a/db/dev_seeds/polls.rb b/db/dev_seeds/polls.rb index ce51cf6f1..6890903ec 100644 --- a/db/dev_seeds/polls.rb +++ b/db/dev_seeds/polls.rb @@ -2,7 +2,6 @@ require_dependency "poll/answer" require_dependency "poll/question/answer" section "Creating polls" do - Poll.create!(name: I18n.t("seeds.polls.current_poll"), slug: I18n.t("seeds.polls.current_poll").parameterize, starts_at: 7.days.ago, @@ -44,7 +43,6 @@ section "Creating polls" do end poll.save! end - end section "Creating Poll Questions & Answers" do @@ -121,7 +119,6 @@ section "Commenting Polls" do end section "Creating Poll Voters" do - def vote_poll_on_booth(user, poll) officer = Poll::Officer.all.sample diff --git a/db/dev_seeds/widgets.rb b/db/dev_seeds/widgets.rb index b5742a292..e6ff947e6 100644 --- a/db/dev_seeds/widgets.rb +++ b/db/dev_seeds/widgets.rb @@ -1,5 +1,4 @@ section "Creating header and cards for the homepage" do - def create_image_attachment(type) { cached_attachment: Rails.root.join("db/dev_seeds/images/#{type}_background.jpg"), diff --git a/doc/api/examples/ruby/example_2.rb b/doc/api/examples/ruby/example_2.rb index 9309eca88..426779add 100644 --- a/doc/api/examples/ruby/example_2.rb +++ b/doc/api/examples/ruby/example_2.rb @@ -41,7 +41,6 @@ next_cursor = nil proposals = [] loop do - puts "> Requesting page #{page_number}" query = build_query(page_size: 25, page_number: page_number, next_cursor: next_cursor) diff --git a/lib/active_model/dates.rb b/lib/active_model/dates.rb index 0b4b1c55a..1fbd8ce28 100644 --- a/lib/active_model/dates.rb +++ b/lib/active_model/dates.rb @@ -1,5 +1,4 @@ module ActiveModel::Dates - def parse_date(field, attrs) year, month, day = attrs["#{field}(1i)"], attrs["#{field}(2i)"], @@ -12,5 +11,4 @@ module ActiveModel::Dates def remove_date(field, attrs) attrs.except("#{field}(1i)", "#{field}(2i)", "#{field}(3i)") end - end diff --git a/lib/acts_as_paranoid_aliases.rb b/lib/acts_as_paranoid_aliases.rb index 45e3300df..871f72665 100644 --- a/lib/acts_as_paranoid_aliases.rb +++ b/lib/acts_as_paranoid_aliases.rb @@ -1,9 +1,7 @@ module ActsAsParanoidAliases - def self.included(base) base.extend(ClassMethods) class_eval do - def hide return false if hidden? update_attribute(:hidden_at, Time.current) diff --git a/lib/census_api.rb b/lib/census_api.rb index 5b06d957e..57fe8fe78 100644 --- a/lib/census_api.rb +++ b/lib/census_api.rb @@ -1,6 +1,5 @@ include DocumentParser class CensusApi - def call(document_type, document_number) response = nil get_document_number_variants(document_type, document_number).each do |variant| @@ -122,5 +121,4 @@ class CensusApi def stubbed_invalid_response { get_habita_datos_response: { get_habita_datos_return: { datos_habitante: {}, datos_vivienda: {}}}} end - end diff --git a/lib/census_caller.rb b/lib/census_caller.rb index 71b3404b5..c6f55d530 100644 --- a/lib/census_caller.rb +++ b/lib/census_caller.rb @@ -1,5 +1,4 @@ class CensusCaller - def call(document_type, document_number, date_of_birth, postal_code) if Setting["feature.remote_census"].present? response = RemoteCensusApi.new.call(document_type, document_number, date_of_birth, postal_code) diff --git a/lib/comment_tree.rb b/lib/comment_tree.rb index b06eee833..d5743f311 100644 --- a/lib/comment_tree.rb +++ b/lib/comment_tree.rb @@ -1,5 +1,4 @@ class CommentTree - ROOT_COMMENTS_PER_PAGE = 10 attr_reader :commentable, :page, :order diff --git a/lib/document_parser.rb b/lib/document_parser.rb index 73130d34c..60ebd9d59 100644 --- a/lib/document_parser.rb +++ b/lib/document_parser.rb @@ -1,5 +1,4 @@ module DocumentParser - def get_document_number_variants(document_type, document_number) # Delete all non-alphanumerics document_number = document_number.to_s.gsub(/[^0-9A-Za-z]/i, "") @@ -61,5 +60,4 @@ module DocumentParser def dni?(document_type) document_type.to_s == "1" end - end diff --git a/lib/email_digest.rb b/lib/email_digest.rb index 8a6bba23c..7de26ff88 100644 --- a/lib/email_digest.rb +++ b/lib/email_digest.rb @@ -1,5 +1,4 @@ class EmailDigest - attr_accessor :user def initialize(user) @@ -29,5 +28,4 @@ class EmailDigest def valid_email? user.email.present? && user.email.match(/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i) end - end diff --git a/lib/evaluation_comment_email.rb b/lib/evaluation_comment_email.rb index 6321e43dd..42114be56 100644 --- a/lib/evaluation_comment_email.rb +++ b/lib/evaluation_comment_email.rb @@ -22,6 +22,7 @@ class EvaluationCommentEmail end private + def related_users return [] if comment.commentable.nil? comment.commentable diff --git a/lib/graph_ql/api_types_creator.rb b/lib/graph_ql/api_types_creator.rb index b7cb6c369..0fca95f61 100644 --- a/lib/graph_ql/api_types_creator.rb +++ b/lib/graph_ql/api_types_creator.rb @@ -29,9 +29,7 @@ module GraphQL end def self.create_type(model, fields, created_types) - created_types[model] = GraphQL::ObjectType.define do - name model.graphql_type_name description model.graphql_type_description @@ -54,7 +52,6 @@ module GraphQL end end end - end end diff --git a/lib/graph_ql/query_type_creator.rb b/lib/graph_ql/query_type_creator.rb index 159e859ab..35c2b4d2c 100644 --- a/lib/graph_ql/query_type_creator.rb +++ b/lib/graph_ql/query_type_creator.rb @@ -2,7 +2,6 @@ require "graphql" module GraphQL class QueryTypeCreator - def self.create(api_types) GraphQL::ObjectType.define do name "QueryType" @@ -22,10 +21,8 @@ module GraphQL description model.graphql_pluralized_field_description resolve ->(object, arguments, context) { model.public_for_api } end - end end end - end end diff --git a/lib/local_census.rb b/lib/local_census.rb index 1ff5112a5..1f6d3f903 100644 --- a/lib/local_census.rb +++ b/lib/local_census.rb @@ -1,6 +1,5 @@ include DocumentParser class LocalCensus - def call(document_type, document_number) record = nil get_document_number_variants(document_type, document_number).each do |variant| @@ -62,5 +61,4 @@ class LocalCensus def get_record(document_type, document_number) LocalCensusRecord.find_by(document_type: document_type, document_number: document_number) end - end diff --git a/lib/manager_authenticator.rb b/lib/manager_authenticator.rb index 8d8de2396..bd8048fda 100644 --- a/lib/manager_authenticator.rb +++ b/lib/manager_authenticator.rb @@ -1,5 +1,4 @@ class ManagerAuthenticator - def initialize(data = {}) @manager = { login: data[:login], user_key: data[:clave_usuario], date: data[:fecha_conexion] }.with_indifferent_access end diff --git a/lib/merged_comment_tree.rb b/lib/merged_comment_tree.rb index 81916908e..9194a8562 100644 --- a/lib/merged_comment_tree.rb +++ b/lib/merged_comment_tree.rb @@ -9,5 +9,4 @@ class MergedCommentTree < CommentTree def base_comments Comment.where(commentable: commentables.flatten) end - end diff --git a/lib/remote_census_api.rb b/lib/remote_census_api.rb index e579b3e42..4c922364a 100644 --- a/lib/remote_census_api.rb +++ b/lib/remote_census_api.rb @@ -1,6 +1,5 @@ include DocumentParser class RemoteCensusApi - def call(document_type, document_number, date_of_birth, postal_code) response = nil get_document_number_variants(document_type, document_number).each do |variant| @@ -154,5 +153,4 @@ class RemoteCensusApi def stubbed_invalid_response { get_habita_datos_response: { get_habita_datos_return: { datos_habitante: {}, datos_vivienda: {}}}} end - end diff --git a/lib/remote_translations/microsoft/available_locales.rb b/lib/remote_translations/microsoft/available_locales.rb index bb46b723f..430e38b2e 100644 --- a/lib/remote_translations/microsoft/available_locales.rb +++ b/lib/remote_translations/microsoft/available_locales.rb @@ -4,7 +4,6 @@ require "cgi" require "json" class RemoteTranslations::Microsoft::AvailableLocales - def self.available_locales daily_cache("locales") do remote_available_locales.map { |locale| locale.first } @@ -51,5 +50,4 @@ class RemoteTranslations::Microsoft::AvailableLocales def self.daily_cache(key, &block) Rails.cache.fetch("remote_available_locales/#{Time.current.strftime("%Y-%m-%d")}/#{key}", &block) end - end diff --git a/lib/remote_translations/microsoft/client.rb b/lib/remote_translations/microsoft/client.rb index f3bd2295b..5c4f33d34 100644 --- a/lib/remote_translations/microsoft/client.rb +++ b/lib/remote_translations/microsoft/client.rb @@ -77,5 +77,4 @@ class RemoteTranslations::Microsoft::Client def notranslate?(text) text.downcase == PREVENTING_TRANSLATION_KEY end - end diff --git a/lib/remote_translations/microsoft/sentences_parser.rb b/lib/remote_translations/microsoft/sentences_parser.rb index bdf0e446d..9e48ca4ac 100644 --- a/lib/remote_translations/microsoft/sentences_parser.rb +++ b/lib/remote_translations/microsoft/sentences_parser.rb @@ -1,5 +1,4 @@ module RemoteTranslations::Microsoft::SentencesParser - def detect_split_position(text) limit = RemoteTranslations::Microsoft::Client::CHARACTERS_LIMIT_PER_REQUEST minimum_valid_index = text.size - limit @@ -21,5 +20,4 @@ module RemoteTranslations::Microsoft::SentencesParser def characters_count(texts) texts.map(&:size).reduce(:+) end - end diff --git a/lib/score_calculator.rb b/lib/score_calculator.rb index 2ca6e3eda..1bad85c14 100644 --- a/lib/score_calculator.rb +++ b/lib/score_calculator.rb @@ -1,5 +1,4 @@ module ScoreCalculator - def self.hot_score(resource) return 0 unless resource.created_at @@ -31,5 +30,4 @@ module ScoreCalculator def self.resource_age(resource) ((Time.current - resource.created_at) / 1.day).ceil end - end diff --git a/lib/sms_api.rb b/lib/sms_api.rb index 69a0d93a1..5b2237532 100644 --- a/lib/sms_api.rb +++ b/lib/sms_api.rb @@ -53,5 +53,4 @@ class SMSApi } } end - end diff --git a/lib/tag_sanitizer.rb b/lib/tag_sanitizer.rb index 538ab8c1e..4a15ab1b8 100644 --- a/lib/tag_sanitizer.rb +++ b/lib/tag_sanitizer.rb @@ -16,5 +16,4 @@ class TagSanitizer def self.tag_max_length 160 end - end diff --git a/lib/tasks/budgets.rake b/lib/tasks/budgets.rake index eb4d49b7c..4efe30ee5 100644 --- a/lib/tasks/budgets.rake +++ b/lib/tasks/budgets.rake @@ -1,6 +1,5 @@ namespace :budgets do namespace :email do - desc "Sends emails to authors of selected investments" task selected: :environment do Budget.last.email_selected @@ -10,7 +9,6 @@ namespace :budgets do task unselected: :environment do Budget.last.email_unselected end - end desc "Update investments original_heading_id with current heading_id" @@ -23,5 +21,4 @@ namespace :budgets do print "." end end - end diff --git a/lib/tasks/dashboards.rake b/lib/tasks/dashboards.rake index 84e5face6..20663efd8 100644 --- a/lib/tasks/dashboards.rake +++ b/lib/tasks/dashboards.rake @@ -1,5 +1,4 @@ namespace :dashboards do - desc "Send to user notifications from new actions availability on dashboard" task send_notifications: :environment do Proposal.not_archived.each do |proposal| diff --git a/lib/tasks/votes.rake b/lib/tasks/votes.rake index 8248e5cb1..cfa30b14e 100644 --- a/lib/tasks/votes.rake +++ b/lib/tasks/votes.rake @@ -1,5 +1,4 @@ namespace :votes do - desc "Resets cached_votes_up counter to its latest value" task reset_vote_counter: :environment do models = [Proposal, Budget::Investment] @@ -10,7 +9,6 @@ namespace :votes do print "." end end - end desc "Resets hot_score to its new value" diff --git a/lib/wysiwyg_sanitizer.rb b/lib/wysiwyg_sanitizer.rb index 1a6c430f4..26a13620d 100644 --- a/lib/wysiwyg_sanitizer.rb +++ b/lib/wysiwyg_sanitizer.rb @@ -10,5 +10,4 @@ class WYSIWYGSanitizer def sanitize(html) ActionController::Base.helpers.sanitize(html, tags: allowed_tags, attributes: allowed_attributes) end - end diff --git a/spec/controllers/admin/api/stats_controller_spec.rb b/spec/controllers/admin/api/stats_controller_spec.rb index f45d5e59d..5dcdd19a1 100644 --- a/spec/controllers/admin/api/stats_controller_spec.rb +++ b/spec/controllers/admin/api/stats_controller_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Admin::Api::StatsController do - describe "GET index" do let(:user) { create(:administrator).user } diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index d68787f35..c6d77bfe4 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" describe ApplicationController do - describe "#current_budget" do - it "returns the last budget that is not in draft phase" do create(:budget, :finished, created_at: 2.years.ago, name: "Old") create(:budget, :accepting, created_at: 1.year.ago, name: "Previous") @@ -13,7 +11,5 @@ describe ApplicationController do budget = subject.instance_eval { current_budget } expect(budget.name).to eq("Current") end - end - end diff --git a/spec/controllers/budgets/ballots/lines_controller_spec.rb b/spec/controllers/budgets/ballots/lines_controller_spec.rb index 641a90a95..be1fa3e1c 100644 --- a/spec/controllers/budgets/ballots/lines_controller_spec.rb +++ b/spec/controllers/budgets/ballots/lines_controller_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" describe Budgets::Ballot::LinesController do - describe "#load_budget" do - it "raises an error if budget slug is not found" do controller.params[:budget_id] = "wrong_budget" @@ -19,7 +17,5 @@ describe Budgets::Ballot::LinesController do controller.send(:load_budget) end.to raise_error ActiveRecord::RecordNotFound end - end - end diff --git a/spec/controllers/comments_controller_spec.rb b/spec/controllers/comments_controller_spec.rb index 5640ba2af..9ec1af021 100644 --- a/spec/controllers/comments_controller_spec.rb +++ b/spec/controllers/comments_controller_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe CommentsController do - describe "POST create" do let(:legal_process) do create(:legislation_process, debate_start_date: Date.current - 3.days, diff --git a/spec/controllers/concerns/has_filters_spec.rb b/spec/controllers/concerns/has_filters_spec.rb index feedbccc4..f4cade052 100644 --- a/spec/controllers/concerns/has_filters_spec.rb +++ b/spec/controllers/concerns/has_filters_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe HasFilters do - class FakeController < ActionController::Base; end controller(FakeController) do diff --git a/spec/controllers/concerns/has_orders_spec.rb b/spec/controllers/concerns/has_orders_spec.rb index f2e0abb43..f37b7c59a 100644 --- a/spec/controllers/concerns/has_orders_spec.rb +++ b/spec/controllers/concerns/has_orders_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe HasOrders do - class FakeController < ActionController::Base; end controller(FakeController) do diff --git a/spec/controllers/concerns/remotely_translatable_spec.rb b/spec/controllers/concerns/remotely_translatable_spec.rb index 69ab80845..149ce0c4f 100644 --- a/spec/controllers/concerns/remotely_translatable_spec.rb +++ b/spec/controllers/concerns/remotely_translatable_spec.rb @@ -2,15 +2,12 @@ require "rails_helper" include RemotelyTranslatable describe RemotelyTranslatable do - before do Setting["feature.remote_translations"] = true end describe "#detect_remote_translations" do - describe "Should detect remote_translations" do - it "When collections and featured_proposals are not defined in current locale" do proposals = create_list(:proposal, 3) featured_proposals = create_featured_proposals @@ -49,7 +46,6 @@ describe RemotelyTranslatable do expect(detect_remote_translations(widget_feeds).count).to eq 9 end end - end it "When defined in current locale should not detect remote_translations" do diff --git a/spec/controllers/debates_controller_spec.rb b/spec/controllers/debates_controller_spec.rb index 6a7409dec..af108f906 100644 --- a/spec/controllers/debates_controller_spec.rb +++ b/spec/controllers/debates_controller_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe DebatesController do - describe "POST create" do before do InvisibleCaptcha.timestamp_enabled = false diff --git a/spec/controllers/installation_controller_spec.rb b/spec/controllers/installation_controller_spec.rb index 33b2cdb87..01b496a5d 100644 --- a/spec/controllers/installation_controller_spec.rb +++ b/spec/controllers/installation_controller_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe InstallationController, type: :request do - describe "consul.json" do let(:test_feature_settings) do { diff --git a/spec/controllers/legislation/annotations_controller_spec.rb b/spec/controllers/legislation/annotations_controller_spec.rb index 99761f984..b309d7910 100644 --- a/spec/controllers/legislation/annotations_controller_spec.rb +++ b/spec/controllers/legislation/annotations_controller_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" describe Legislation::AnnotationsController do - describe "POST create" do - let(:legal_process) do create(:legislation_process, allegations_start_date: Date.current - 3.days, allegations_end_date: Date.current + 2.days) @@ -162,6 +160,5 @@ describe Legislation::AnnotationsController do expect(annotation.reload.comments_count).to eq(2) expect(annotation.comments.last.body).to eq("una anotacion") end - end end diff --git a/spec/controllers/legislation/answers_controller_spec.rb b/spec/controllers/legislation/answers_controller_spec.rb index 864a11d4e..b45b97e6f 100644 --- a/spec/controllers/legislation/answers_controller_spec.rb +++ b/spec/controllers/legislation/answers_controller_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" describe Legislation::AnswersController do - describe "POST create" do - let(:legal_process) do create(:legislation_process, debate_start_date: Date.current - 3.days, debate_end_date: Date.current + 2.days) diff --git a/spec/controllers/management/base_controller_spec.rb b/spec/controllers/management/base_controller_spec.rb index ca0fa7528..da0a15cbb 100644 --- a/spec/controllers/management/base_controller_spec.rb +++ b/spec/controllers/management/base_controller_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" describe Management::BaseController do - describe "managed_user" do - it "returns existent user with session document info if present" do session[:document_type] = "1" session[:document_number] = "333333333E" @@ -23,5 +21,4 @@ describe Management::BaseController do expect(managed_user.document_number).to eq "333333333E" end end - end diff --git a/spec/controllers/management/sessions_controller_spec.rb b/spec/controllers/management/sessions_controller_spec.rb index daf4441b1..ed6a32674 100644 --- a/spec/controllers/management/sessions_controller_spec.rb +++ b/spec/controllers/management/sessions_controller_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" describe Management::SessionsController do - describe "Sign in" do - it "denies access if wrong manager credentials" do allow_any_instance_of(ManagerAuthenticator).to receive(:auth).and_return(false) get :create, params: { login: "nonexistent", clave_usuario: "wrong" } @@ -66,5 +64,4 @@ describe Management::SessionsController do expect(response).to be_redirect end end - end diff --git a/spec/controllers/management/users_controller_spec.rb b/spec/controllers/management/users_controller_spec.rb index ac8df0652..78f80a6b0 100644 --- a/spec/controllers/management/users_controller_spec.rb +++ b/spec/controllers/management/users_controller_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Management::UsersController do - describe "logout" do it "removes user data from the session" do session[:manager] = { user_key: "31415926", date: "20151031135905", login: "JJB033" } @@ -16,5 +15,4 @@ describe Management::UsersController do expect(response).to be_redirect end end - end diff --git a/spec/controllers/pages_controller_spec.rb b/spec/controllers/pages_controller_spec.rb index 00d3e1962..ed46a77b0 100644 --- a/spec/controllers/pages_controller_spec.rb +++ b/spec/controllers/pages_controller_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe PagesController do - describe "Static pages" do it "includes a privacy page" do get :show, params: { id: :privacy } @@ -20,7 +19,6 @@ describe PagesController do end describe "More info pages" do - it "includes a more info page" do get :show, params: { id: "help/index" } expect(response).to be_ok @@ -48,5 +46,4 @@ describe PagesController do expect(response).to be_missing end end - end diff --git a/spec/controllers/related_contents_controller_spec.rb b/spec/controllers/related_contents_controller_spec.rb index c792a267e..791276f1d 100644 --- a/spec/controllers/related_contents_controller_spec.rb +++ b/spec/controllers/related_contents_controller_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe RelatedContentsController do - describe "#score" do it "raises an error if related content does not exist" do controller.params[:id] = 0 @@ -11,5 +10,4 @@ describe RelatedContentsController do end.to raise_error ActiveRecord::RecordNotFound end end - end diff --git a/spec/controllers/remote_translation_controller_spec.rb b/spec/controllers/remote_translation_controller_spec.rb index 13b1b9000..ab4399f9a 100644 --- a/spec/controllers/remote_translation_controller_spec.rb +++ b/spec/controllers/remote_translation_controller_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe RemoteTranslationsController do - describe "POST create", :delay_jobs do let(:debate) { create(:debate) } @@ -42,6 +41,5 @@ describe RemoteTranslationsController do expect(subject).to redirect_to("any_path") end - end end diff --git a/spec/controllers/users/registrations_controller_spec.rb b/spec/controllers/users/registrations_controller_spec.rb index 2de191c8d..65230fefc 100644 --- a/spec/controllers/users/registrations_controller_spec.rb +++ b/spec/controllers/users/registrations_controller_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" describe Users::RegistrationsController do - describe "POST check_username" do - before do request.env["devise.mapping"] = Devise.mappings[:user] end @@ -28,7 +26,5 @@ describe Users::RegistrationsController do expect(data[:message]).to eq I18n.t("devise_views.users.registrations.new.username_is_not_available") end end - end - end diff --git a/spec/customization_engine_spec.rb b/spec/customization_engine_spec.rb index d8a22cc37..7a1016add 100644 --- a/spec/customization_engine_spec.rb +++ b/spec/customization_engine_spec.rb @@ -4,7 +4,6 @@ require "rails_helper" # TODO test models, controllers, etc... describe "Customization Engine" do - let(:test_key) { I18n.t("account.show.change_credentials_link") } let!(:default_path) { I18n.load_path } @@ -37,5 +36,4 @@ describe "Customization Engine" do I18n.load_path += path I18n.reload! end - end diff --git a/spec/factories/votation_type.rb b/spec/factories/votation_type.rb index bea74e3fe..263cc04db 100644 --- a/spec/factories/votation_type.rb +++ b/spec/factories/votation_type.rb @@ -72,6 +72,5 @@ FactoryBot.define do trait :prioritized do prioritized { true } end - end end diff --git a/spec/features/account_spec.rb b/spec/features/account_spec.rb index b66060f63..68ebba52c 100644 --- a/spec/features/account_spec.rb +++ b/spec/features/account_spec.rb @@ -104,7 +104,6 @@ describe "Account" do end context "Option to display badge for official position" do - scenario "Users with official position of level 1" do official_user = create(:user, official_level: 1) @@ -133,7 +132,6 @@ describe "Account" do expect(page).not_to have_css "#account_official_position_badge" end - end scenario "Errors on edit" do @@ -208,6 +206,5 @@ describe "Account" do expect(user.recommended_debates).to be(false) expect(user.recommended_proposals).to be(false) end - end end diff --git a/spec/features/admin/activity_spec.rb b/spec/features/admin/activity_spec.rb index 6d34df147..d83c29d9f 100644 --- a/spec/features/admin/activity_spec.rb +++ b/spec/features/admin/activity_spec.rb @@ -353,5 +353,4 @@ describe "Admin activity" do end end end - end diff --git a/spec/features/admin/admin_notifications_spec.rb b/spec/features/admin/admin_notifications_spec.rb index dbf564563..1829e2d60 100644 --- a/spec/features/admin/admin_notifications_spec.rb +++ b/spec/features/admin/admin_notifications_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin Notifications" do - before do create(:budget) login_as(create(:administrator).user) diff --git a/spec/features/admin/administrators_spec.rb b/spec/features/admin/administrators_spec.rb index e9c585a6e..ae17dd478 100644 --- a/spec/features/admin/administrators_spec.rb +++ b/spec/features/admin/administrators_spec.rb @@ -40,7 +40,6 @@ describe "Admin administrators" do end scenario "Delete Administrator when its the current user" do - within "#administrator_#{admin.id}" do click_on "Delete" end @@ -115,5 +114,4 @@ describe "Admin administrators" do expect(page).to have_content("Admin Alias") end end - end diff --git a/spec/features/admin/banners_spec.rb b/spec/features/admin/banners_spec.rb index 9c82bd882..af9246a5f 100644 --- a/spec/features/admin/banners_spec.rb +++ b/spec/features/admin/banners_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin banners magement" do - before do login_as(create(:administrator).user) end diff --git a/spec/features/admin/budget_groups_spec.rb b/spec/features/admin/budget_groups_spec.rb index 2f155327e..a257d47e6 100644 --- a/spec/features/admin/budget_groups_spec.rb +++ b/spec/features/admin/budget_groups_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin budget groups" do - let(:budget) { create(:budget, :drafting) } before do @@ -10,7 +9,6 @@ describe "Admin budget groups" do end context "Feature flag" do - before do Setting["process.budgets"] = nil end @@ -20,11 +18,9 @@ describe "Admin budget groups" do visit admin_budget_groups_path(budget) end.to raise_exception(FeatureFlags::FeatureDisabled) end - end context "Load" do - let!(:budget) { create(:budget, slug: "budget_slug") } let!(:group) { create(:budget_group, slug: "group_slug", budget: budget) } @@ -57,11 +53,9 @@ describe "Admin budget groups" do visit edit_admin_budget_group_path(budget, 0) end.to raise_error ActiveRecord::RecordNotFound end - end context "Index" do - scenario "Displaying no groups for budget" do visit admin_budget_groups_path(budget) @@ -122,11 +116,9 @@ describe "Admin budget groups" do expect(page).to have_content "You cannot delete a Group that has associated headings" expect(page).to have_selector "#budget_group_#{group.id}" end - end context "New" do - scenario "Create group" do visit admin_budget_groups_path(budget) click_link "Create new group" @@ -157,11 +149,9 @@ describe "Admin budget groups" do expect(page).to have_css(".is-invalid-label", text: "Group name") expect(page).to have_content "can't be blank" end - end context "Edit" do - scenario "Show group information" do group = create(:budget_group, budget: budget, max_votable_headings: 2) 2.times { create(:budget_heading, group: group) } @@ -196,7 +186,6 @@ describe "Admin budget groups" do expect(group.reload.slug).not_to eq old_slug expect(group.slug).to eq "new-english-name" end - end context "Update" do @@ -232,6 +221,5 @@ describe "Admin budget groups" do expect(page).to have_css(".is-invalid-label", text: "Group name") expect(page).to have_css("small.form-error", text: "has already been taken") end - end end diff --git a/spec/features/admin/budget_headings_spec.rb b/spec/features/admin/budget_headings_spec.rb index 2c2eb7fd0..e626521cc 100644 --- a/spec/features/admin/budget_headings_spec.rb +++ b/spec/features/admin/budget_headings_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin budget headings" do - let(:budget) { create(:budget, :drafting) } let(:group) { create(:budget_group, budget: budget) } @@ -11,7 +10,6 @@ describe "Admin budget headings" do end context "Feature flag" do - before do Setting["process.budgets"] = nil end @@ -21,11 +19,9 @@ describe "Admin budget headings" do visit admin_budget_group_headings_path(budget, group) end.to raise_exception(FeatureFlags::FeatureDisabled) end - end context "Load" do - let!(:budget) { create(:budget, slug: "budget_slug") } let!(:group) { create(:budget_group, slug: "group_slug", budget: budget) } let!(:heading) { create(:budget_heading, slug: "heading_slug", group: group) } @@ -75,7 +71,6 @@ describe "Admin budget headings" do end context "Index" do - scenario "Displaying no headings for group" do visit admin_budget_group_headings_path(budget, group) @@ -138,11 +133,9 @@ describe "Admin budget headings" do expect(page).to have_content "You cannot delete a Heading that has associated investments" expect(page).to have_content "Atlantis" end - end context "New" do - scenario "Create heading" do visit admin_budget_group_headings_path(budget, group) click_link "Create new heading" @@ -178,11 +171,9 @@ describe "Admin budget headings" do expect(page).to have_css(".is-invalid-label", text: "Amount") expect(page).to have_content "can't be blank" end - end context "Edit" do - scenario "Show heading information" do heading = create(:budget_heading, group: group) @@ -220,7 +211,6 @@ describe "Admin budget headings" do expect(heading.reload.slug).not_to eq old_slug expect(heading.slug).to eq "new-english-name" end - end context "Update" do @@ -277,6 +267,5 @@ describe "Admin budget headings" do expect(page).to have_css(".is-invalid-label", text: "Heading name") expect(page).to have_css("small.form-error", text: "has already been taken") end - end end diff --git a/spec/features/admin/budget_investments_spec.rb b/spec/features/admin/budget_investments_spec.rb index f51c23aa5..93d55e92a 100644 --- a/spec/features/admin/budget_investments_spec.rb +++ b/spec/features/admin/budget_investments_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin budget investments" do - let(:budget) { create(:budget) } let(:administrator) do create(:administrator, user: create(:user, username: "Ana", email: "ana@admins.org")) @@ -16,7 +15,6 @@ describe "Admin budget investments" do end context "Feature flag" do - before do Setting["process.budgets"] = nil end @@ -24,7 +22,6 @@ describe "Admin budget investments" do scenario "Disabled with a feature flag" do expect { visit admin_budgets_path }.to raise_exception(FeatureFlags::FeatureDisabled) end - end context "Load" do @@ -49,11 +46,9 @@ describe "Admin budget investments" do visit admin_budget_budget_investments_path(0, investment) end.to raise_error ActiveRecord::RecordNotFound end - end context "Index" do - scenario "Displaying investments" do budget_investment = create(:budget_investment, budget: budget, cached_votes_up: 77) visit admin_budget_budget_investments_path(budget_id: budget.id) @@ -682,7 +677,6 @@ describe "Admin budget investments" do expect(page).not_to have_content("More hospitals") expect(page).to have_content("Selected") - end scenario "Combination of select with text search", :js do @@ -717,7 +711,6 @@ describe "Admin budget investments" do expect(page).not_to have_content("More hospitals") expect(page).to have_content("Selected") - end scenario "Combination of checkbox with text search and checkbox", :js do @@ -787,7 +780,6 @@ describe "Admin budget investments" do visit admin_budget_budget_investments_path(budget_id: not_finished_budget.id) expect(page).not_to have_content "See results" end - end context "Search" do @@ -961,7 +953,6 @@ describe "Admin budget investments" do end context "Show" do - scenario "Show the investment details" do user = create(:user, username: "Rachel", email: "rachel@valuators.org") valuator = create(:valuator, user: user) @@ -1062,7 +1053,6 @@ describe "Admin budget investments" do end context "Edit" do - scenario "Change title, incompatible, description or heading" do budget_investment = create(:budget_investment, :incompatible) create(:budget_heading, group: budget_investment.group, name: "Barbate") @@ -1356,7 +1346,6 @@ describe "Admin budget investments" do expect(page).to have_content "Investment project updated succesfully." expect(page).to have_content("Milestone Tags: tag1, tag2") end - end context "Selecting" do @@ -1698,7 +1687,6 @@ describe "Admin budget investments" do end context "Selecting csv" do - scenario "Downloading CSV file" do create(:budget_investment, budget: budget) @@ -1841,7 +1829,6 @@ describe "Admin budget investments" do expect(cookie_value).to eq("id,supports,admin,geozone,feasibility,valuation_finished," + "visible_to_valuators,selected,incompatible,author") - end scenario "Select an investment when some columns are not displayed", :js do @@ -1859,5 +1846,4 @@ describe "Admin budget investments" do end end end - end diff --git a/spec/features/admin/budget_phases_spec.rb b/spec/features/admin/budget_phases_spec.rb index b185e5fa1..6f3f4f7ef 100644 --- a/spec/features/admin/budget_phases_spec.rb +++ b/spec/features/admin/budget_phases_spec.rb @@ -4,7 +4,6 @@ describe "Admin budget phases" do let(:budget) { create(:budget) } context "Edit" do - before do admin = create(:administrator) login_as(admin.user) diff --git a/spec/features/admin/budgets_spec.rb b/spec/features/admin/budgets_spec.rb index 1db26b847..964a42211 100644 --- a/spec/features/admin/budgets_spec.rb +++ b/spec/features/admin/budgets_spec.rb @@ -1,14 +1,12 @@ require "rails_helper" describe "Admin budgets" do - before do admin = create(:administrator) login_as(admin.user) end context "Feature flag" do - before do Setting["process.budgets"] = nil end @@ -16,11 +14,9 @@ describe "Admin budgets" do scenario "Disabled with a feature flag" do expect { visit admin_budgets_path }.to raise_exception(FeatureFlags::FeatureDisabled) end - end context "Load" do - let!(:budget) { create(:budget, slug: "budget_slug") } scenario "finds budget by slug" do @@ -39,11 +35,9 @@ describe "Admin budgets" do visit admin_budget_path(0) end.to raise_error ActiveRecord::RecordNotFound end - end context "Index" do - scenario "Displaying no open budgets text" do visit admin_budgets_path @@ -105,11 +99,9 @@ describe "Admin budgets" do end end end - end context "New" do - scenario "Create budget" do visit admin_budgets_path click_link "Create new budget" @@ -142,11 +134,9 @@ describe "Admin budgets" do expect(page).to have_css(".is-invalid-label", text: "Name") expect(page).to have_css("small.form-error", text: "has already been taken") end - end context "Destroy" do - let!(:budget) { create(:budget) } let(:heading) { create(:budget_heading, budget: budget) } @@ -193,7 +183,6 @@ describe "Admin budgets" do expect(page).to have_select("budget_phase", selected: "Selecting projects") within "#budget-phases-table" do - Budget::Phase::PHASE_KINDS.each do |phase_kind| phase_index = Budget::Phase::PHASE_KINDS.index(phase_kind) break if phase_kind == Budget::Phase::PHASE_KINDS.last @@ -239,11 +228,9 @@ describe "Admin budgets" do expect(budget.reload.slug).not_to eq old_slug expect(budget.slug).to eq "new-english-name" end - end context "Update" do - before do create(:budget) end @@ -258,11 +245,9 @@ describe "Admin budgets" do expect(page).to have_content("More trees on the streets") expect(page).to have_current_path(admin_budgets_path) end - end context "Calculate Budget's Winner Investments" do - scenario "For a Budget in reviewing balloting", :js do budget = create(:budget, :reviewing_ballots) heading = create(:budget_heading, budget: budget, price: 4) @@ -312,7 +297,6 @@ describe "Admin budgets" do expect(page).to have_content "Recalculate Winner Investments" expect(page).not_to have_content "Calculate Winner Investments" end - end end diff --git a/spec/features/admin/change_log_spec.rb b/spec/features/admin/change_log_spec.rb index ce58a27b5..74636f7c7 100644 --- a/spec/features/admin/change_log_spec.rb +++ b/spec/features/admin/change_log_spec.rb @@ -64,6 +64,5 @@ describe "Admin change log" do expect(page).to have_content("Edited at") expect(page).to have_content("Edited by") end - end end diff --git a/spec/features/admin/comments_spec.rb b/spec/features/admin/comments_spec.rb index 7806df96e..ad7378460 100644 --- a/spec/features/admin/comments_spec.rb +++ b/spec/features/admin/comments_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin comments" do - before do admin = create(:administrator) login_as(admin.user) @@ -136,5 +135,4 @@ describe "Admin comments" do expect(current_url).to include("filter=with_confirmed_hide") expect(current_url).to include("page=2") end - end diff --git a/spec/features/admin/dashboard/administrator_tasks_spec.rb b/spec/features/admin/dashboard/administrator_tasks_spec.rb index f5520cbc0..b9178905e 100644 --- a/spec/features/admin/dashboard/administrator_tasks_spec.rb +++ b/spec/features/admin/dashboard/administrator_tasks_spec.rb @@ -33,7 +33,6 @@ describe "Admin administrator tasks" do scenario "has a link that allows solving the request" do expect(page).to have_link("Solve") end - end end diff --git a/spec/features/admin/debates_spec.rb b/spec/features/admin/debates_spec.rb index 8b978b0a7..cdf56384b 100644 --- a/spec/features/admin/debates_spec.rb +++ b/spec/features/admin/debates_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin debates" do - scenario "Disabled with a feature flag" do Setting["process.debates"] = nil admin = create(:administrator) @@ -98,5 +97,4 @@ describe "Admin debates" do expect(current_url).to include("filter=with_confirmed_hide") expect(current_url).to include("page=2") end - end diff --git a/spec/features/admin/download_settings_spec.rb b/spec/features/admin/download_settings_spec.rb index 3ce2d41bb..a676b513a 100644 --- a/spec/features/admin/download_settings_spec.rb +++ b/spec/features/admin/download_settings_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin download settings" do - before do admin = create(:administrator) login_as(admin.user) @@ -30,7 +29,6 @@ describe "Admin download settings" do end context "Download debates" do - before do create(:debate) end @@ -83,13 +81,11 @@ describe "Admin download settings" do end context "Download proposals" do - before do create(:proposal) end scenario "admin csv" do - visit admin_proposals_path click_button "Download" @@ -121,7 +117,6 @@ describe "Admin download settings" do end scenario "Update download settings comments" do - visit admin_edit_download_settings_path(resource: "comments") find(:css, "#downloadable_[value='id']").set(true) @@ -155,11 +150,9 @@ describe "Admin download settings" do visit admin_edit_download_settings_path(resource: "legislation_processes") expect(page).to have_content("Legislation process") - end scenario "Update download settings legislation process" do - visit admin_edit_download_settings_path(resource: "legislation_processes") find(:css, "#downloadable_[value='id']").set(true) @@ -176,14 +169,12 @@ describe "Admin download settings" do end context "Download legislation process" do - before do create(:legislation_process, :open) create(:legislation_process, :published) end scenario "admin csv" do - visit admin_legislation_processes_path click_button "Download" @@ -212,11 +203,9 @@ describe "Admin download settings" do visit admin_edit_download_settings_path(resource: "budget_investments") expect(page).to have_content("Participatory budgeting") - end scenario "Update download settings budget investment results" do - visit admin_edit_download_settings_path(resource: "budget_investments") find(:css, "#downloadable_[value='id']").set(true) @@ -236,11 +225,9 @@ describe "Admin download settings" do visit admin_edit_download_settings_path(resource: "budget_investments", config: 1) expect(page).to have_content("Participatory budgeting - Milestones") - end scenario "Update download settings budget investment milestones" do - visit admin_edit_download_settings_path(resource: "budget_investments", config: 1) find(:css, "#downloadable_[value='id']").set(true) @@ -319,5 +306,4 @@ describe "Admin download settings" do expect(content_type).to match("text/csv") end end - end diff --git a/spec/features/admin/emails/emails_download_spec.rb b/spec/features/admin/emails/emails_download_spec.rb index fce00f9a0..382107199 100644 --- a/spec/features/admin/emails/emails_download_spec.rb +++ b/spec/features/admin/emails/emails_download_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin download user emails" do - let(:admin_user) { create(:user, newsletter: false, email: "admin@consul.dev") } before do @@ -10,7 +9,6 @@ describe "Admin download user emails" do end context "Download only emails from segment users with newsletter flag & present email " do - before do create(:user, email: "user@consul.dev") diff --git a/spec/features/admin/emails/newsletters_spec.rb b/spec/features/admin/emails/newsletters_spec.rb index fc04a0218..a1acb8ef4 100644 --- a/spec/features/admin/emails/newsletters_spec.rb +++ b/spec/features/admin/emails/newsletters_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin newsletter emails" do - before do create(:budget) login_as(create(:administrator).user) diff --git a/spec/features/admin/feature_flags_spec.rb b/spec/features/admin/feature_flags_spec.rb index 6fbc6c758..76e478f3f 100644 --- a/spec/features/admin/feature_flags_spec.rb +++ b/spec/features/admin/feature_flags_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin feature flags" do - before do Setting["process.budgets"] = true login_as(create(:administrator).user) @@ -102,5 +101,4 @@ describe "Admin feature flags" do expect(page).not_to have_button "Enable" end end - end diff --git a/spec/features/admin/geozones_spec.rb b/spec/features/admin/geozones_spec.rb index 896f1c4f5..621579ca2 100644 --- a/spec/features/admin/geozones_spec.rb +++ b/spec/features/admin/geozones_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin geozones" do - before do login_as(create(:administrator).user) end diff --git a/spec/features/admin/hidden_budget_investments_spec.rb b/spec/features/admin/hidden_budget_investments_spec.rb index 871930a9c..678b35ecf 100644 --- a/spec/features/admin/hidden_budget_investments_spec.rb +++ b/spec/features/admin/hidden_budget_investments_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin hidden budget investments" do - let(:budget) { create(:budget) } let(:heading) { create(:budget_heading, budget: budget, price: 666666) } @@ -101,5 +100,4 @@ describe "Admin hidden budget investments" do expect(current_url).to include("filter=with_confirmed_hide") expect(current_url).to include("page=2") end - end diff --git a/spec/features/admin/hidden_proposals_spec.rb b/spec/features/admin/hidden_proposals_spec.rb index 6635b2614..366bbcbaa 100644 --- a/spec/features/admin/hidden_proposals_spec.rb +++ b/spec/features/admin/hidden_proposals_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin hidden proposals" do - before do admin = create(:administrator) login_as(admin.user) @@ -100,5 +99,4 @@ describe "Admin hidden proposals" do expect(current_url).to include("filter=with_confirmed_hide") expect(current_url).to include("page=2") end - end diff --git a/spec/features/admin/hidden_users_spec.rb b/spec/features/admin/hidden_users_spec.rb index 3e90cbed0..349472a64 100644 --- a/spec/features/admin/hidden_users_spec.rb +++ b/spec/features/admin/hidden_users_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin hidden users" do - before do admin = create(:administrator) login_as(admin.user) @@ -93,5 +92,4 @@ describe "Admin hidden users" do expect(current_url).to include("filter=with_confirmed_hide") expect(current_url).to include("page=2") end - end diff --git a/spec/features/admin/homepage/homepage_spec.rb b/spec/features/admin/homepage/homepage_spec.rb index 765e7647e..80225fe42 100644 --- a/spec/features/admin/homepage/homepage_spec.rb +++ b/spec/features/admin/homepage/homepage_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Homepage" do - before do Setting["homepage.widgets.feeds.proposals"] = false Setting["homepage.widgets.feeds.debates"] = false @@ -20,9 +19,7 @@ describe "Homepage" do let(:user) { create(:user) } context "Header" do - scenario "Admin menu links to homepage path" do - visit new_admin_widget_card_path(header_card: true) click_link Setting["org_name"] + " Administration" @@ -32,7 +29,6 @@ describe "Homepage" do end context "Feeds" do - scenario "Proposals", :js do 5.times { create(:proposal) } @@ -120,7 +116,6 @@ describe "Homepage" do end xscenario "Deactivate" - end scenario "Cards" do @@ -175,5 +170,4 @@ describe "Homepage" do expect(page).to have_content("Recommendations that may interest you") end - end diff --git a/spec/features/admin/legislation/draft_versions_spec.rb b/spec/features/admin/legislation/draft_versions_spec.rb index 6880dc927..e6c12238d 100644 --- a/spec/features/admin/legislation/draft_versions_spec.rb +++ b/spec/features/admin/legislation/draft_versions_spec.rb @@ -1,24 +1,20 @@ require "rails_helper" describe "Admin legislation draft versions" do - before do admin = create(:administrator) login_as(admin.user) end context "Feature flag" do - scenario "Disabled with a feature flag" do Setting["process.legislation"] = nil process = create(:legislation_process) expect { visit admin_legislation_process_draft_versions_path(process) }.to raise_exception(FeatureFlags::FeatureDisabled) end - end context "Index" do - scenario "Displaying legislation process draft versions" do process = create(:legislation_process, title: "An example legislation process") draft_version = create(:legislation_draft_version, process: process, title: "Version 1") diff --git a/spec/features/admin/legislation/processes_spec.rb b/spec/features/admin/legislation/processes_spec.rb index f75b1bfb9..04d271bd9 100644 --- a/spec/features/admin/legislation/processes_spec.rb +++ b/spec/features/admin/legislation/processes_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin collaborative legislation" do - before do admin = create(:administrator) login_as(admin.user) @@ -12,17 +11,14 @@ describe "Admin collaborative legislation" do "admin_legislation_process_milestones_path" context "Feature flag" do - scenario "Disabled with a feature flag" do Setting["process.legislation"] = nil expect { visit admin_legislation_processes_path } .to raise_exception(FeatureFlags::FeatureDisabled) end - end context "Index" do - scenario "Displaying collaborative legislation" do process_1 = create(:legislation_process, title: "Process open") process_2 = create(:legislation_process, title: "Process for the future", @@ -62,7 +58,6 @@ describe "Admin collaborative legislation" do expect(process_3.title).to appear_before(process_2.title) expect(process_2.title).to appear_before(process_1.title) end - end context "Create" do @@ -189,7 +184,6 @@ describe "Admin collaborative legislation" do expect(find("#legislation_process_background_color").value).to eq "#e7f2fc" expect(find("#legislation_process_font_color").value).to eq "#222222" end - end context "Update" do diff --git a/spec/features/admin/legislation/proposals_spec.rb b/spec/features/admin/legislation/proposals_spec.rb index 06d56ff11..fce0757d5 100644 --- a/spec/features/admin/legislation/proposals_spec.rb +++ b/spec/features/admin/legislation/proposals_spec.rb @@ -1,14 +1,12 @@ require "rails_helper" describe "Admin collaborative legislation" do - before do admin = create(:administrator) login_as(admin.user) end context "Index" do - scenario "Displaying legislation proposals" do proposal = create(:legislation_proposal, cached_votes_score: 10) @@ -81,5 +79,4 @@ describe "Admin collaborative legislation" do end end end - end diff --git a/spec/features/admin/legislation/questions_spec.rb b/spec/features/admin/legislation/questions_spec.rb index 0541b249f..c2db6cdf8 100644 --- a/spec/features/admin/legislation/questions_spec.rb +++ b/spec/features/admin/legislation/questions_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin legislation questions" do - before do admin = create(:administrator) login_as(admin.user) @@ -10,7 +9,6 @@ describe "Admin legislation questions" do let!(:process) { create(:legislation_process, title: "An example legislation process") } context "Feature flag" do - before do Setting["process.legislation"] = nil end @@ -18,11 +16,9 @@ describe "Admin legislation questions" do scenario "Disabled with a feature flag" do expect { visit admin_legislation_process_questions_path(process) }.to raise_exception(FeatureFlags::FeatureDisabled) end - end context "Index" do - scenario "Displaying legislation process questions" do create(:legislation_question, process: process, title: "Question 1") create(:legislation_question, process: process, title: "Question 2") diff --git a/spec/features/admin/local_census_records/imports_spec.rb b/spec/features/admin/local_census_records/imports_spec.rb index 6b22cba4f..a45873189 100644 --- a/spec/features/admin/local_census_records/imports_spec.rb +++ b/spec/features/admin/local_census_records/imports_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Imports" do - let(:base_files_path) { %w[spec fixtures files local_census_records import] } before do diff --git a/spec/features/admin/local_census_records_spec.rb b/spec/features/admin/local_census_records_spec.rb index f11abfbd8..6b137bb26 100644 --- a/spec/features/admin/local_census_records_spec.rb +++ b/spec/features/admin/local_census_records_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin local census records" do - before do login_as(create(:administrator).user) end diff --git a/spec/features/admin/managers_spec.rb b/spec/features/admin/managers_spec.rb index 0061f08dc..49bc43b66 100644 --- a/spec/features/admin/managers_spec.rb +++ b/spec/features/admin/managers_spec.rb @@ -81,5 +81,4 @@ describe "Admin managers" do expect(page).not_to have_content(manager1.email) end end - end diff --git a/spec/features/admin/milestone_statuses_spec.rb b/spec/features/admin/milestone_statuses_spec.rb index 11e77f33b..8f4540fe4 100644 --- a/spec/features/admin/milestone_statuses_spec.rb +++ b/spec/features/admin/milestone_statuses_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin milestone statuses" do - before do admin = create(:administrator) login_as(admin.user) @@ -91,5 +90,4 @@ describe "Admin milestone statuses" do expect(page).not_to have_content status.description end end - end diff --git a/spec/features/admin/moderators_spec.rb b/spec/features/admin/moderators_spec.rb index cb2a6cd6a..4f9846564 100644 --- a/spec/features/admin/moderators_spec.rb +++ b/spec/features/admin/moderators_spec.rb @@ -81,5 +81,4 @@ describe "Admin moderators" do expect(page).not_to have_content(moderator1.email) end end - end diff --git a/spec/features/admin/organizations_spec.rb b/spec/features/admin/organizations_spec.rb index d10826361..01364d9e2 100644 --- a/spec/features/admin/organizations_spec.rb +++ b/spec/features/admin/organizations_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin::Organizations" do - before do administrator = create(:user) create(:administrator, user: administrator) @@ -214,5 +213,4 @@ describe "Admin::Organizations" do expect(current_url).to include("filter=pending") expect(current_url).to include("page=2") end - end diff --git a/spec/features/admin/poll/active_polls_spec.rb b/spec/features/admin/poll/active_polls_spec.rb index ebd6ab51b..a2978f941 100644 --- a/spec/features/admin/poll/active_polls_spec.rb +++ b/spec/features/admin/poll/active_polls_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin Active polls" do - before do admin = create(:administrator) login_as(admin.user) @@ -40,5 +39,4 @@ describe "Admin Active polls" do expect(page).to have_content "New description" end end - end diff --git a/spec/features/admin/poll/booth_assigments_spec.rb b/spec/features/admin/poll/booth_assigments_spec.rb index 18e19186b..b1e5b2463 100644 --- a/spec/features/admin/poll/booth_assigments_spec.rb +++ b/spec/features/admin/poll/booth_assigments_spec.rb @@ -1,14 +1,12 @@ require "rails_helper" describe "Admin booths assignments" do - before do admin = create(:administrator) login_as(admin.user) end describe "Admin Booth Assignment management" do - let!(:poll) { create(:poll) } let!(:booth) { create(:poll_booth) } @@ -147,7 +145,6 @@ describe "Admin booths assignments" do expect(page).not_to have_link "Unassign booth" end - end end @@ -325,6 +322,5 @@ describe "Admin booths assignments" do expect(page).to have_content "There are no results" end - end end diff --git a/spec/features/admin/poll/booths_spec.rb b/spec/features/admin/poll/booths_spec.rb index 8480a0d9b..7e0c006f5 100644 --- a/spec/features/admin/poll/booths_spec.rb +++ b/spec/features/admin/poll/booths_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin booths" do - before do admin = create(:administrator) login_as(admin.user) diff --git a/spec/features/admin/poll/officer_assignments_spec.rb b/spec/features/admin/poll/officer_assignments_spec.rb index b2735bcae..c9530fb66 100644 --- a/spec/features/admin/poll/officer_assignments_spec.rb +++ b/spec/features/admin/poll/officer_assignments_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Officer Assignments" do - before do admin = create(:administrator) login_as(admin.user) @@ -45,5 +44,4 @@ describe "Officer Assignments" do expect(page).not_to have_content "John Edwards" end end - end diff --git a/spec/features/admin/poll/officers_spec.rb b/spec/features/admin/poll/officers_spec.rb index b6a0dd619..d714a540b 100644 --- a/spec/features/admin/poll/officers_spec.rb +++ b/spec/features/admin/poll/officers_spec.rb @@ -31,5 +31,4 @@ describe "Admin poll officers" do expect(page).not_to have_css "#officers" end - end diff --git a/spec/features/admin/poll/polls_spec.rb b/spec/features/admin/poll/polls_spec.rb index 54aac11a5..e8cc5009c 100644 --- a/spec/features/admin/poll/polls_spec.rb +++ b/spec/features/admin/poll/polls_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin polls" do - before do admin = create(:administrator) login_as(admin.user) @@ -116,7 +115,6 @@ describe "Admin polls" do end context "Destroy" do - scenario "Can destroy poll without questions", :js do poll = create(:poll) @@ -164,9 +162,7 @@ describe "Admin polls" do end context "Booths" do - context "Poll show" do - scenario "No booths" do poll = create(:poll) visit admin_poll_path(poll) @@ -196,9 +192,7 @@ describe "Admin polls" do end context "Officers" do - context "Poll show" do - scenario "No officers", :js do poll = create(:poll) visit admin_poll_path(poll) @@ -234,9 +228,7 @@ describe "Admin polls" do end context "Questions" do - context "Poll show" do - scenario "Question list", :js do poll = create(:poll) question = create(:poll_question, poll: poll) @@ -250,9 +242,7 @@ describe "Admin polls" do expect(page).to have_content votation_type_question.title expect(page).not_to have_content other_question.title expect(page).not_to have_content "There are no questions assigned to this poll" - end - end end @@ -520,5 +510,4 @@ describe "Admin polls" do end end end - end diff --git a/spec/features/admin/poll/questions/answers/answers_spec.rb b/spec/features/admin/poll/questions/answers/answers_spec.rb index 4ed637f38..fdd1a4863 100644 --- a/spec/features/admin/poll/questions/answers/answers_spec.rb +++ b/spec/features/admin/poll/questions/answers/answers_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Answers" do - before do admin = create(:administrator) login_as admin.user @@ -59,5 +58,4 @@ describe "Answers" do expect("Another title").to appear_before("New title") end - end diff --git a/spec/features/admin/poll/questions/answers/documents/documents_spec.rb b/spec/features/admin/poll/questions/answers/documents/documents_spec.rb index 629b12460..c32569e7c 100644 --- a/spec/features/admin/poll/questions/answers/documents/documents_spec.rb +++ b/spec/features/admin/poll/questions/answers/documents/documents_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Documents" do - before do admin = create(:administrator) login_as(admin.user) @@ -38,5 +37,4 @@ describe "Documents" do expect(page).not_to have_content(document.title) end - end diff --git a/spec/features/admin/poll/questions/answers/images/images_spec.rb b/spec/features/admin/poll/questions/answers/images/images_spec.rb index db8b7a26d..b3a2c205e 100644 --- a/spec/features/admin/poll/questions/answers/images/images_spec.rb +++ b/spec/features/admin/poll/questions/answers/images/images_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Images" do - before do admin = create(:administrator) login_as(admin.user) @@ -58,5 +57,4 @@ describe "Images" do expect(page).not_to have_css("img[title='#{image.title}']") expect(page).not_to have_content(image.title) end - end diff --git a/spec/features/admin/poll/questions/answers/videos/videos_spec.rb b/spec/features/admin/poll/questions/answers/videos/videos_spec.rb index a801accaa..91a314c44 100644 --- a/spec/features/admin/poll/questions/answers/videos/videos_spec.rb +++ b/spec/features/admin/poll/questions/answers/videos/videos_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Videos" do - before do admin = create(:administrator) login_as(admin.user) @@ -29,5 +28,4 @@ describe "Videos" do expect(page).to have_content(video_title) expect(page).to have_content(video_url) end - end diff --git a/spec/features/admin/poll/questions_spec.rb b/spec/features/admin/poll/questions_spec.rb index 5af0f58cf..5b7848d25 100644 --- a/spec/features/admin/poll/questions_spec.rb +++ b/spec/features/admin/poll/questions_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin poll questions" do - before do login_as(create(:administrator).user) end @@ -357,9 +356,7 @@ describe "Admin poll questions" do pending "Mark all city by default when creating a poll question from a successful proposal" context "Poll select box" do - scenario "translates the poll name in options", :js do - poll = create(:poll, name_en: "Name in English", name_es: "Nombre en Español") proposal = create(:proposal) diff --git a/spec/features/admin/poll/shifts_spec.rb b/spec/features/admin/poll/shifts_spec.rb index 0932a6ed2..2a668caf3 100644 --- a/spec/features/admin/poll/shifts_spec.rb +++ b/spec/features/admin/poll/shifts_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin shifts" do - before do admin = create(:administrator) login_as(admin.user) @@ -260,5 +259,4 @@ describe "Admin shifts" do expect(page).to have_content "This booth has no shifts" end - end diff --git a/spec/features/admin/proposal_notifications_spec.rb b/spec/features/admin/proposal_notifications_spec.rb index c2977daed..3d4cef4fd 100644 --- a/spec/features/admin/proposal_notifications_spec.rb +++ b/spec/features/admin/proposal_notifications_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin proposal notifications" do - before do admin = create(:administrator) login_as(admin.user) @@ -91,5 +90,4 @@ describe "Admin proposal notifications" do expect(current_url).to include("filter=with_confirmed_hide") expect(current_url).to include("page=2") end - end diff --git a/spec/features/admin/proposals_spec.rb b/spec/features/admin/proposals_spec.rb index 173710572..0fa9c569a 100644 --- a/spec/features/admin/proposals_spec.rb +++ b/spec/features/admin/proposals_spec.rb @@ -10,7 +10,6 @@ describe "Admin proposals" do "admin_proposal_path" context "Index" do - scenario "Search" do create(:proposal, title: "Make Pluto a planet again") create(:proposal, title: "Build a monument to honour CONSUL developers") @@ -49,11 +48,9 @@ describe "Admin proposals" do within("#proposal_#{proposal.id}") { expect(page).to have_link "Select" } expect(proposal.reload.selected?).to be false end - end context "Show" do - scenario "View proposal" do create(:proposal, title: "Create a chaotic future", summary: "Chaos isn't controlled") @@ -105,6 +102,5 @@ describe "Admin proposals" do expect(find_field("Mark as selected")).not_to be_checked expect(proposal.reload.selected?).to be false end - end end diff --git a/spec/features/admin/settings_spec.rb b/spec/features/admin/settings_spec.rb index 00b115d5d..02e56c04a 100644 --- a/spec/features/admin/settings_spec.rb +++ b/spec/features/admin/settings_spec.rb @@ -31,7 +31,6 @@ describe "Admin settings" do end describe "Update map" do - scenario "Should not be able when map feature deactivated" do Setting["feature.map"] = false admin = create(:administrator).user @@ -97,11 +96,9 @@ describe "Admin settings" do expect(find("#latitude", visible: false).value).not_to eq "51.48" expect(page).to have_content "Map configuration updated succesfully" end - end describe "Update content types" do - scenario "stores the correct mime types" do setting = Setting.create!(key: "upload.images.content_types", value: "image/png") admin = create(:administrator).user @@ -131,11 +128,9 @@ describe "Admin settings" do expect(find("#jpg")).not_to be_checked end end - end describe "Update Remote Census Configuration" do - before do Setting["feature.remote_census"] = true end @@ -165,13 +160,10 @@ describe "Admin settings" do '"Configure connection to remote census (SOAP)" ' \ 'on "Features" tab.' end - end describe "Should redirect to same tab after update setting" do - context "remote census" do - before do Setting["feature.remote_census"] = true end @@ -210,7 +202,6 @@ describe "Admin settings" do end context "map configuration" do - before do Setting["feature.map"] = true end @@ -280,7 +271,6 @@ describe "Admin settings" do end describe "Skip verification" do - scenario "deactivate skip verification", :js do Setting["feature.user.skip_verification"] = "true" setting = Setting.where(key: "feature.user.skip_verification").first @@ -310,7 +300,5 @@ describe "Admin settings" do Setting["feature.user.skip_verification"] = nil end - end - end diff --git a/spec/features/admin/signature_sheets_spec.rb b/spec/features/admin/signature_sheets_spec.rb index 57f6ca7a8..a0ba61dda 100644 --- a/spec/features/admin/signature_sheets_spec.rb +++ b/spec/features/admin/signature_sheets_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Signature sheets" do - before do admin = create(:administrator) login_as(admin.user) @@ -73,11 +72,9 @@ describe "Signature sheets" do expect(page).to have_content "1 support" end - end context "Create throught all required_fields_to_verify of custom census api" do - before do Setting["feature.remote_census"] = true Setting["remote_census.request.date_of_birth"] = "some.value" @@ -123,7 +120,6 @@ describe "Signature sheets" do expect(page).to have_content "1 support" end - end scenario "Errors on create" do @@ -162,5 +158,4 @@ describe "Signature sheets" do expect(page).to have_content 2 end end - end diff --git a/spec/features/admin/site_customization/content_blocks_spec.rb b/spec/features/admin/site_customization/content_blocks_spec.rb index 52179593a..6b30f0aae 100644 --- a/spec/features/admin/site_customization/content_blocks_spec.rb +++ b/spec/features/admin/site_customization/content_blocks_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin custom content blocks" do - before do admin = create(:administrator) login_as(admin.user) diff --git a/spec/features/admin/site_customization/documents_spec.rb b/spec/features/admin/site_customization/documents_spec.rb index 3d13b30b8..1b62b0a4d 100644 --- a/spec/features/admin/site_customization/documents_spec.rb +++ b/spec/features/admin/site_customization/documents_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Documents" do - before do admin = create(:administrator) login_as(admin.user) @@ -85,5 +84,4 @@ describe "Documents" do expect(page).to have_content "Document deleted succesfully" expect(page).not_to have_content document.title end - end diff --git a/spec/features/admin/site_customization/images_spec.rb b/spec/features/admin/site_customization/images_spec.rb index 59961c71e..98d91e32f 100644 --- a/spec/features/admin/site_customization/images_spec.rb +++ b/spec/features/admin/site_customization/images_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin custom images" do - before do admin = create(:administrator) login_as(admin.user) diff --git a/spec/features/admin/site_customization/information_texts_spec.rb b/spec/features/admin/site_customization/information_texts_spec.rb index b80684abc..82a61bbcb 100644 --- a/spec/features/admin/site_customization/information_texts_spec.rb +++ b/spec/features/admin/site_customization/information_texts_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin custom information texts" do - before do admin = create(:administrator) login_as(admin.user) @@ -57,7 +56,6 @@ describe "Admin custom information texts" do end context "Globalization" do - scenario "Add a translation", :js do key = "debates.index.section_footer.title" @@ -130,5 +128,4 @@ describe "Admin custom information texts" do expect(debate_title.value_en).to eq("Custom debate title") end end - end diff --git a/spec/features/admin/site_customization/pages_spec.rb b/spec/features/admin/site_customization/pages_spec.rb index 17b619659..42042f028 100644 --- a/spec/features/admin/site_customization/pages_spec.rb +++ b/spec/features/admin/site_customization/pages_spec.rb @@ -1,14 +1,12 @@ require "rails_helper" describe "Admin custom pages" do - before do admin = create(:administrator) login_as(admin.user) end context "Index" do - scenario "lists all created custom pages" do custom_page = create(:site_customization_page) visit admin_site_customization_pages_path @@ -33,7 +31,6 @@ describe "Admin custom pages" do expect(page).to have_content slug end end - end context "Create" do diff --git a/spec/features/admin/stats_spec.rb b/spec/features/admin/stats_spec.rb index 8d28eedff..5b9e39616 100644 --- a/spec/features/admin/stats_spec.rb +++ b/spec/features/admin/stats_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Stats" do - before do admin = create(:administrator) login_as(admin.user) @@ -9,7 +8,6 @@ describe "Stats" do end context "Summary" do - scenario "General" do create(:debate) 2.times { create(:proposal) } @@ -36,11 +34,9 @@ describe "Stats" do expect(page).to have_content "Comment votes 3" expect(page).to have_content "Total votes 6" end - end context "Users" do - scenario "Summary" do 1.times { create(:user, :level_three) } 2.times { create(:user, :level_two) } @@ -94,11 +90,9 @@ describe "Stats" do expect(page).to have_content "Level two users 1" end - end describe "Budget investments" do - context "Supporting phase" do let(:budget) { create(:budget) } let(:group_all_city) { create(:budget_group, budget: budget) } @@ -224,11 +218,9 @@ describe "Stats" do expect(page).to have_content "Participants 2" end end - end context "graphs" do - scenario "event graphs", :js do campaign = create(:campaign) @@ -245,11 +237,9 @@ describe "Stats" do expect(page).to have_content event_created_at.strftime("%Y-%m-%d") end end - end context "Proposal notifications" do - scenario "Summary stats" do proposal = create(:proposal) @@ -296,11 +286,9 @@ describe "Stats" do expect(page).to have_content proposal_notification.body expect(page).to have_content "Proposal not available" end - end context "Direct messages" do - scenario "Summary stats" do sender = create(:user, :level_two) @@ -319,11 +307,9 @@ describe "Stats" do expect(page).to have_content "2" end end - end context "Polls" do - scenario "Total participants by origin" do create(:poll_officer_assignment) 3.times { create(:poll_voter, origin: "web") } @@ -369,7 +355,6 @@ describe "Stats" do end within("#polls") do - within("#poll_#{poll1.id}") do expect(page).to have_content "1" end @@ -377,7 +362,6 @@ describe "Stats" do within("#poll_#{poll2.id}") do expect(page).to have_content "2" end - end end @@ -412,7 +396,5 @@ describe "Stats" do expect(page).to have_content "2" end end - end - end diff --git a/spec/features/admin/system_emails_spec.rb b/spec/features/admin/system_emails_spec.rb index 9be884a2a..0e1d3a3ec 100644 --- a/spec/features/admin/system_emails_spec.rb +++ b/spec/features/admin/system_emails_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "System Emails" do - let(:admin) { create(:administrator) } before do @@ -9,7 +8,6 @@ describe "System Emails" do end context "Index" do - let(:system_emails_with_preview) { %w[proposal_notification_digest] } let(:system_emails) do %w[proposal_notification_digest budget_investment_created budget_investment_selected @@ -19,7 +17,6 @@ describe "System Emails" do end context "System emails" do - scenario "have 'View' button" do visit admin_system_emails_path @@ -29,11 +26,9 @@ describe "System Emails" do end end end - end context "System emails with preview" do - scenario "have 'Preview Pending' and 'Send pending' buttons" do visit admin_system_emails_path @@ -49,11 +44,9 @@ describe "System Emails" do end end end - end context "System emails with info" do - scenario "have information about how to edit the email templates" do visit admin_system_emails_path @@ -69,11 +62,9 @@ describe "System Emails" do end end end - end context "View" do - let(:user) { create(:user, :level_two, username: "John Doe") } let(:budget) { create(:budget, name: "Budget for 2019") } let(:heading) { create(:budget_heading, budget: budget) } @@ -267,7 +258,6 @@ describe "System Emails" do expect(page).to have_link "Cleaner city", href: admin_budget_budget_investment_url(investment.budget, investment, anchor: "comments") end - end context "Preview Pending" do @@ -336,5 +326,4 @@ describe "System Emails" do expect(page).to have_content("Pending notifications sent succesfully") end end - end diff --git a/spec/features/admin/tags_spec.rb b/spec/features/admin/tags_spec.rb index 1bad1ccf6..2dec574f3 100644 --- a/spec/features/admin/tags_spec.rb +++ b/spec/features/admin/tags_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin tags" do - before do create(:tag, :category, name: "Existence") login_as(create(:administrator).user) @@ -89,5 +88,4 @@ describe "Admin tags" do expect(Tag.category.where(name: "wow_category")).to exist end end - end diff --git a/spec/features/admin/valuator_groups_spec.rb b/spec/features/admin/valuator_groups_spec.rb index 5a5e54927..4a7d2445d 100644 --- a/spec/features/admin/valuator_groups_spec.rb +++ b/spec/features/admin/valuator_groups_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Valuator groups" do - let(:admin) { create(:administrator).user } before do @@ -117,7 +116,5 @@ describe "Valuator groups" do expect(page).to have_content "Valuator updated successfully" expect(page).not_to have_content "Health" end - end - end diff --git a/spec/features/admin/valuators_spec.rb b/spec/features/admin/valuators_spec.rb index 65c8a5d7f..181055273 100644 --- a/spec/features/admin/valuators_spec.rb +++ b/spec/features/admin/valuators_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Admin valuators" do - let(:admin) { create(:administrator) } let!(:user) { create(:user, username: "Jose Luis Balbin") } let!(:valuator) { create(:valuator) } @@ -110,5 +109,4 @@ describe "Admin valuators" do expect(page).not_to have_content(valuator1.email) end end - end diff --git a/spec/features/admin/verifications_spec.rb b/spec/features/admin/verifications_spec.rb index 49a7c015c..798114419 100644 --- a/spec/features/admin/verifications_spec.rb +++ b/spec/features/admin/verifications_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Incomplete verifications" do - before do admin = create(:administrator) login_as(admin.user) @@ -71,5 +70,4 @@ describe "Incomplete verifications" do expect(page).to have_content "Has not confirmed the sms code" end end - end diff --git a/spec/features/admin/widgets/cards_spec.rb b/spec/features/admin/widgets/cards_spec.rb index cafd94fa2..4d8189f1d 100644 --- a/spec/features/admin/widgets/cards_spec.rb +++ b/spec/features/admin/widgets/cards_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Cards" do - before do admin = create(:administrator).user login_as(admin) @@ -109,7 +108,6 @@ describe "Cards" do end context "Header Card" do - scenario "Create" do visit admin_homepage_path click_link "Create header" @@ -219,9 +217,7 @@ describe "Cards" do expect(page).to have_current_path admin_site_customization_page_cards_path(custom_page) expect(page).not_to have_content "Card title" end - end - end pending "add image expectactions" diff --git a/spec/features/admin_spec.rb b/spec/features/admin_spec.rb index 47ac36eab..982956398 100644 --- a/spec/features/admin_spec.rb +++ b/spec/features/admin_spec.rb @@ -84,5 +84,4 @@ describe "Admin" do expect(page).not_to have_css("#moderation_menu") expect(page).not_to have_css("#valuation_menu") end - end diff --git a/spec/features/banners_spec.rb b/spec/features/banners_spec.rb index 3a9503bec..24c001225 100644 --- a/spec/features/banners_spec.rb +++ b/spec/features/banners_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Banner" do - scenario "The banner is shown correctly" do create(:web_section, name: "homepage") banner = create(:banner, title: "Hello", diff --git a/spec/features/budget_polls/ballot_sheets_spec.rb b/spec/features/budget_polls/ballot_sheets_spec.rb index ee8c70f32..8745d18a1 100644 --- a/spec/features/budget_polls/ballot_sheets_spec.rb +++ b/spec/features/budget_polls/ballot_sheets_spec.rb @@ -6,7 +6,6 @@ describe "Poll budget ballot sheets" do let(:poll_officer) { create(:poll_officer) } context "Officing recounts and results view" do - before do create(:poll_shift, :recount_scrutiny_task, officer: poll_officer, booth: booth, date: Date.current) @@ -30,11 +29,9 @@ describe "Poll budget ballot sheets" do expect(page).to have_content("Add results") end end - end context "Booth assignment" do - scenario "Try to access ballot sheets officing without booth assignment" do login_as(poll_officer.user) visit officing_poll_ballot_sheets_path(poll) @@ -70,11 +67,9 @@ describe "Poll budget ballot sheets" do expect(page).to have_content "Choose your booth" end - end context "Index" do - before do create(:poll_shift, :recount_scrutiny_task, officer: poll_officer, booth: booth, date: Date.current) @@ -91,11 +86,9 @@ describe "Poll budget ballot sheets" do expect(page).to have_content "Ballot sheet #{ballot_sheet.id}" end - end context "New" do - before do create(:poll_shift, :recount_scrutiny_task, officer: poll_officer, booth: booth, date: Date.current) @@ -138,11 +131,9 @@ describe "Poll budget ballot sheets" do expect(page).to have_content "Officer assignment can't be blank" end - end context "Show" do - before do create(:poll_shift, :recount_scrutiny_task, officer: poll_officer, booth: booth, date: Date.current) @@ -161,6 +152,5 @@ describe "Poll budget ballot sheets" do expect(page).to have_content(ballot_sheet.author) expect(page).to have_content(ballot_sheet.data) end - end end diff --git a/spec/features/budget_polls/budgets_spec.rb b/spec/features/budget_polls/budgets_spec.rb index 1ac11384d..08d781769 100644 --- a/spec/features/budget_polls/budgets_spec.rb +++ b/spec/features/budget_polls/budgets_spec.rb @@ -1,14 +1,12 @@ require "rails_helper" describe "Admin Budgets" do - before do admin = create(:administrator).user login_as(admin) end context "Index" do - scenario "Create poll if the budget does not have a poll associated" do budget = create(:budget) @@ -54,11 +52,9 @@ describe "Admin Budgets" do expect(page).to have_link "Admin ballots", href: admin_poll_booth_assignments_path(poll) end end - end context "Show" do - scenario "Do not show questions section if the budget have a poll associated" do poll = create(:poll, :for_budget) @@ -72,7 +68,5 @@ describe "Admin Budgets" do expect(page).to have_content("Results") end end - end - end diff --git a/spec/features/budget_polls/officing_spec.rb b/spec/features/budget_polls/officing_spec.rb index 02f1a187e..c88d28180 100644 --- a/spec/features/budget_polls/officing_spec.rb +++ b/spec/features/budget_polls/officing_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Budget Poll Officing" do - scenario "Show sidebar menus if officer has shifts assigned" do booth = create(:poll_booth) booth_assignment = create(:poll_booth_assignment, booth: booth) @@ -35,5 +34,4 @@ describe "Budget Poll Officing" do expect(page).not_to have_content("Validate document") expect(page).not_to have_content("Total recounts and results") end - end diff --git a/spec/features/budget_polls/polls_spec.rb b/spec/features/budget_polls/polls_spec.rb index ed871b924..85bcf4cdf 100644 --- a/spec/features/budget_polls/polls_spec.rb +++ b/spec/features/budget_polls/polls_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" describe "Polls" do - context "Public index" do - scenario "Budget polls should not be listed" do poll = create(:poll) budget_poll = create(:poll, :for_budget) @@ -13,11 +11,9 @@ describe "Polls" do expect(page).to have_content(poll.name) expect(page).not_to have_content(budget_poll.name) end - end context "Admin index" do - scenario "Budget polls should not appear in the list" do poll = create(:poll) budget_poll = create(:poll, :for_budget) @@ -29,5 +25,4 @@ describe "Polls" do expect(page).not_to have_content(budget_poll.name) end end - end diff --git a/spec/features/budget_polls/questions_spec.rb b/spec/features/budget_polls/questions_spec.rb index 55cf41a43..86d7746a0 100644 --- a/spec/features/budget_polls/questions_spec.rb +++ b/spec/features/budget_polls/questions_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Poll Questions" do - before do admin = create(:administrator).user login_as(admin) @@ -16,5 +15,4 @@ describe "Poll Questions" do expect(page).to have_select("poll_id", text: "Citizen Proposal Poll") expect(page).not_to have_select("poll_id", text: "Participatory Budget Poll") end - end diff --git a/spec/features/budget_polls/voter_spec.rb b/spec/features/budget_polls/voter_spec.rb index bf572def8..bd42f84ff 100644 --- a/spec/features/budget_polls/voter_spec.rb +++ b/spec/features/budget_polls/voter_spec.rb @@ -138,6 +138,5 @@ describe "BudgetPolls", :with_frozen_time do expect(page).to have_content("Has already participated in this poll") end end - end end diff --git a/spec/features/budgets/ballots_spec.rb b/spec/features/budgets/ballots_spec.rb index 4bc733da0..5667bf0d4 100644 --- a/spec/features/budgets/ballots_spec.rb +++ b/spec/features/budgets/ballots_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Ballots" do - let(:user) { create(:user, :level_two) } let!(:budget) { create(:budget, :balloting) } let!(:states) { create(:budget_group, budget: budget, name: "States") } @@ -35,7 +34,6 @@ describe "Ballots" do visit budget_ballot_path(0) end.to raise_error ActiveRecord::RecordNotFound end - end context "Lines Load" do @@ -51,11 +49,9 @@ describe "Ballots" do within("#sidebar") { expect(page).to have_content "More rain" } end - end context "Voting" do - before do login_as(user) visit budget_path(budget) @@ -65,7 +61,6 @@ describe "Ballots" do let!(:districts) { create(:budget_group, budget: budget, name: "Districts") } context "Group and Heading Navigation" do - scenario "Groups" do visit budget_path(budget) @@ -90,7 +85,6 @@ describe "Ballots" do expect(page).to have_link "District 1" expect(page).to have_link "District 2" - end scenario "Investments" do @@ -144,11 +138,9 @@ describe "Ballots" do expect(page).to have_content city_investment.title end - end context "Adding and Removing Investments" do - scenario "Add a investment", :js do create(:budget_investment, :selected, heading: new_york, price: 10000, title: "Bring back King Kong") create(:budget_investment, :selected, heading: new_york, price: 20000, title: "Paint cabs black") @@ -238,12 +230,10 @@ describe "Ballots" do expect(page).to have_content "OpenStreetMap" end end - end #Break up or simplify with helpers context "Balloting in multiple headings" do - scenario "Independent progress bar for headings", :js do city_heading = create(:budget_heading, group: city, name: "All city", price: 10000000) district_heading1 = create(:budget_heading, group: districts, name: "District 1", price: 1000000) @@ -370,7 +360,6 @@ describe "Ballots" do expect(page).to have_content "You have active votes in another heading: California" expect(page).to have_link california.name, href: budget_investments_path(budget, heading_id: california.id) end - end context "Showing the ballot" do @@ -428,7 +417,6 @@ describe "Ballots" do expect(page).to have_link "You have not voted on this group yet, go vote!", href: budget_group_path(budget, group) end - end scenario "Removing investments from ballot", :js do @@ -508,7 +496,6 @@ describe "Ballots" do end context "Permissions" do - scenario "User not logged in", :js do investment = create(:budget_investment, :selected, heading: new_york) @@ -623,7 +610,6 @@ describe "Ballots" do expect(page).to have_content("You have already assigned the available budget") expect(page).to have_selector(".in-favor a", visible: false) end - end scenario "Insufficient funds (removed after destroy)", :js do diff --git a/spec/features/budgets/budgets_spec.rb b/spec/features/budgets/budgets_spec.rb index fb00018db..4c575e9ef 100644 --- a/spec/features/budgets/budgets_spec.rb +++ b/spec/features/budgets/budgets_spec.rb @@ -1,13 +1,11 @@ require "rails_helper" describe "Budgets" do - let(:budget) { create(:budget) } let(:level_two_user) { create(:user, :level_two) } let(:allowed_phase_list) { ["balloting", "reviewing_ballots", "finished"] } context "Load" do - before { budget.update(slug: "budget_slug") } scenario "finds budget by slug" do @@ -27,11 +25,9 @@ describe "Budgets" do visit budget_path(0) end.to raise_error ActiveRecord::RecordNotFound end - end context "Index" do - scenario "Show normal index with links" do group1 = create(:budget_group, budget: budget) group2 = create(:budget_group, budget: budget) @@ -207,7 +203,6 @@ describe "Budgets" do end scenario "Index shows only published phases" do - budget.update!(phase: :finished) phases = budget.phases phases.drafting.update!(starts_at: "30-12-2017", ends_at: "31-12-2017", enabled: true, @@ -365,7 +360,6 @@ describe "Budgets" do end context "Show" do - scenario "List all groups" do create(:budget_group, budget: budget) create(:budget_group, budget: budget) @@ -477,11 +471,9 @@ describe "Budgets" do visit budget_path(budget) expect(page).not_to have_link "See results" end - end context "In Drafting phase" do - let(:admin) { create(:administrator).user } before do @@ -516,23 +508,19 @@ describe "Budgets" do expect(page.status_code).to eq(200) end end - end context "Accepting" do - before do budget.update(phase: "accepting") end context "Permissions" do - scenario "Verified user" do login_as(level_two_user) visit budget_path(budget) expect(page).to have_link "Create a budget investment" - end scenario "Unverified user" do @@ -549,7 +537,6 @@ describe "Budgets" do expect(page).to have_content "To create a new budget investment you must sign in or sign up" end - end end end diff --git a/spec/features/budgets/executions_spec.rb b/spec/features/budgets/executions_spec.rb index 57b4aaff2..3474c40f4 100644 --- a/spec/features/budgets/executions_spec.rb +++ b/spec/features/budgets/executions_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Executions" do - let(:budget) { create(:budget, :finished) } let(:group) { create(:budget_group, budget: budget) } let(:heading) { create(:budget_heading, group: group) } @@ -77,7 +76,6 @@ describe "Executions" do end context "Images" do - scenario "renders milestone image if available" do milestone1 = create(:milestone, :with_image, milestoneable: investment1) @@ -129,11 +127,9 @@ describe "Executions" do expect(page).to have_content(investment1.title) expect(page).to have_css("img[alt='Second image']") end - end context "Filters" do - let!(:status1) { create(:milestone_status, name: "Studying the project") } let!(:status2) { create(:milestone_status, name: "Bidding") } @@ -269,7 +265,6 @@ describe "Executions" do expect(page).not_to have_content(investment1.title) expect(page).to have_content(investment2.title) end - end context "Heading Order" do @@ -288,7 +283,6 @@ describe "Executions" do end context "No milestones" do - scenario "Milestone not yet published" do status = create(:milestone_status) create(:milestone, milestoneable: investment1, status: status, publication_date: Date.tomorrow) @@ -297,6 +291,5 @@ describe "Executions" do expect(page).to have_content("No winner investments in this state") end - end end diff --git a/spec/features/budgets/groups_spec.rb b/spec/features/budgets/groups_spec.rb index a5fad8eee..c3e8eaec6 100644 --- a/spec/features/budgets/groups_spec.rb +++ b/spec/features/budgets/groups_spec.rb @@ -1,12 +1,10 @@ require "rails_helper" describe "Budget Groups" do - let(:budget) { create(:budget, slug: "budget_slug") } let!(:group) { create(:budget_group, slug: "group_slug", budget: budget) } context "Load" do - scenario "finds group using budget slug and group slug" do visit budget_group_path("budget_slug", "group_slug") expect(page).to have_content "Select an option" @@ -52,5 +50,4 @@ describe "Budget Groups" do expect(first_heading.name).to appear_before(last_heading.name) end end - end diff --git a/spec/features/budgets/investments_spec.rb b/spec/features/budgets/investments_spec.rb index 1f05877f3..4f9217432 100644 --- a/spec/features/budgets/investments_spec.rb +++ b/spec/features/budgets/investments_spec.rb @@ -2,7 +2,6 @@ require "rails_helper" require "sessions_helper" describe "Budget Investments" do - let(:author) { create(:user, :level_two, username: "Isabel") } let(:budget) { create(:budget, name: "Big Budget") } let(:other_budget) { create(:budget, name: "What a Budget!") } @@ -28,7 +27,6 @@ describe "Budget Investments" do end context "Load" do - let(:investment) { create(:budget_investment, heading: heading) } before do @@ -71,7 +69,6 @@ describe "Budget Investments" do visit budget_investment_path(budget, investment, heading_id: 0) end.to raise_error ActiveRecord::RecordNotFound end - end scenario "Index" do @@ -156,7 +153,6 @@ describe "Budget Investments" do end context("Search") do - scenario "Search by text" do investment1 = create(:budget_investment, heading: heading, title: "Get Schwifty") investment2 = create(:budget_investment, heading: heading, title: "Schwifty Hello") @@ -179,7 +175,6 @@ describe "Budget Investments" do end context "Advanced search" do - scenario "Search by text", :js do bdgt_invest1 = create(:budget_investment, heading: heading, title: "Get Schwifty") bdgt_invest2 = create(:budget_investment, heading: heading, title: "Schwifty Hello") @@ -194,7 +189,6 @@ describe "Budget Investments" do expect(page).to have_content("There are 2 investments") within("#budget-investments") do - expect(page).to have_content(bdgt_invest1.title) expect(page).to have_content(bdgt_invest2.title) expect(page).not_to have_content(bdgt_invest3.title) @@ -202,7 +196,6 @@ describe "Budget Investments" do end context "Search by author type" do - scenario "Public employee", :js do ana = create :user, official_level: 1 john = create :user, official_level: 2 @@ -317,13 +310,10 @@ describe "Budget Investments" do expect(page).not_to have_content(bdgt_invest3.title) end end - end context "Search by date" do - context "Predefined date ranges" do - scenario "Last day", :js do bdgt_invest1 = create(:budget_investment, heading: heading, created_at: 1.minute.ago) bdgt_invest2 = create(:budget_investment, heading: heading, created_at: 1.hour.ago) @@ -403,7 +393,6 @@ describe "Budget Investments" do expect(page).not_to have_content(bdgt_invest3.title) end end - end scenario "Search by custom date range", :js do @@ -510,13 +499,11 @@ describe "Budget Investments" do expect(page).to have_selector("input[name='advanced_search[date_max]'][value*='#{1.day.ago.strftime("%d/%m/%Y")}']") end end - end end end context("Filters") do - scenario "by unfeasibility" do investment1 = create(:budget_investment, :unfeasible, :finished, heading: heading) investment2 = create(:budget_investment, :feasible, heading: heading) @@ -577,7 +564,6 @@ describe "Budget Investments" do end context "Results Phase" do - before { budget.update(phase: "finished", results_enabled: true) } scenario "show winners by default" do @@ -860,7 +846,6 @@ describe "Budget Investments" do def investments_order all(".budget-investment h3").collect { |i| i.text } end - end context "Phase I - Accepting" do @@ -1079,11 +1064,9 @@ describe "Budget Investments" do end context "Show Investment's price & cost explanation" do - let(:investment) { create(:budget_investment, :selected_with_price, heading: heading) } context "When investment with price is selected" do - scenario "Price & explanation is shown when Budget is on published prices phase" do Budget::Phase::PUBLISHED_PRICES_PHASES.each do |phase| budget.update!(phase: phase) @@ -1120,7 +1103,6 @@ describe "Budget Investments" do end context "When investment with price is unselected" do - before do investment.update(selected: false) end @@ -1140,7 +1122,6 @@ describe "Budget Investments" do end end end - end scenario "Can access the community" do @@ -1198,7 +1179,6 @@ describe "Budget Investments" do expect(page).not_to have_content("Price explanation") expect(page).not_to have_content(investment.price_explanation) end - end scenario "Show (unfeasible budget investment) only when valuation finished" do @@ -1358,7 +1338,6 @@ describe "Budget Investments" do { "budget_id": "budget_id" } context "Destroy" do - scenario "Admin cannot destroy budget investments" do user = create(:user, :level_two) investment = create(:budget_investment, heading: heading, author: user) @@ -1388,13 +1367,11 @@ describe "Budget Investments" do end context "Selecting Phase" do - before do budget.update(phase: "selecting") end context "Popup alert to vote only in one heading per group" do - scenario "When supporting in the first heading group", :js do carabanchel = create(:budget_heading, group: group) salamanca = create(:budget_heading, group: group) @@ -1463,11 +1440,9 @@ describe "Budget Investments" do expect(page).to have_content "Supports" end end - end context "Evaluating Phase" do - before do budget.update(phase: "valuating") end @@ -1503,11 +1478,9 @@ describe "Budget Investments" do expect(page).to have_content "1 support" end end - end context "Publishing prices phase" do - before do budget.update(phase: "publishing_prices") end @@ -1528,7 +1501,6 @@ describe "Budget Investments" do end context "Balloting Phase" do - before do budget.update(phase: "balloting") end @@ -1787,7 +1759,6 @@ describe "Budget Investments" do end describe "Reclassification" do - scenario "Due to heading change" do investment = create(:budget_investment, :selected, heading: heading) user = create(:user, :level_two, ballot_lines: [investment]) @@ -1823,7 +1794,6 @@ describe "Budget Investments" do expect(page).to have_content("You have voted 0 investment") end - end end @@ -1988,5 +1958,4 @@ describe "Budget Investments" do end end end - end diff --git a/spec/features/budgets/results_spec.rb b/spec/features/budgets/results_spec.rb index 3b44acdef..e7e00795d 100644 --- a/spec/features/budgets/results_spec.rb +++ b/spec/features/budgets/results_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Results" do - let(:budget) { create(:budget, :finished) } let(:group) { create(:budget_group, budget: budget) } let(:heading) { create(:budget_heading, group: group, price: 1000) } @@ -122,5 +121,4 @@ describe "Results" do expect(page).not_to have_content "Incompatibles" end - end diff --git a/spec/features/budgets/stats_spec.rb b/spec/features/budgets/stats_spec.rb index dcfd00f0c..c01fa9bbe 100644 --- a/spec/features/budgets/stats_spec.rb +++ b/spec/features/budgets/stats_spec.rb @@ -1,12 +1,10 @@ require "rails_helper" describe "Stats" do - let(:budget) { create(:budget, :finished) } let(:heading) { create(:budget_heading, budget: budget, price: 1000) } context "Load" do - before { budget.update(slug: "budget_slug") } scenario "finds budget by slug" do @@ -26,7 +24,6 @@ describe "Stats" do visit budget_stats_path(0) end.to raise_error ActiveRecord::RecordNotFound end - end describe "Show" do diff --git a/spec/features/budgets/votes_spec.rb b/spec/features/budgets/votes_spec.rb index d65a3346d..4291a764c 100644 --- a/spec/features/budgets/votes_spec.rb +++ b/spec/features/budgets/votes_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Votes" do - describe "Investments" do let(:manuela) { create(:user, verified_at: Time.current) } let(:budget) { create(:budget, :selecting) } @@ -11,7 +10,6 @@ describe "Votes" do before { login_as(manuela) } describe "Index" do - scenario "Index shows user votes on proposals" do investment1 = create(:budget_investment, heading: heading, voters: [manuela]) investment2 = create(:budget_investment, heading: heading) @@ -105,7 +103,6 @@ describe "Votes" do end context "Voting in multiple headings of a single group" do - let(:new_york) { heading } let(:san_francisco) { create(:budget_heading, group: group) } let(:third_heading) { create(:budget_heading, group: group) } @@ -195,7 +192,6 @@ describe "Votes" do expect(page.driver.send(:find_modal).text).to match "You can only support investments in 2 districts." end - end end end diff --git a/spec/features/campaigns_spec.rb b/spec/features/campaigns_spec.rb index 6e3434120..2241a4759 100644 --- a/spec/features/campaigns_spec.rb +++ b/spec/features/campaigns_spec.rb @@ -36,5 +36,4 @@ describe "Email campaigns" do expect(page).not_to have_content campaign2.name.to_s end - end diff --git a/spec/features/ckeditor_spec.rb b/spec/features/ckeditor_spec.rb index 8b5ee04de..ac29091dd 100644 --- a/spec/features/ckeditor_spec.rb +++ b/spec/features/ckeditor_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "CKEditor" do - scenario "is present before & after turbolinks update page", :js do author = create(:user) login_as(author) @@ -15,5 +14,4 @@ describe "CKEditor" do expect(page).to have_css ".translatable-fields[data-locale='en'] .cke_wysiwyg_frame" end - end diff --git a/spec/features/comments/budget_investments_spec.rb b/spec/features/comments/budget_investments_spec.rb index 53657137f..7a688afd2 100644 --- a/spec/features/comments/budget_investments_spec.rb +++ b/spec/features/comments/budget_investments_spec.rb @@ -249,7 +249,6 @@ describe "Commenting Budget::Investments" do click_button "Publish reply" expect(page).to have_content "Can't be blank" end - end scenario "N replies", :js do @@ -486,7 +485,6 @@ describe "Commenting Budget::Investments" do expect(page).to have_css "div.is-admin" end end - end scenario "can not comment as a moderator" do @@ -507,7 +505,6 @@ describe "Commenting Budget::Investments" do let!(:comment) { create(:comment, commentable: investment) } before do - login_as(verified) end @@ -591,5 +588,4 @@ describe "Commenting Budget::Investments" do end end end - end diff --git a/spec/features/comments/budget_investments_valuation_spec.rb b/spec/features/comments/budget_investments_valuation_spec.rb index 84a916023..9e43dda3b 100644 --- a/spec/features/comments/budget_investments_valuation_spec.rb +++ b/spec/features/comments/budget_investments_valuation_spec.rb @@ -221,7 +221,6 @@ describe "Internal valuation comments on Budget::Investments" do click_button "Publish reply" expect(page).to have_content "Can't be blank" end - end scenario "Multiple nested replies", :js do @@ -315,5 +314,4 @@ describe "Internal valuation comments on Budget::Investments" do expect(ActionMailer::Base.deliveries.first.to).to eq([valuator_user.email]) expect(ActionMailer::Base.deliveries.first.subject).to eq("New evaluation comment") end - end diff --git a/spec/features/comments/debates_spec.rb b/spec/features/comments/debates_spec.rb index 77088ef66..86cc31723 100644 --- a/spec/features/comments/debates_spec.rb +++ b/spec/features/comments/debates_spec.rb @@ -243,7 +243,6 @@ describe "Commenting debates" do click_button "Publish reply" expect(page).to have_content "Can't be blank" end - end scenario "N replies", :js do @@ -538,5 +537,4 @@ describe "Commenting debates" do end end end - end diff --git a/spec/features/comments/legislation_annotations_spec.rb b/spec/features/comments/legislation_annotations_spec.rb index e905ffb07..e09e423fe 100644 --- a/spec/features/comments/legislation_annotations_spec.rb +++ b/spec/features/comments/legislation_annotations_spec.rb @@ -287,7 +287,6 @@ describe "Commenting legislation questions" do click_button "Publish reply" expect(page).to have_content "Can't be blank" end - end scenario "N replies", :js do @@ -723,7 +722,5 @@ describe "Commenting legislation questions" do expect(page).to have_content("my other annotation") expect(page).to have_content("replying in multiple annotation thread") end - end - end diff --git a/spec/features/comments/legislation_questions_spec.rb b/spec/features/comments/legislation_questions_spec.rb index 12e526059..39a2b4c28 100644 --- a/spec/features/comments/legislation_questions_spec.rb +++ b/spec/features/comments/legislation_questions_spec.rb @@ -2,7 +2,6 @@ require "rails_helper" include ActionView::Helpers::DateHelper describe "Commenting legislation questions" do - let(:user) { create :user, :level_two } let(:process) { create :legislation_process, :in_debate_phase } let(:legislation_question) { create :legislation_question, process: process } @@ -268,7 +267,6 @@ describe "Commenting legislation questions" do click_button "Publish reply" expect(page).to have_content "Can't be blank" end - end scenario "N replies", :js do @@ -474,7 +472,6 @@ describe "Commenting legislation questions" do let!(:comment) { create(:comment, commentable: question) } before do - login_as(verified) end @@ -562,5 +559,4 @@ describe "Commenting legislation questions" do end end end - end diff --git a/spec/features/comments/polls_spec.rb b/spec/features/comments/polls_spec.rb index 9f580cbb5..e7953a3ec 100644 --- a/spec/features/comments/polls_spec.rb +++ b/spec/features/comments/polls_spec.rb @@ -247,7 +247,6 @@ describe "Commenting polls" do click_button "Publish reply" expect(page).to have_content "Can't be blank" end - end scenario "N replies", :js do @@ -328,7 +327,6 @@ describe "Commenting polls" do end describe "Moderators" do - scenario "can create comment as a moderator", :js do skip "Feature not implemented yet, review soon" @@ -542,5 +540,4 @@ describe "Commenting polls" do end end end - end diff --git a/spec/features/comments/proposals_spec.rb b/spec/features/comments/proposals_spec.rb index 96fa8ff13..f0c1d42204 100644 --- a/spec/features/comments/proposals_spec.rb +++ b/spec/features/comments/proposals_spec.rb @@ -245,7 +245,6 @@ describe "Commenting proposals" do click_button "Publish reply" expect(page).to have_content "Can't be blank" end - end scenario "N replies", :js do @@ -521,5 +520,4 @@ describe "Commenting proposals" do end end end - end diff --git a/spec/features/comments/topics_spec.rb b/spec/features/comments/topics_spec.rb index 67ee00d33..e5a44bfa8 100644 --- a/spec/features/comments/topics_spec.rb +++ b/spec/features/comments/topics_spec.rb @@ -273,7 +273,6 @@ describe "Commenting topics from proposals" do click_button "Publish reply" expect(page).to have_content "Can't be blank" end - end scenario "N replies", :js do @@ -571,7 +570,6 @@ describe "Commenting topics from proposals" do end end end - end describe "Commenting topics from budget investments" do @@ -824,7 +822,6 @@ describe "Commenting topics from budget investments" do click_button "Publish reply" expect(page).to have_content "Can't be blank" end - end scenario "N replies", :js do @@ -1122,5 +1119,4 @@ describe "Commenting topics from budget investments" do end end end - end diff --git a/spec/features/communities_spec.rb b/spec/features/communities_spec.rb index 0ac369f8b..ba8603ba6 100644 --- a/spec/features/communities_spec.rb +++ b/spec/features/communities_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" describe "Communities" do - context "Show" do - scenario "Should display default content" do proposal = create(:proposal) community = proposal.community @@ -147,5 +145,4 @@ describe "Communities" do expect { visit community_path(community) }.to raise_error(ActionController::RoutingError) end end - end diff --git a/spec/features/dashboard/dashboard_spec.rb b/spec/features/dashboard/dashboard_spec.rb index 3f11304fa..4dec32549 100644 --- a/spec/features/dashboard/dashboard_spec.rb +++ b/spec/features/dashboard/dashboard_spec.rb @@ -487,7 +487,6 @@ describe "Proposal's dashboard" do end describe "detect_new_actions_after_last_login" do - before do proposal.author.update(last_sign_in_at: Date.yesterday) end @@ -558,6 +557,5 @@ describe "Proposal's dashboard" do expect(page).not_to have_content("New") end end - end end diff --git a/spec/features/debates_spec.rb b/spec/features/debates_spec.rb index 3d16ee1d1..a0f617d44 100644 --- a/spec/features/debates_spec.rb +++ b/spec/features/debates_spec.rb @@ -2,7 +2,6 @@ require "rails_helper" describe "Debates" do - scenario "Disabled with a feature flag" do Setting["process.debates"] = nil expect { visit debates_path }.to raise_exception(FeatureFlags::FeatureDisabled) @@ -382,7 +381,6 @@ describe "Debates" do end describe "Debate index order filters" do - scenario "Default order is hot_score", :js do best_debate = create(:debate, title: "Best") best_debate.update_column(:hot_score, 10) @@ -439,7 +437,6 @@ describe "Debates" do end context "Recommendations" do - let!(:best_debate) { create(:debate, title: "Best", cached_votes_total: 10, tag_list: "Sport") } let!(:medium_debate) { create(:debate, title: "Medium", cached_votes_total: 5, tag_list: "Sport") } let!(:worst_debate) { create(:debate, title: "Worst", cached_votes_total: 1, tag_list: "Sport") } @@ -548,9 +545,7 @@ describe "Debates" do end context "Search" do - context "Basic search" do - scenario "Search by text" do debate1 = create(:debate, title: "Get Schwifty") debate2 = create(:debate, title: "Schwifty Hello") @@ -582,11 +577,9 @@ describe "Debates" do expect(page).to have_selector("input[name='search'][value='Schwifty']") end - end context "Advanced search" do - scenario "Search by text", :js do debate1 = create(:debate, title: "Get Schwifty") debate2 = create(:debate, title: "Schwifty Hello") @@ -608,7 +601,6 @@ describe "Debates" do end context "Search by author type" do - scenario "Public employee", :js do ana = create :user, official_level: 1 john = create :user, official_level: 2 @@ -723,13 +715,10 @@ describe "Debates" do expect(page).not_to have_content(debate3.title) end end - end context "Search by date" do - context "Predefined date ranges" do - scenario "Last day", :js do debate1 = create(:debate, created_at: 1.minute.ago) debate2 = create(:debate, created_at: 1.hour.ago) @@ -809,7 +798,6 @@ describe "Debates" do expect(page).not_to have_content(debate3.title) end end - end scenario "Search by custom date range", :js do @@ -911,7 +899,6 @@ describe "Debates" do expect(page).to have_selector("input[name='advanced_search[date_max]'][value*='#{1.day.ago.strftime("%d/%m/%Y")}']") end end - end end @@ -990,7 +977,6 @@ describe "Debates" do expect(page).not_to have_selector("#debates .debate-featured") expect(page).not_to have_selector("#featured-debates") end - end scenario "Conflictive" do @@ -1076,7 +1062,6 @@ describe "Debates" do expect(page).not_to have_content("Sully monument") end end - end end @@ -1167,5 +1152,4 @@ describe "Debates" do expect(page).not_to have_content("Featured") end end - end diff --git a/spec/features/direct_messages_spec.rb b/spec/features/direct_messages_spec.rb index dbf7d0ebf..d7a2b1ca8 100644 --- a/spec/features/direct_messages_spec.rb +++ b/spec/features/direct_messages_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Direct messages" do - before do Setting[:direct_message_max_per_day] = 3 end @@ -27,7 +26,6 @@ describe "Direct messages" do end context "Permissions" do - scenario "Do not display link to send message to myself" do sender = create(:user, :level_two) @@ -78,7 +76,6 @@ describe "Direct messages" do expect(page).to have_content("This user has decided not to receive direct messages") expect(page).not_to have_css("#direct_message_title") end - end scenario "Error messages" do @@ -94,7 +91,6 @@ describe "Direct messages" do end context "Limits" do - scenario "Can only send a maximum number of direct messages per day" do sender = create(:user, :level_two) receiver = create(:user, :level_two) @@ -115,7 +111,5 @@ describe "Direct messages" do expect(page).to have_content "You have reached the maximum number of private messages per day" expect(page).not_to have_content "You message has been sent successfully." end - end - end diff --git a/spec/features/emails_spec.rb b/spec/features/emails_spec.rb index 938928ae4..4bda1ccf1 100644 --- a/spec/features/emails_spec.rb +++ b/spec/features/emails_spec.rb @@ -1,13 +1,11 @@ require "rails_helper" describe "Emails" do - before do reset_mailer end context "On Staging Environment" do - scenario "emails are delivered to configured recipient" do interceptor = RecipientInterceptor.new("recipient@consul.dev", subject_prefix: "[staging]") Mail.register_interceptor(interceptor) @@ -21,7 +19,6 @@ describe "Emails" do Mail.unregister_interceptor(interceptor) end - end scenario "Signup Email" do @@ -219,7 +216,6 @@ describe "Emails" do end context "Direct Message" do - scenario "Receiver email" do sender = create(:user, :level_two) receiver = create(:user, :level_two) @@ -250,11 +246,9 @@ describe "Emails" do end pending "In the copy sent to the sender, display the receiver's name" - end context "Proposal notification digest" do - scenario "notifications for proposals that I have supported" do user = create(:user, email_digest: true) @@ -318,11 +312,9 @@ describe "Emails" do xscenario "Delete all Notifications included in the digest after email sent" do end - end context "User invites" do - scenario "Send an invitation" do login_as_manager visit new_management_user_invite_path @@ -340,7 +332,6 @@ describe "Emails" do expect(email).to have_subject("Invitation to CONSUL") expect(email).to have_body_text(/#{new_user_registration_path}/) end - end context "Budgets" do @@ -436,11 +427,9 @@ describe "Emails" do expect(email).to have_subject("Your investment project '#{investment.code}' has not been selected") expect(email).to deliver_to(investment.author.email) end - end context "Polls" do - scenario "Send email on poll comment reply", :js do user1 = create(:user, email_on_comment_reply: true) user2 = create(:user) @@ -469,11 +458,9 @@ describe "Emails" do expect(email).to have_body_text("To stop receiving these emails change your settings in") expect(email).to have_body_text(account_path) end - end context "Newsletter" do - scenario "Send newsletter email to selected users" do user_with_newsletter_in_segment_1 = create(:user, :with_proposal, newsletter: true) user_with_newsletter_in_segment_2 = create(:user, :with_proposal, newsletter: true) @@ -501,7 +488,6 @@ describe "Emails" do expect(email).to deliver_from("no-reply@consul.dev") expect(email.body.encoded).to include("This is a different body") end - end context "Users without email" do @@ -517,6 +503,5 @@ describe "Emails" do expect { open_last_email }.to raise_error "No email has been sent!" end - end end diff --git a/spec/features/help_page_spec.rb b/spec/features/help_page_spec.rb index 22c305493..18028c50b 100644 --- a/spec/features/help_page_spec.rb +++ b/spec/features/help_page_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" describe "Help page" do - context "Index" do - scenario "Help menu and page is visible if feature is enabled" do Setting["feature.help_page"] = true diff --git a/spec/features/home_spec.rb b/spec/features/home_spec.rb index 2122749c8..90b12212f 100644 --- a/spec/features/home_spec.rb +++ b/spec/features/home_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" describe "Home" do - context "For not logged users" do - scenario "Welcome message" do visit root_path @@ -17,13 +15,10 @@ describe "Home" do expect(page).not_to have_content "Recommendations that may interest you" end - end context "For signed in users" do - describe "Recommended" do - before do proposal = create(:proposal, tag_list: "Sport") user = create(:user, followables: [proposal]) @@ -108,7 +103,6 @@ describe "Home" do expect(page).not_to have_content "Recommendations that may interest you" end end - end describe "IE alert" do diff --git a/spec/features/legislation/draft_versions_spec.rb b/spec/features/legislation/draft_versions_spec.rb index afedcae2a..c3b3bb687 100644 --- a/spec/features/legislation/draft_versions_spec.rb +++ b/spec/features/legislation/draft_versions_spec.rb @@ -262,7 +262,6 @@ describe "Legislation Draft Versions" do expect(page).to have_content "my other annotation" end end - end context "Annotations page" do @@ -338,5 +337,4 @@ describe "Legislation Draft Versions" do expect(page).to have_content "my other annotation" end end - end diff --git a/spec/features/legislation/processes_spec.rb b/spec/features/legislation/processes_spec.rb index 65524392b..3c06884b1 100644 --- a/spec/features/legislation/processes_spec.rb +++ b/spec/features/legislation/processes_spec.rb @@ -1,11 +1,9 @@ require "rails_helper" describe "Legislation" do - let!(:administrator) { create(:administrator).user } shared_examples "not published permissions" do |path| - let(:not_published_process) { create(:legislation_process, :not_published, title: "Process not published") } let!(:not_permission_message) { "You do not have permission to carry out the action" } @@ -25,7 +23,6 @@ describe "Legislation" do end context "processes home page" do - scenario "No processes to be listed" do visit legislation_processes_path expect(page).to have_text "There aren't open processes" diff --git a/spec/features/legislation/proposals_spec.rb b/spec/features/legislation/proposals_spec.rb index f77ea685c..6935b31bb 100644 --- a/spec/features/legislation/proposals_spec.rb +++ b/spec/features/legislation/proposals_spec.rb @@ -2,7 +2,6 @@ require "rails_helper" require "sessions_helper" describe "Legislation Proposals" do - let(:user) { create(:user) } let(:process) { create(:legislation_process) } let(:proposal) { create(:legislation_proposal) } diff --git a/spec/features/legislation/resume_spec.rb b/spec/features/legislation/resume_spec.rb index ff2d66786..a80e8d2ce 100644 --- a/spec/features/legislation/resume_spec.rb +++ b/spec/features/legislation/resume_spec.rb @@ -2,7 +2,6 @@ require "rails_helper" describe "Legislation" do context "process resume page" do - scenario "resume tab not show" do process = create(:legislation_process, :open) visit legislation_process_path(process) @@ -102,7 +101,6 @@ describe "Legislation" do expect(page).not_to have_content("Answer 2") expect(page).to have_content("Answer 3") expect(page).to have_content("Answer 4") - end scenario "proposals empty" do @@ -157,7 +155,6 @@ describe "Legislation" do visit resume_legislation_process_path(process) click_link "Legislation proposal 3" expect(page).to have_content("Legislation proposal 3") - end scenario "text comments empty" do @@ -227,7 +224,6 @@ describe "Legislation" do # click_link "Download" # page.response_headers['Content-Type'].should eq "application/xlsx" # end - end describe Legislation::ProcessesController, type: :controller do @@ -245,5 +241,4 @@ describe "Legislation" do expect(response).to be_success end end - end diff --git a/spec/features/localization_spec.rb b/spec/features/localization_spec.rb index 9e7465f6c..47cf53528 100644 --- a/spec/features/localization_spec.rb +++ b/spec/features/localization_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Localization" do - scenario "Wrong locale" do I18n.with_locale(:es) do create(:widget_card, title: "Bienvenido a CONSUL", @@ -57,7 +56,6 @@ describe "Localization" do end context "Missing language names" do - let!(:default_enforce) { I18n.enforce_available_locales } let!(:default_locales) { I18n.available_locales.dup } @@ -80,6 +78,5 @@ describe "Localization" do expect(page).to have_content "wl" end end - end end diff --git a/spec/features/management/account_spec.rb b/spec/features/management/account_spec.rb index 43a439a81..9c860b544 100644 --- a/spec/features/management/account_spec.rb +++ b/spec/features/management/account_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Account" do - before do login_as_manager end @@ -103,5 +102,4 @@ describe "Account" do expect(page).to have_css("a[href='javascript:window.print();']", text: "Print password") expect(page).to have_css("div.for-print-only", text: "another_new_password", visible: false) end - end diff --git a/spec/features/management/budget_investments_spec.rb b/spec/features/management/budget_investments_spec.rb index c0d21c775..2c82fe09f 100644 --- a/spec/features/management/budget_investments_spec.rb +++ b/spec/features/management/budget_investments_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Budget Investments" do - let(:manager) { create(:manager) } let(:budget) { create(:budget, :selecting, name: "2033", slug: "budget_slug") } let(:group) { create(:budget_group, budget: budget, name: "Whole city") } @@ -19,7 +18,6 @@ describe "Budget Investments" do management: true context "Load" do - let(:investment) { create(:budget_investment, budget: budget) } let(:user) { create(:user, :level_two) } @@ -42,7 +40,6 @@ describe "Budget Investments" do visit management_budget_investment_path(0, investment) end.to raise_error ActiveRecord::RecordNotFound end - end context "Create" do @@ -120,7 +117,6 @@ describe "Budget Investments" do end context "Searching" do - scenario "by title" do budget_investment1 = create(:budget_investment, budget: budget, title: "Show me what you got") budget_investment2 = create(:budget_investment, budget: budget, title: "Get Schwifty") @@ -263,7 +259,6 @@ describe "Budget Investments" do end context "Supporting" do - scenario "Supporting budget investments on behalf of someone in index view", :js do budget_investment = create(:budget_investment, heading: heading) @@ -320,7 +315,6 @@ describe "Budget Investments" do end context "Printing" do - scenario "Printing budget investments" do 16.times { create(:budget_investment, heading: heading) } @@ -399,7 +393,5 @@ describe "Budget Investments" do expect(mid_investment.title).to appear_before(low_investment.title) end end - end - end diff --git a/spec/features/management/document_verifications_spec.rb b/spec/features/management/document_verifications_spec.rb index ce7bf8f2d..c27f5395d 100644 --- a/spec/features/management/document_verifications_spec.rb +++ b/spec/features/management/document_verifications_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "DocumentVerifications" do - before do login_as_manager end @@ -17,7 +16,6 @@ describe "DocumentVerifications" do end scenario "Verifying a level 2 user displays the verification form" do - user = create(:user, :level_two) visit management_document_verifications_path @@ -34,11 +32,8 @@ describe "DocumentVerifications" do end describe "Verifying througth Census" do - context "Census API" do - scenario "Verifying a user which does not exist and is not in the census shows an error" do - expect_any_instance_of(Verification::Management::Document).to receive(:in_census?). and_return(false) @@ -50,18 +45,15 @@ describe "DocumentVerifications" do end scenario "Verifying a user which does exists in the census but not in the db redirects allows sending an email" do - visit management_document_verifications_path fill_in "document_verification_document_number", with: "12345678Z" click_button "Check document" expect(page).to have_content "Please introduce the email used on the account" end - end context "Remote Census API" do - before do Setting["feature.remote_census"] = true Setting["remote_census.request.date_of_birth"] = "some.value" @@ -74,7 +66,6 @@ describe "DocumentVerifications" do end scenario "Verifying a user which does not exist and is not in the census shows an error" do - expect_any_instance_of(Verification::Management::Document).to receive(:in_census?). and_return(false) @@ -88,7 +79,6 @@ describe "DocumentVerifications" do end scenario "Verifying a user which does exists in the census but not in the db redirects allows sending an email" do - visit management_document_verifications_path fill_in "document_verification_document_number", with: "12345678Z" select_date "31-December-1980", from: "document_verification_date_of_birth" @@ -97,13 +87,10 @@ describe "DocumentVerifications" do expect(page).to have_content "Please introduce the email used on the account" end - end - end scenario "Document number is format-standarized" do - visit management_document_verifications_path fill_in "document_verification_document_number", with: "12345 - h" click_button "Check document" @@ -120,5 +107,4 @@ describe "DocumentVerifications" do expect(page).to have_content "You don't have the required age to verify your account." end - end diff --git a/spec/features/management/email_verifications_spec.rb b/spec/features/management/email_verifications_spec.rb index 209874c6e..82e0fbe37 100644 --- a/spec/features/management/email_verifications_spec.rb +++ b/spec/features/management/email_verifications_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "EmailVerifications" do - scenario "Verifying a level 1 user via email" do login_as_manager @@ -33,5 +32,4 @@ describe "EmailVerifications" do expect(user.reload.document_number).to eq("12345678Z") expect(user).to be_level_three_verified end - end diff --git a/spec/features/management/localization_spec.rb b/spec/features/management/localization_spec.rb index e741ddc27..28f7915ef 100644 --- a/spec/features/management/localization_spec.rb +++ b/spec/features/management/localization_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Localization" do - before do login_as_manager end diff --git a/spec/features/management/managed_users_spec.rb b/spec/features/management/managed_users_spec.rb index 3fa0478ac..9eaf89267 100644 --- a/spec/features/management/managed_users_spec.rb +++ b/spec/features/management/managed_users_spec.rb @@ -1,13 +1,11 @@ require "rails_helper" describe "Managed User" do - before do login_as_manager end context "Currently managed user" do - scenario "No managed user" do visit management_document_verifications_path expect(page).not_to have_css ".account-info" @@ -161,5 +159,4 @@ describe "Managed User" do expect(page).not_to have_content user.username.to_s expect(page).to have_current_path(management_root_path) end - end diff --git a/spec/features/management/proposals_spec.rb b/spec/features/management/proposals_spec.rb index e2a808af2..f062caa44 100644 --- a/spec/features/management/proposals_spec.rb +++ b/spec/features/management/proposals_spec.rb @@ -1,13 +1,11 @@ require "rails_helper" describe "Proposals" do - before do login_as_manager end context "Create" do - scenario "Creating proposals on behalf of someone" do user = create(:user, :level_two) login_managed_user(user) @@ -130,7 +128,6 @@ describe "Proposals" do end context "Voting" do - let!(:proposal) { create(:proposal) } scenario "Voting proposals on behalf of someone in index view", :js do @@ -174,7 +171,6 @@ describe "Proposals" do end context "Printing" do - scenario "Printing proposals" do 6.times { create(:proposal) } @@ -216,6 +212,5 @@ describe "Proposals" do expect(best_proposal.title).to appear_before(worst_proposal.title) end end - end end diff --git a/spec/features/management/users_spec.rb b/spec/features/management/users_spec.rb index 929828b96..b567f8026 100644 --- a/spec/features/management/users_spec.rb +++ b/spec/features/management/users_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Users" do - before do login_as_manager end @@ -95,5 +94,4 @@ describe "Users" do expect(page).to have_content "no user account associated to it" end - end diff --git a/spec/features/moderation/budget_investments_spec.rb b/spec/features/moderation/budget_investments_spec.rb index e2809f885..03b8606eb 100644 --- a/spec/features/moderation/budget_investments_spec.rb +++ b/spec/features/moderation/budget_investments_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Moderate budget investments" do - let(:budget) { create(:budget) } let(:heading) { create(:budget_heading, budget: budget, price: 666666) } let(:mod) { create(:moderator) } @@ -53,14 +52,12 @@ describe "Moderate budget investments" do end describe "/moderation/ screen" do - before do login_as(mod.user) end describe "moderate in bulk" do describe "When an investment has been selected for moderation" do - before do visit moderation_budget_investments_path @@ -236,5 +233,4 @@ describe "Moderate budget investments" do expect(flagged_new_investment.title).to appear_before(latest_investment.title) end end - end diff --git a/spec/features/moderation/comments_spec.rb b/spec/features/moderation/comments_spec.rb index 1e6d995c8..2508539c9 100644 --- a/spec/features/moderation/comments_spec.rb +++ b/spec/features/moderation/comments_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Moderate comments" do - scenario "Hide", :js do citizen = create(:user) moderator = create(:moderator) @@ -64,7 +63,6 @@ describe "Moderate comments" do end describe "/moderation/ screen" do - before do moderator = create(:moderator) login_as(moderator.user) diff --git a/spec/features/moderation/debates_spec.rb b/spec/features/moderation/debates_spec.rb index 4f2b02fd9..e474ba760 100644 --- a/spec/features/moderation/debates_spec.rb +++ b/spec/features/moderation/debates_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Moderate debates" do - scenario "Disabled with a feature flag" do Setting["process.debates"] = nil moderator = create(:moderator) @@ -45,7 +44,6 @@ describe "Moderate debates" do end describe "/moderation/ screen" do - before do moderator = create(:moderator) login_as(moderator.user) diff --git a/spec/features/moderation/legislation_proposals_spec.rb b/spec/features/moderation/legislation_proposals_spec.rb index 18404b697..767470a92 100644 --- a/spec/features/moderation/legislation_proposals_spec.rb +++ b/spec/features/moderation/legislation_proposals_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Moderate legislation proposals" do - scenario "Hide", :js do citizen = create(:user) legislation_process = create(:legislation_process) diff --git a/spec/features/moderation/proposal_notifications_spec.rb b/spec/features/moderation/proposal_notifications_spec.rb index 6a3420e96..cc0613bb5 100644 --- a/spec/features/moderation/proposal_notifications_spec.rb +++ b/spec/features/moderation/proposal_notifications_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Moderate proposal notifications" do - scenario "Hide", :js do citizen = create(:user) proposal = create(:proposal) @@ -40,7 +39,6 @@ describe "Moderate proposal notifications" do end describe "/moderation/ screen" do - before do moderator = create(:moderator) login_as(moderator.user) diff --git a/spec/features/moderation/proposals_spec.rb b/spec/features/moderation/proposals_spec.rb index d03e6fe63..5f24d2b59 100644 --- a/spec/features/moderation/proposals_spec.rb +++ b/spec/features/moderation/proposals_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Moderate proposals" do - scenario "Disabled with a feature flag" do Setting["process.proposals"] = nil moderator = create(:moderator) @@ -44,7 +43,6 @@ describe "Moderate proposals" do end describe "/moderation/ screen" do - before do moderator = create(:moderator) login_as(moderator.user) diff --git a/spec/features/moderation/users_spec.rb b/spec/features/moderation/users_spec.rb index 845106f7f..d05951eae 100644 --- a/spec/features/moderation/users_spec.rb +++ b/spec/features/moderation/users_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Moderate users" do - scenario "Hide" do citizen = create(:user) moderator = create(:moderator) @@ -73,5 +72,4 @@ describe "Moderate users" do expect(page).to have_content "Blocked" end end - end diff --git a/spec/features/notifications_spec.rb b/spec/features/notifications_spec.rb index c9a6e65d6..8391ff048 100644 --- a/spec/features/notifications_spec.rb +++ b/spec/features/notifications_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Notifications" do - let(:user) { create :user } before do @@ -227,7 +226,6 @@ describe "Notifications" do expect(Delayed::Job.second.run_at.change(usec: 0)).to eq(second_batch_run_at) expect(Delayed::Job.third.run_at.change(usec: 0)).to eq(third_batch_run_at) end - end def remove_users_without_pending_notifications @@ -239,5 +237,4 @@ describe "Notifications" do user.notifications.not_emailed.where(notifiable_type: "ProposalNotification").blank? end end - end diff --git a/spec/features/official_positions_spec.rb b/spec/features/official_positions_spec.rb index 6b58b188e..7fad3f9d7 100644 --- a/spec/features/official_positions_spec.rb +++ b/spec/features/official_positions_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Official positions" do - context "Badge" do let(:user1) { create(:user, official_level: 1, official_position: "Employee", official_position_badge: true) } let(:user2) { create(:user, official_level: 0, official_position: "") } @@ -35,7 +34,6 @@ describe "Official positions" do visit debate_path(debate2) expect_no_badge_for("debate", debate2) end - end context "Proposals" do @@ -56,7 +54,6 @@ describe "Official positions" do visit proposal_path(proposal2) expect_no_badge_for("proposal", proposal2) end - end end end diff --git a/spec/features/officing/booth_spec.rb b/spec/features/officing/booth_spec.rb index a2be7997d..2f86cbdd0 100644 --- a/spec/features/officing/booth_spec.rb +++ b/spec/features/officing/booth_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Booth", :with_frozen_time do - scenario "Officer with no booth assignments today" do officer = create(:poll_officer) @@ -75,5 +74,4 @@ describe "Booth", :with_frozen_time do expect(page).to have_select("booth_id", options: [booth1.location, booth2.location]) end - end diff --git a/spec/features/officing/residence_spec.rb b/spec/features/officing/residence_spec.rb index d28cf9156..aa63dcf21 100644 --- a/spec/features/officing/residence_spec.rb +++ b/spec/features/officing/residence_spec.rb @@ -4,7 +4,6 @@ describe "Residence", :with_frozen_time do let(:officer) { create(:poll_officer) } describe "Officers without assignments" do - scenario "Can not access residence verification" do login_as(officer.user) visit officing_root_path @@ -18,11 +17,9 @@ describe "Residence", :with_frozen_time do expect(page).to have_content("You don't have officing shifts today") end - end describe "Assigned officers" do - before do create(:poll_officer_assignment, officer: officer) login_through_form_as_officer(officer.user) @@ -90,7 +87,6 @@ describe "Residence", :with_frozen_time do expect(page).to have_content "The Census was unable to verify this document" end - end scenario "Verify booth", :js do @@ -116,7 +112,6 @@ describe "Residence", :with_frozen_time do end context "With remote census configuration" do - before do Setting["feature.remote_census"] = true Setting["remote_census.request.date_of_birth"] = "some.value" @@ -127,7 +122,6 @@ describe "Residence", :with_frozen_time do end describe "Display form fields according to the remote census configuration" do - scenario "by default (without custom census) not display date_of_birth and postal_code" do Setting["feature.remote_census"] = false @@ -156,7 +150,6 @@ describe "Residence", :with_frozen_time do expect(page).to have_css("#residence_postal_code") expect(page).not_to have_css("#residence_year_of_birth") end - end scenario "can verify voter with date_of_birth and postal_code fields" do @@ -178,7 +171,5 @@ describe "Residence", :with_frozen_time do expect(page).to have_content "Document verified with Census" end - end - end diff --git a/spec/features/officing/results_spec.rb b/spec/features/officing/results_spec.rb index 241788691..bf69fea1e 100644 --- a/spec/features/officing/results_spec.rb +++ b/spec/features/officing/results_spec.rb @@ -160,5 +160,4 @@ describe "Officing Results", :with_frozen_time do within("#null_results") { expect(page).to have_content("44") } within("#total_results") { expect(page).to have_content("66") } end - end diff --git a/spec/features/officing/voters_spec.rb b/spec/features/officing/voters_spec.rb index e2dc73e1e..1c5f246cd 100644 --- a/spec/features/officing/voters_spec.rb +++ b/spec/features/officing/voters_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Voters" do - let(:poll) { create(:poll, :current) } let(:booth) { create(:poll_booth) } let(:officer) { create(:poll_officer) } @@ -84,7 +83,6 @@ describe "Voters" do end context "Polls displayed to officers" do - scenario "Display current polls assigned to a booth" do poll = create(:poll, :current) create(:poll_officer_assignment, officer: officer, poll: poll, booth: booth) diff --git a/spec/features/organizations_spec.rb b/spec/features/organizations_spec.rb index 601ae9d1e..1d99d9ff3 100644 --- a/spec/features/organizations_spec.rb +++ b/spec/features/organizations_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Organizations" do - scenario "Organizations can be created" do user = User.organizations.where(email: "green@peace.com").first expect(user).not_to be diff --git a/spec/features/polls/answers_spec.rb b/spec/features/polls/answers_spec.rb index 35043ec4d..0a98a7397 100644 --- a/spec/features/polls/answers_spec.rb +++ b/spec/features/polls/answers_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Answers" do - let(:question) { create(:poll_question) } let(:admin) { create(:administrator) } @@ -64,7 +63,6 @@ describe "Answers" do pending "Destroy" context "Gallery" do - it_behaves_like "nested imageable", "poll_question_answer", "new_admin_answer_image_path", @@ -74,5 +72,4 @@ describe "Answers" do "Image uploaded successfully", true end - end diff --git a/spec/features/polls/polls_spec.rb b/spec/features/polls/polls_spec.rb index 7f5680936..968479094 100644 --- a/spec/features/polls/polls_spec.rb +++ b/spec/features/polls/polls_spec.rb @@ -1,13 +1,11 @@ require "rails_helper" describe "Polls" do - context "Concerns" do it_behaves_like "notifiable in-app", :poll end context "#index" do - scenario "Shows description for open polls" do visit polls_path expect(page).not_to have_content "Description for open polls" @@ -374,7 +372,6 @@ describe "Polls" do end context "Booth & Website", :with_frozen_time do - let(:poll) { create(:poll, summary: "Summary", description: "Description") } let(:booth) { create(:poll_booth) } let(:officer) { create(:poll_officer) } @@ -407,7 +404,6 @@ describe "Polls" do expect(page).not_to have_link("No") end end - end context "Results and stats" do @@ -497,6 +493,5 @@ describe "Polls" do expect(page).to have_link "Information" end - end end diff --git a/spec/features/polls/questions_spec.rb b/spec/features/polls/questions_spec.rb index 1c067f192..f61b0ec7c 100644 --- a/spec/features/polls/questions_spec.rb +++ b/spec/features/polls/questions_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Poll Questions" do - scenario "Lists questions from proposals before regular questions" do poll = create(:poll) normal_question = create(:poll_question, poll: poll) diff --git a/spec/features/polls/votation_type_spec.rb b/spec/features/polls/votation_type_spec.rb index 46bff80a6..1ae7f1e7b 100644 --- a/spec/features/polls/votation_type_spec.rb +++ b/spec/features/polls/votation_type_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" describe "Poll Votation Type" do - context "Unique" do - let(:user) { create(:user, :verified) } let(:poll_current) { create(:poll, :current) } let(:unique) { create(:poll_question_unique, poll: poll_current) } @@ -58,7 +56,6 @@ describe "Poll Votation Type" do end context "Multiple" do - let(:user) { create(:user, :verified) } let(:poll_current) { create(:poll, :current) } let(:question) { create(:poll_question_multiple, poll: poll_current) } @@ -149,7 +146,6 @@ describe "Poll Votation Type" do end context "Prioritized" do - let(:user) { create(:user, :verified) } let(:poll_current) { create(:poll, :current) } let(:question) { create(:poll_question_prioritized, poll: poll_current) } @@ -188,7 +184,6 @@ describe "Poll Votation Type" do expect(page).to have_link answer.title end end - end scenario "response question no more vote than allowed", :js do @@ -215,7 +210,6 @@ describe "Poll Votation Type" do end context "Positive open" do - let(:user) { create(:user, :verified) } let(:poll_current) { create(:poll, :current) } let(:question) { create(:poll_question_positive_open, poll: poll_current) } @@ -334,7 +328,6 @@ describe "Poll Votation Type" do end context "Answers set" do - let(:user) { create(:user, :verified) } let(:poll_current) { create(:poll, :current) } let(:question) { create(:poll_question_answer_set_open, poll: poll_current) } @@ -367,7 +360,6 @@ describe "Poll Votation Type" do within("#poll_question_#{question.id}_answers") do expect(page).to have_css(".answered", count: question.max_votes) end - end scenario "add answer", :js do @@ -381,5 +373,4 @@ describe "Poll Votation Type" do end end end - end diff --git a/spec/features/polls/voter_spec.rb b/spec/features/polls/voter_spec.rb index d97a4aba1..61b222d24 100644 --- a/spec/features/polls/voter_spec.rb +++ b/spec/features/polls/voter_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" describe "Voter" do - context "Origin", :with_frozen_time do - let(:poll) { create(:poll, :current) } let(:question) { create(:poll_question, poll: poll) } let(:booth) { create(:poll_booth) } @@ -113,7 +111,6 @@ describe "Voter" do expect(page).to have_content "Has already participated in this poll" expect(page).not_to have_content "The person has decided not to vote at this time" end - end context "Trying to vote the same poll in booth and web" do @@ -273,7 +270,6 @@ describe "Voter" do expect(page).to have_content("Validate document") end end - end end end diff --git a/spec/features/proposal_ballots_spec.rb b/spec/features/proposal_ballots_spec.rb index 168bc7103..9e72c8e5c 100644 --- a/spec/features/proposal_ballots_spec.rb +++ b/spec/features/proposal_ballots_spec.rb @@ -2,7 +2,6 @@ require "rails_helper" describe "Proposal ballots" do - scenario "Successful proposals do not show support buttons in index" do successful_proposals = create_successful_proposals @@ -25,5 +24,4 @@ describe "Proposal ballots" do end end end - end diff --git a/spec/features/proposal_notifications_spec.rb b/spec/features/proposal_notifications_spec.rb index a16a50a7b..33b6bfac1 100644 --- a/spec/features/proposal_notifications_spec.rb +++ b/spec/features/proposal_notifications_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Proposal Notifications" do - scenario "Send a notification" do author = create(:user, :with_proposal) @@ -156,7 +155,6 @@ describe "Proposal Notifications" do end context "Permissions" do - scenario "Link to send the message" do author = create(:user) proposal = create(:proposal, author: author) @@ -188,11 +186,9 @@ describe "Proposal Notifications" do expect(page).to have_current_path(root_path) expect(page).to have_content("You do not have permission to carry out the action") end - end context "In-app notifications from the proposal's author" do - scenario "Voters should receive a notification", :js do author = create(:user) proposal = create(:proposal, author: author) @@ -342,7 +338,6 @@ describe "Proposal Notifications" do end context "Group notifications" do - before do Setting[:proposal_notification_minimum_interval_in_days] = 0 end @@ -375,7 +370,6 @@ describe "Proposal Notifications" do expect(page).to have_content "There is one new notification on #{proposal.title}", count: 3 end end - end scenario "Error messages" do @@ -391,7 +385,6 @@ describe "Proposal Notifications" do end context "Limits" do - scenario "Cannot send more than one notification within established interval" do author = create(:user) proposal = create(:proposal, author: author) @@ -439,7 +432,5 @@ describe "Proposal Notifications" do travel_back end - end - end diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index a048f7c3c..8fd27261b 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -2,7 +2,6 @@ require "rails_helper" describe "Proposals" do - it_behaves_like "milestoneable", :proposal, "proposal_path" @@ -26,7 +25,6 @@ describe "Proposals" do end context "Index" do - before do Setting["feature.featured_proposals"] = true Setting["featured_proposals_number"] = 3 @@ -226,7 +224,6 @@ describe "Proposals" do end context "Embedded video" do - scenario "Show YouTube video" do proposal = create(:proposal, video_url: "http://www.youtube.com/watch?v=a7UFm6ErMPU") visit proposal_path(proposal) @@ -463,7 +460,6 @@ describe "Proposals" do end context "Geozones" do - scenario "Default whole city" do author = create(:user) login_as(author) @@ -507,7 +503,6 @@ describe "Proposals" do expect(page).to have_content "California" end end - end context "Retired proposals" do @@ -683,7 +678,6 @@ describe "Proposals" do end describe "Proposal index order filters" do - scenario "Default order is hot_score", :js do best_proposal = create(:proposal, title: "Best proposal") best_proposal.update_column(:hot_score, 10) @@ -738,7 +732,6 @@ describe "Proposals" do end context "Recommendations" do - let!(:best_proposal) { create(:proposal, title: "Best", cached_votes_up: 10, tag_list: "Sport") } let!(:medium_proposal) { create(:proposal, title: "Medium", cached_votes_up: 5, tag_list: "Sport") } let!(:worst_proposal) { create(:proposal, title: "Worst", cached_votes_up: 1, tag_list: "Sport") } @@ -847,7 +840,6 @@ describe "Proposals" do end describe "Archived proposals" do - scenario "show on proposals list" do archived_proposals = create_archived_proposals @@ -944,7 +936,6 @@ describe "Proposals" do expect(all(".proposal")[2].text).to match "Least voted" end end - end context "Selected Proposals" do @@ -1038,9 +1029,7 @@ describe "Proposals" do end context "Search" do - context "Basic search" do - scenario "Search by text" do proposal1 = create(:proposal, title: "Get Schwifty") proposal2 = create(:proposal, title: "Schwifty Hello") @@ -1091,11 +1080,9 @@ describe "Proposals" do expect(page).to have_selector("input[name='search'][value='Schwifty']") end - end context "Advanced search" do - scenario "Search by text", :js do proposal1 = create(:proposal, title: "Get Schwifty") proposal2 = create(:proposal, title: "Schwifty Hello") @@ -1110,7 +1097,6 @@ describe "Proposals" do expect(page).to have_content("There are 2 citizen proposals") within("#proposals") do - expect(page).to have_content(proposal1.title) expect(page).to have_content(proposal2.title) expect(page).not_to have_content(proposal3.title) @@ -1118,7 +1104,6 @@ describe "Proposals" do end context "Search by author type" do - scenario "Public employee", :js do ana = create :user, official_level: 1 john = create :user, official_level: 2 @@ -1233,13 +1218,10 @@ describe "Proposals" do expect(page).not_to have_content(proposal3.title) end end - end context "Search by date" do - context "Predefined date ranges" do - scenario "Last day", :js do proposal1 = create(:proposal, created_at: 1.minute.ago) proposal2 = create(:proposal, created_at: 1.hour.ago) @@ -1319,7 +1301,6 @@ describe "Proposals" do expect(page).not_to have_content(proposal3.title) end end - end scenario "Search by custom date range", :js do @@ -1426,7 +1407,6 @@ describe "Proposals" do expect(page).to have_selector("input[name='advanced_search[date_max]'][value*='#{1.day.ago.strftime("%d/%m/%Y")}']") end end - end end @@ -1510,7 +1490,6 @@ describe "Proposals" do expect(page).not_to have_selector("#proposals .proposal-featured") expect(page).not_to have_selector("#featured-proposals") end - end scenario "Conflictive" do @@ -1713,7 +1692,6 @@ describe "Proposals" do expect(page).not_to have_content("Sully monument") end end - end end @@ -1753,7 +1731,6 @@ describe "Proposals" do end context "Summary" do - scenario "Displays proposals grouped by category" do create(:tag, :category, name: "Culture") create(:tag, :category, name: "Social Services") @@ -1838,13 +1815,10 @@ describe "Proposals" do expect(page).not_to have_content(proposal3.title) end end - end - end describe "Successful proposals" do - scenario "Successful proposals do not show support buttons in index" do successful_proposals = create_successful_proposals @@ -1900,7 +1874,6 @@ describe "Successful proposals" do end context "Skip user verification" do - before do Setting["feature.user.skip_verification"] = "true" end diff --git a/spec/features/registration_form_spec.rb b/spec/features/registration_form_spec.rb index 3f6faaa35..22cbefaf8 100644 --- a/spec/features/registration_form_spec.rb +++ b/spec/features/registration_form_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Registration form" do - scenario "username is not available", :js do user = create(:user) @@ -77,5 +76,4 @@ describe "Registration form" do expect(page).to have_current_path(new_user_registration_path) end - end diff --git a/spec/features/remote_translations_spec.rb b/spec/features/remote_translations_spec.rb index dd6d3a78a..980920243 100644 --- a/spec/features/remote_translations_spec.rb +++ b/spec/features/remote_translations_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Remote Translations" do - before do Setting["feature.remote_translations"] = true create(:proposal) @@ -11,9 +10,7 @@ describe "Remote Translations" do end describe "Display remote translation button when locale is included in microsoft translate client" do - context "with locale that has :en fallback" do - before do allow(I18n.fallbacks).to receive(:[]).and_return([:en]) Globalize.set_fallbacks_to_all_available_locales @@ -35,7 +32,6 @@ describe "Remote Translations" do end context "with locale that has :en fallback" do - before do allow(I18n.fallbacks).to receive(:[]).and_return([:es]) Globalize.set_fallbacks_to_all_available_locales @@ -55,7 +51,6 @@ describe "Remote Translations" do expect(page).to have_content "El contenido de esta página no está disponible en tu idioma" end end - end scenario "Not display remote translation button when locale is not included in microsoft translate client" do @@ -63,5 +58,4 @@ describe "Remote Translations" do expect(page).not_to have_css ".remote-translations-button" end - end diff --git a/spec/features/sessions_spec.rb b/spec/features/sessions_spec.rb index 16fa62585..74c1781d5 100644 --- a/spec/features/sessions_spec.rb +++ b/spec/features/sessions_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Sessions" do - scenario "Staying in the same page after doing login/logout" do user = create(:user, sign_in_count: 10) debate = create(:debate) @@ -18,5 +17,4 @@ describe "Sessions" do expect(page).to have_content("You have been signed out successfully") expect(page).to have_current_path(debate_path(debate)) end - end diff --git a/spec/features/site_customization/custom_pages_spec.rb b/spec/features/site_customization/custom_pages_spec.rb index 980996922..a54c50b37 100644 --- a/spec/features/site_customization/custom_pages_spec.rb +++ b/spec/features/site_customization/custom_pages_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Custom Pages" do - context "New custom page" do context "Draft" do scenario "See page" do diff --git a/spec/features/site_customization/information_texts_spec.rb b/spec/features/site_customization/information_texts_spec.rb index 6e394eb65..d24263b50 100644 --- a/spec/features/site_customization/information_texts_spec.rb +++ b/spec/features/site_customization/information_texts_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Custom information texts" do - scenario "Show custom texts instead of default ones" do admin = create(:administrator) login_as(admin.user) diff --git a/spec/features/social_media_meta_tags_spec.rb b/spec/features/social_media_meta_tags_spec.rb index 917bca4da..08470ee7e 100644 --- a/spec/features/social_media_meta_tags_spec.rb +++ b/spec/features/social_media_meta_tags_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" describe "Social media meta tags" do - context "Setting social media meta tags" do - let(:meta_keywords) { "citizen, participation, open government" } let(:meta_title) { "CONSUL" } let(:meta_description) do @@ -25,7 +23,6 @@ describe "Social media meta tags" do end scenario "Social media meta tags partial render settings content" do - visit root_path expect(page).to have_meta "keywords", with: meta_keywords expect(page).to have_meta "twitter:site", with: twitter_handle @@ -44,5 +41,4 @@ describe "Social media meta tags" do expect(page).to have_property "og:description", with: meta_description end end - end diff --git a/spec/features/stats_spec.rb b/spec/features/stats_spec.rb index 5c35e2eb6..1384a76cc 100644 --- a/spec/features/stats_spec.rb +++ b/spec/features/stats_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" describe "Stats" do - context "Summary" do - scenario "General" do create(:debate) 2.times { create(:proposal) } @@ -41,7 +39,5 @@ describe "Stats" do expect(page).to have_content "Verified users 3" expect(page).to have_content "Unverified users 2" end - end - end diff --git a/spec/features/tags/budget_investments_spec.rb b/spec/features/tags/budget_investments_spec.rb index 6d700245b..d880e2e70 100644 --- a/spec/features/tags/budget_investments_spec.rb +++ b/spec/features/tags/budget_investments_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Tags" do - let(:author) { create(:user, :level_two, username: "Isabel") } let(:budget) { create(:budget, name: "Big Budget") } let(:group) { create(:budget_group, name: "Health", budget: budget) } @@ -190,7 +189,6 @@ describe "Tags" do end context "Filter" do - scenario "From index" do create(:budget_investment, heading: heading, tag_list: "Economy", title: "New bank") create(:budget_investment, heading: heading, tag_list: "Health", title: "New hospital") @@ -220,11 +218,9 @@ describe "Tags" do expect(page).to have_content "New bank" end end - end context "Tag cloud" do - let(:new_tag) { "New Tag" } let(:newer_tag) { "Newer" } let!(:investment1) { create(:budget_investment, heading: heading, tag_list: new_tag) } @@ -273,11 +269,9 @@ describe "Tags" do expect(page).not_to have_content investment3.title end end - end context "Categories" do - let!(:investment1) { create(:budget_investment, heading: heading, tag_list: tag_medio_ambiente.name) } let!(:investment2) { create(:budget_investment, heading: heading, tag_list: tag_medio_ambiente.name) } let!(:investment3) { create(:budget_investment, heading: heading, tag_list: tag_economia.name) } @@ -327,7 +321,6 @@ describe "Tags" do end context "Valuation" do - scenario "Users do not see valuator tags" do investment = create(:budget_investment, heading: heading, tag_list: "Park") investment.set_tag_list_on(:valuation, "Education") @@ -352,6 +345,5 @@ describe "Tags" do expect(page).to have_content "Education" expect(page).not_to have_content "Park" end - end end diff --git a/spec/features/tags/debates_spec.rb b/spec/features/tags/debates_spec.rb index d54fde94a..1c30f80bf 100644 --- a/spec/features/tags/debates_spec.rb +++ b/spec/features/tags/debates_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Tags" do - scenario "Index" do earth = create(:debate, tag_list: "Medio Ambiente") money = create(:debate, tag_list: "Economía") @@ -150,7 +149,6 @@ describe "Tags" do end context "Filter" do - scenario "From index" do create(:debate, tag_list: "Health", title: "Public hospitals?") create(:debate, tag_list: "Education", title: "Status of our schools") @@ -180,11 +178,9 @@ describe "Tags" do expect(page).to have_content(debate.title) end end - end context "Tag cloud" do - scenario "Display user tags" do create(:debate, tag_list: "Medio Ambiente") create(:debate, tag_list: "Economía") @@ -213,6 +209,5 @@ describe "Tags" do expect(page).to have_content debate2.title expect(page).not_to have_content debate3.title end - end end diff --git a/spec/features/tags/proposals_spec.rb b/spec/features/tags/proposals_spec.rb index fdf7bb813..ff101b0e2 100644 --- a/spec/features/tags/proposals_spec.rb +++ b/spec/features/tags/proposals_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Tags" do - scenario "Index" do earth = create(:proposal, tag_list: "Medio Ambiente") money = create(:proposal, tag_list: "Economía") @@ -184,7 +183,6 @@ describe "Tags" do end context "Filter" do - scenario "From index" do create(:proposal, tag_list: "Health", title: "More green spaces") create(:proposal, tag_list: "Education", title: "Online teachers") @@ -214,11 +212,9 @@ describe "Tags" do expect(page).to have_content(proposal.title) end end - end context "Tag cloud" do - scenario "Display user tags" do create(:proposal, tag_list: "Medio Ambiente") create(:proposal, tag_list: "Economía") @@ -247,11 +243,9 @@ describe "Tags" do expect(page).to have_content proposal2.title expect(page).not_to have_content proposal3.title end - end context "Categories" do - scenario "Display category tags" do create(:tag, :category, name: "Medio Ambiente") create(:tag, :category, name: "Economía") diff --git a/spec/features/tags_spec.rb b/spec/features/tags_spec.rb index 9c566d9d0..56e6f47a9 100644 --- a/spec/features/tags_spec.rb +++ b/spec/features/tags_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Tags" do - scenario "Index" do earth = create(:debate, tag_list: "Medio Ambiente") money = create(:debate, tag_list: "Economía") @@ -122,7 +121,6 @@ describe "Tags" do end context "Tag cloud" do - scenario "Proposals" do create(:proposal, tag_list: "Medio Ambiente") create(:proposal, tag_list: "Economía") @@ -195,7 +193,5 @@ describe "Tags" do expect(page).to have_content proposal2.title expect(page).not_to have_content proposal3.title end - end - end diff --git a/spec/features/topics_spec.rb b/spec/features/topics_spec.rb index 999c3bf8a..4aaf5e9ae 100644 --- a/spec/features/topics_spec.rb +++ b/spec/features/topics_spec.rb @@ -1,13 +1,11 @@ require "rails_helper" describe "Topics" do - context "Concerns" do it_behaves_like "notifiable in-app", :topic_with_community end context "New" do - scenario "Create new topic link should redirect to sign up for anonymous users", :js do proposal = create(:proposal) community = proposal.community @@ -49,11 +47,9 @@ describe "Topics" do expect(page).to have_content "Enjoy this space, the voices that fill it, it's yours too." expect(page).to have_button("Create topic") end - end context "Create" do - scenario "Can create a new topic", :js do proposal = create(:proposal) community = proposal.community @@ -77,11 +73,9 @@ describe "Topics" do expect(page).to have_content "You do not have permission to carry out the action 'new' on topic." end - end context "Edit" do - scenario "Can edit a topic" do proposal = create(:proposal) community = proposal.community @@ -109,11 +103,9 @@ describe "Topics" do expect(page).to have_content "You do not have permission to carry out the action 'edit' on topic." end - end context "Show" do - scenario "Can show topic" do proposal = create(:proposal) community = proposal.community @@ -124,11 +116,9 @@ describe "Topics" do expect(page).to have_content community.proposal.title expect(page).to have_content topic.title end - end context "Destroy" do - scenario "Can destroy a topic" do user = create(:user) topic = create(:topic, :with_community, author: user) @@ -152,7 +142,5 @@ describe "Topics" do expect(page).not_to have_link "Delete" end - end - end diff --git a/spec/features/tracking/budget_investments_spec.rb b/spec/features/tracking/budget_investments_spec.rb index c7f5b5f70..ddf00889e 100644 --- a/spec/features/tracking/budget_investments_spec.rb +++ b/spec/features/tracking/budget_investments_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Valuation budget investments" do - let(:budget) { create(:budget) } let(:tracker) do create(:tracker, user: create(:user, username: "Rachel", email: "rachel@trackers.org")) @@ -165,7 +164,6 @@ describe "Valuation budget investments" do visit tracking_budget_budget_investment_path(budget, investment) end.to raise_error "Not Found" end - end describe "Milestones" do @@ -179,7 +177,6 @@ describe "Valuation budget investments" do end scenario "visit investment manage milestones" do - visit tracking_budget_budget_investments_path(budget) click_link "Edit milestones" @@ -221,7 +218,6 @@ describe "Valuation budget investments" do visit edit_tracking_budget_budget_investment_path(budget, investment) expect(page).not_to have_content("Test delete milestone") - end scenario "edit investment milestones" do @@ -243,13 +239,10 @@ describe "Valuation budget investments" do expect(page).not_to have_content("Test edit milestone") expect(page).to have_content("Test edited milestone") - end - end describe "Progress Bars" do - let(:admin) { create(:administrator) } let(:investment) do create(:budget_investment, budget: budget, administrator: admin) @@ -275,7 +268,6 @@ describe "Valuation budget investments" do end scenario "create primary progress bar" do - visit tracking_budget_budget_investment_progress_bars_path(budget, investment) expect(page).to have_content("Progress bars") @@ -295,7 +287,6 @@ describe "Valuation budget investments" do end scenario "create secondary progress bar" do - visit tracking_budget_budget_investment_progress_bars_path(budget, investment) expect(page).to have_content("Progress bars") @@ -356,6 +347,5 @@ describe "Valuation budget investments" do expect(page).to have_content("edited") end - end end diff --git a/spec/features/tracking/budgets_spec.rb b/spec/features/tracking/budgets_spec.rb index 77f01043a..077666f5b 100644 --- a/spec/features/tracking/budgets_spec.rb +++ b/spec/features/tracking/budgets_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Tracking budgets" do - before do tracker = create(:tracker, user: create(:user, username: "Rachel", email: "rachel@trackers.org")) @@ -14,7 +13,6 @@ describe "Tracking budgets" do end context "Index" do - scenario "Displaying budgets" do budget = create(:budget) visit tracking_budgets_path @@ -28,5 +26,4 @@ describe "Tracking budgets" do expect(page).to have_content "There are no budgets" end end - end diff --git a/spec/features/tracks_spec.rb b/spec/features/tracks_spec.rb index b866a3fbb..ee79591b7 100644 --- a/spec/features/tracks_spec.rb +++ b/spec/features/tracks_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" describe "Tracking" do - context "Custom variable" do - scenario "Usertype anonymous" do visit proposals_path diff --git a/spec/features/user_invites_spec.rb b/spec/features/user_invites_spec.rb index 5e38ebb2c..664705902 100644 --- a/spec/features/user_invites_spec.rb +++ b/spec/features/user_invites_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "User invites" do - before do login_as_manager end @@ -14,5 +13,4 @@ describe "User invites" do expect(page).to have_content "3 invitations have been sent." end - end diff --git a/spec/features/users_auth_spec.rb b/spec/features/users_auth_spec.rb index a985dbae0..415a65733 100644 --- a/spec/features/users_auth_spec.rb +++ b/spec/features/users_auth_spec.rb @@ -1,10 +1,8 @@ require "rails_helper" describe "Users" do - context "Regular authentication" do context "Sign up" do - scenario "Success" do message = "You have been sent a message containing a verification link. Please click on this link to activate your account." visit "/" @@ -32,11 +30,9 @@ describe "Users" do expect(page).to have_content error_message end - end context "Sign in" do - scenario "sign in with email" do create(:user, email: "manuela@consul.dev", password: "judgementday") @@ -105,7 +101,6 @@ describe "Users" do context "OAuth authentication" do context "Twitter" do - let(:twitter_hash) { { provider: "twitter", uid: "12345", info: { name: "manuela" }} } let(:twitter_hash_with_email) { { provider: "twitter", uid: "12345", info: { name: "manuela", email: "manuelacarmena@example.com" }} } let(:twitter_hash_with_verified_email) do @@ -221,7 +216,6 @@ describe "Users" do visit edit_user_registration_path expect(page).to have_field("user_email", with: user.email) - end scenario "Try to register with the username of an already existing user" do @@ -364,7 +358,6 @@ describe "Users" do expect(page).to have_content "If your email address is in our database, in a few minutes "\ "you will receive a link to use to reset your password." - end scenario "Re-send confirmation instructions" do @@ -448,5 +441,4 @@ describe "Users" do expect(page).to have_content "must be different than the current password." end - end diff --git a/spec/features/users_spec.rb b/spec/features/users_spec.rb index 0b971d4ee..2a47e1fe0 100644 --- a/spec/features/users_spec.rb +++ b/spec/features/users_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Users" do - describe "Show (public page)" do let(:user) { create(:user) } @@ -134,7 +133,6 @@ describe "Users" do end expect(page).not_to have_link budget_investment.title end - end describe "Public activity" do @@ -224,7 +222,6 @@ describe "Users" do visit user_path(user) expect(page).to have_content(user.email) end - end end @@ -351,7 +348,6 @@ describe "Users" do end describe "Special comments" do - scenario "comments posted as moderator are not visible in user activity" do moderator = create(:administrator).user comment = create(:comment, user: moderator) @@ -430,7 +426,6 @@ describe "Users" do end describe "Proposals" do - scenario "Display following tab when user is following one proposal at least" do create(:proposal, followers: [user]) @@ -487,7 +482,6 @@ describe "Users" do end describe "Budget Investments" do - scenario "Display following tab when user is following one budget investment at least" do create(:budget_investment, followers: [user]) @@ -520,6 +514,5 @@ describe "Users" do expect(page).to have_link budget_investment.title end end - end end diff --git a/spec/features/valuation/budget_investments_spec.rb b/spec/features/valuation/budget_investments_spec.rb index a30efcf7a..11656f9ef 100644 --- a/spec/features/valuation/budget_investments_spec.rb +++ b/spec/features/valuation/budget_investments_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Valuation budget investments" do - let(:budget) { create(:budget, :valuating) } let(:valuator) do create(:valuator, user: create(:user, username: "Rachel", email: "rachel@valuators.org")) @@ -12,7 +11,6 @@ describe "Valuation budget investments" do end context "Load" do - before { budget.update(slug: "budget_slug") } scenario "finds investment using budget slug" do @@ -32,7 +30,6 @@ describe "Valuation budget investments" do visit valuation_budget_budget_investments_path(0) end.to raise_error ActiveRecord::RecordNotFound end - end scenario "Disabled with a feature flag" do diff --git a/spec/features/valuation/budgets_spec.rb b/spec/features/valuation/budgets_spec.rb index a6481799f..61a6ebf20 100644 --- a/spec/features/valuation/budgets_spec.rb +++ b/spec/features/valuation/budgets_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Valuation budgets" do - before do valuator = create(:valuator, user: create(:user, username: "Rachel", email: "rachel@valuators.org")) login_as(valuator.user) @@ -13,7 +12,6 @@ describe "Valuation budgets" do end context "Index" do - scenario "Displaying budgets" do budget = create(:budget) visit valuation_budgets_path @@ -39,5 +37,4 @@ describe "Valuation budgets" do expect(page).to have_content "There are no budgets" end end - end diff --git a/spec/features/valuation_spec.rb b/spec/features/valuation_spec.rb index 302899428..b14dbcc25 100644 --- a/spec/features/valuation_spec.rb +++ b/spec/features/valuation_spec.rb @@ -110,5 +110,4 @@ describe "Valuation" do expect(page).not_to have_css("#admin_menu") expect(page).not_to have_css("#moderation_menu") end - end diff --git a/spec/features/verification/email_spec.rb b/spec/features/verification/email_spec.rb index 4721510f1..3c3a4381f 100644 --- a/spec/features/verification/email_spec.rb +++ b/spec/features/verification/email_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Verify email" do - scenario "Verify" do user = create(:user, residence_verified_at: Time.current, diff --git a/spec/features/verification/letter_spec.rb b/spec/features/verification/letter_spec.rb index 91c5246bd..5ff61fde5 100644 --- a/spec/features/verification/letter_spec.rb +++ b/spec/features/verification/letter_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Verify Letter" do - scenario "Request a letter" do user = create(:user, residence_verified_at: Time.current, confirmed_phone: "611111111") @@ -41,7 +40,6 @@ describe "Verify Letter" do end context "Code verification" do - scenario "Valid verification user logged in" do user = create(:user, residence_verified_at: Time.current, confirmed_phone: "611111111", @@ -129,6 +127,5 @@ describe "Verify Letter" do expect(page).to have_content "You have reached the maximum number of attempts. Please try again later." expect(page).to have_current_path(account_path) end - end end diff --git a/spec/features/verification/level_two_verification_spec.rb b/spec/features/verification/level_two_verification_spec.rb index e9fc0bb24..499c3d8eb 100644 --- a/spec/features/verification/level_two_verification_spec.rb +++ b/spec/features/verification/level_two_verification_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Level two verification" do - scenario "Verification with residency and sms" do create(:geozone) user = create(:user) @@ -38,5 +37,4 @@ describe "Level two verification" do verify_residence end end - end diff --git a/spec/features/verification/residence_spec.rb b/spec/features/verification/residence_spec.rb index bf02abb91..a08ed5b23 100644 --- a/spec/features/verification/residence_spec.rb +++ b/spec/features/verification/residence_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Residence" do - before { create(:geozone) } scenario "Verify resident" do diff --git a/spec/features/verification/sms_spec.rb b/spec/features/verification/sms_spec.rb index 449062d44..035f36321 100644 --- a/spec/features/verification/sms_spec.rb +++ b/spec/features/verification/sms_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "SMS Verification" do - scenario "Verify" do user = create(:user, residence_verified_at: Time.current) login_as(user) @@ -76,5 +75,4 @@ describe "SMS Verification" do expect(page).to have_content "You have reached the maximum number of attempts. Please try again later." expect(page).to have_current_path(account_path) end - end diff --git a/spec/features/verification/verification_path_spec.rb b/spec/features/verification/verification_path_spec.rb index 6ff2ee46b..56c953bfc 100644 --- a/spec/features/verification/verification_path_spec.rb +++ b/spec/features/verification/verification_path_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Verification path" do - scenario "User is an organization" do user = create(:user, verified_at: Time.current) create(:organization, user: user) @@ -98,5 +97,4 @@ describe "Verification path" do expect(page).to have_content "Your account is already verified" end end - end diff --git a/spec/features/verification/verified_user_spec.rb b/spec/features/verification/verified_user_spec.rb index 579629a62..bf6652593 100644 --- a/spec/features/verification/verified_user_spec.rb +++ b/spec/features/verification/verified_user_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Verified users" do - scenario "Verified emails" do user = create(:user, residence_verified_at: Time.current, @@ -133,5 +132,4 @@ describe "Verified users" do expect(page).to have_current_path(new_sms_path) end - end diff --git a/spec/features/votes_spec.rb b/spec/features/votes_spec.rb index 2d1da1fa9..63626acb0 100644 --- a/spec/features/votes_spec.rb +++ b/spec/features/votes_spec.rb @@ -11,7 +11,6 @@ describe "Votes" do before { login_as(verified) } scenario "Index shows user votes on debates" do - debate1 = create(:debate) debate2 = create(:debate) debate3 = create(:debate) @@ -60,7 +59,6 @@ describe "Votes" do end describe "Single debate" do - scenario "Show no votes" do visit debate_path(create(:debate)) @@ -164,7 +162,6 @@ describe "Votes" do visit debates_path within("#debates") do - find(".in-favor a").click within(".in-favor") do @@ -363,5 +360,4 @@ describe "Votes" do expect_message_only_verified_can_vote_proposals end end - end diff --git a/spec/features/welcome_spec.rb b/spec/features/welcome_spec.rb index 5ba83d21b..648927efb 100644 --- a/spec/features/welcome_spec.rb +++ b/spec/features/welcome_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Welcome screen" do - let(:budget) { create(:budget) } it_behaves_like "remotely_translatable", @@ -48,7 +47,6 @@ describe "Welcome screen" do end scenario "a regular user does not see it when coing to /email" do - plain, encrypted = Devise.token_generator.generate(User, :email_verification_token) user = create(:user, email_verification_token: plain) @@ -107,7 +105,6 @@ describe "Welcome screen" do scenario "a regular users sees it the first time he logs in, with all options active if the setting skip_verification is activated" do - Setting["feature.user.skip_verification"] = "true" user = create(:user) @@ -118,5 +115,4 @@ describe "Welcome screen" do expect(page).to have_css "li:nth-child(#{i + 1})" end end - end diff --git a/spec/helpers/admin_helper_spec.rb b/spec/helpers/admin_helper_spec.rb index c5cc7c25b..08b6dc0a8 100644 --- a/spec/helpers/admin_helper_spec.rb +++ b/spec/helpers/admin_helper_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" describe AdminHelper do - describe "#admin_submit_action" do - it "returns new when the the resource has not been persisted" do poll = build(:poll) expect(admin_submit_action(poll)).to eq("new") @@ -13,7 +11,5 @@ describe AdminHelper do poll = create(:poll) expect(admin_submit_action(poll)).to eq("edit") end - end - end diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 7ad856681..7d952afba 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe ApplicationHelper do - describe "#author_of?" do it "is true if user is the author" do user = create(:user) @@ -23,5 +22,4 @@ describe ApplicationHelper do expect(author_of?(proposal, nil)).to eq false end end - end diff --git a/spec/helpers/budget_investments_helper_spec.rb b/spec/helpers/budget_investments_helper_spec.rb index c60058b56..3b97dbb1b 100644 --- a/spec/helpers/budget_investments_helper_spec.rb +++ b/spec/helpers/budget_investments_helper_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" RSpec.describe BudgetInvestmentsHelper, type: :helper do - describe "#set_direction" do - it "returns ASC if current_direction is DESC" do expect(set_direction("desc")).to eq "asc" end @@ -43,5 +41,4 @@ RSpec.describe BudgetInvestmentsHelper, type: :helper do expect(set_sorting_icon("asc", sort_by)).to eq "" end end - end diff --git a/spec/helpers/comments_helper_spec.rb b/spec/helpers/comments_helper_spec.rb index e24677757..07098c6a8 100644 --- a/spec/helpers/comments_helper_spec.rb +++ b/spec/helpers/comments_helper_spec.rb @@ -11,9 +11,7 @@ require "rails_helper" # end # end RSpec.describe CommentsHelper, type: :helper do - describe "#user_level_class" do - def comment_double(as_administrator: false, as_moderator: false, official: false) user = instance_double("User", official?: official, official_level: "Y") instance_double("Comment", as_administrator?: as_administrator, as_moderator?: as_moderator, user: user) diff --git a/spec/helpers/geozones_helper_spec.rb b/spec/helpers/geozones_helper_spec.rb index 69f4ba963..b89706bdb 100644 --- a/spec/helpers/geozones_helper_spec.rb +++ b/spec/helpers/geozones_helper_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe GeozonesHelper do - describe "#geozone_name" do let(:geozone) { create :geozone } @@ -27,5 +26,4 @@ describe GeozonesHelper do expect(select_options).to eq [[g1.name, g1.id], [g2.name, g2.id], [g3.name, g3.id]] end end - end diff --git a/spec/helpers/locales_helper_spec.rb b/spec/helpers/locales_helper_spec.rb index 3ae50dbde..f908b6991 100644 --- a/spec/helpers/locales_helper_spec.rb +++ b/spec/helpers/locales_helper_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" describe LocalesHelper do - context "Language names" do - let!(:default_enforce) { I18n.enforce_available_locales } before do @@ -28,6 +26,5 @@ describe LocalesHelper do it "retuns the locale key if i18n.language.name translation is not found" do expect(name_for_locale(:wl)).to eq("wl") end - end end diff --git a/spec/helpers/proposals_helper_spec.rb b/spec/helpers/proposals_helper_spec.rb index 6ee3706e0..2daf8aa37 100644 --- a/spec/helpers/proposals_helper_spec.rb +++ b/spec/helpers/proposals_helper_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe ProposalsHelper do - describe "#progress_bar_percentage" do it "is 0 if no votes" do proposal = create(:proposal) @@ -39,7 +38,5 @@ describe ProposalsHelper do proposal = create(:proposal, cached_votes_up: Proposal.votes_needed_for_success * 2) expect(supports_percentage(proposal)).to eq "100%" end - end - end diff --git a/spec/helpers/settings_helper_spec.rb b/spec/helpers/settings_helper_spec.rb index a5b8f7299..e63ddb773 100644 --- a/spec/helpers/settings_helper_spec.rb +++ b/spec/helpers/settings_helper_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" RSpec.describe SettingsHelper, type: :helper do - describe "#setting" do - it "returns a hash with all settings values" do Setting["key1"] = "value1" Setting["key2"] = "value2" @@ -16,7 +14,6 @@ RSpec.describe SettingsHelper, type: :helper do describe "#feature?" do it "returns presence of feature flag setting value" do - Setting["feature.f1"] = "active" Setting["feature.f2"] = "" Setting["feature.f3"] = nil @@ -36,5 +33,4 @@ RSpec.describe SettingsHelper, type: :helper do expect(display_setting_name("remote_census_response_name")).to eq("Response Data") end end - end diff --git a/spec/helpers/signature_sheets_helper_spec.rb b/spec/helpers/signature_sheets_helper_spec.rb index a02c79e0a..8e2e5efcc 100644 --- a/spec/helpers/signature_sheets_helper_spec.rb +++ b/spec/helpers/signature_sheets_helper_spec.rb @@ -1,18 +1,14 @@ require "rails_helper" describe SignatureSheetsHelper do - describe "#required_fields_to_verify_text_help by default" do - it "returns text help by default" do text = "Write the numbers separated by semicolons (;)" expect(required_fields_to_verify_text_help).to eq(text) end - end describe "#required_fields_to_verify_text_help with remote_census active" do - before do Setting["feature.remote_census"] = true end @@ -70,7 +66,5 @@ describe SignatureSheetsHelper do Setting["remote_census.request.postal_code"] = nil Setting["remote_census.request.postal_code"] = nil end - end - end diff --git a/spec/helpers/text_helper_spec.rb b/spec/helpers/text_helper_spec.rb index 6fce5abb1..48f1b1f65 100644 --- a/spec/helpers/text_helper_spec.rb +++ b/spec/helpers/text_helper_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe TextHelper do - describe "#first_paragraph" do it "returns the first paragraph of a text" do text = "\n\nThis is the first paragraph\n\nThis is the second paragraph\n" @@ -13,5 +12,4 @@ describe TextHelper do expect(first_paragraph(nil)).to eq("") end end - end diff --git a/spec/helpers/users_helper_spec.rb b/spec/helpers/users_helper_spec.rb index 71de4ee27..0a032fb73 100644 --- a/spec/helpers/users_helper_spec.rb +++ b/spec/helpers/users_helper_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe UsersHelper do - describe "#humanize_document_type" do it "returns a humanized document type" do expect(humanize_document_type("1")).to eq "DNI" @@ -55,5 +54,4 @@ describe UsersHelper do ' (This debate has been deleted)') end end - end diff --git a/spec/helpers/verification_helper_spec.rb b/spec/helpers/verification_helper_spec.rb index 5ed838c9f..81330ff3f 100644 --- a/spec/helpers/verification_helper_spec.rb +++ b/spec/helpers/verification_helper_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe VerificationHelper do - describe "#mask_phone" do it "masks a phone" do expect(mask_phone("612345678")).to eq("******678") @@ -20,5 +19,4 @@ describe VerificationHelper do expect(mask_email("aina@example.com")).to eq("ain*@example.com") end end - end diff --git a/spec/helpers/votes_helper_spec.rb b/spec/helpers/votes_helper_spec.rb index 259025e63..2ed294d4b 100644 --- a/spec/helpers/votes_helper_spec.rb +++ b/spec/helpers/votes_helper_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe VotesHelper do - describe "#voted_for?" do it "returns true if voted for a proposal" do proposal = create(:proposal) @@ -28,5 +27,4 @@ describe VotesHelper do expect(votes_percentage("dislikes", debate)).to eq("28%") end end - end diff --git a/spec/i18n_spec.rb b/spec/i18n_spec.rb index 7cbd11ca6..d42fc3181 100644 --- a/spec/i18n_spec.rb +++ b/spec/i18n_spec.rb @@ -17,7 +17,6 @@ describe "I18n" do end context "Plurals" do - after do I18n.backend.reload! end diff --git a/spec/lib/acts_as_paranoid_aliases_spec.rb b/spec/lib/acts_as_paranoid_aliases_spec.rb index b743039bf..28f85d3cf 100644 --- a/spec/lib/acts_as_paranoid_aliases_spec.rb +++ b/spec/lib/acts_as_paranoid_aliases_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Paranoid methods" do - describe ".hide_all" do it "hides all instances in the id list" do debate1 = create(:debate) @@ -43,5 +42,4 @@ describe "Paranoid methods" do expect(debate.reload.confirmed_hide?).not_to be end end - end diff --git a/spec/lib/acts_as_taggable_on_spec.rb b/spec/lib/acts_as_taggable_on_spec.rb index cb9e6d842..0c17e31ec 100644 --- a/spec/lib/acts_as_taggable_on_spec.rb +++ b/spec/lib/acts_as_taggable_on_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe ActsAsTaggableOn do - describe "Tagging" do describe "when tagging debates or proposals" do let(:proposal) { create(:proposal) } @@ -46,7 +45,6 @@ describe ActsAsTaggableOn do describe "Tag" do describe "public_for_api scope" do - it "returns tags whose kind is NULL and have at least one tagging whose taggable is not hidden" do tag = create(:tag, kind: nil) proposal = create(:proposal) @@ -127,7 +125,5 @@ describe ActsAsTaggableOn do expect(Tag.search("fami").first.name).to eq("Familia") end end - end - end diff --git a/spec/lib/admin_wysiwyg_sanitizer_spec.rb b/spec/lib/admin_wysiwyg_sanitizer_spec.rb index ecfee0073..2ec5c381e 100644 --- a/spec/lib/admin_wysiwyg_sanitizer_spec.rb +++ b/spec/lib/admin_wysiwyg_sanitizer_spec.rb @@ -4,7 +4,6 @@ describe AdminWYSIWYGSanitizer do let(:sanitizer) { AdminWYSIWYGSanitizer.new } describe "#sanitize" do - it "allows images" do html = 'DangerousSmile image' expect(sanitizer.sanitize(html)).to eq(html) @@ -28,6 +27,5 @@ describe AdminWYSIWYGSanitizer do ' expect(sanitizer.sanitize(html)).to eq(html) end - end end diff --git a/spec/lib/cache_spec.rb b/spec/lib/cache_spec.rb index 4289f938f..ddc467a69 100644 --- a/spec/lib/cache_spec.rb +++ b/spec/lib/cache_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe "Cache flow" do - describe "Tag destroy" do it "invalidates Debate cache keys" do debate = create(:debate, tag_list: "Good, Bad") @@ -10,5 +9,4 @@ describe "Cache flow" do expect { tag.destroy }.to change { debate.reload.cache_key } end end - end diff --git a/spec/lib/census_api_spec.rb b/spec/lib/census_api_spec.rb index 94f2d0c35..0338308f0 100644 --- a/spec/lib/census_api_spec.rb +++ b/spec/lib/census_api_spec.rb @@ -39,5 +39,4 @@ describe CensusApi do expect(response).not_to be_valid end end - end diff --git a/spec/lib/document_parser_spec.rb b/spec/lib/document_parser_spec.rb index d4b2d34da..d44f8c5f0 100644 --- a/spec/lib/document_parser_spec.rb +++ b/spec/lib/document_parser_spec.rb @@ -2,7 +2,6 @@ require "rails_helper" include DocumentParser describe DocumentParser do - describe "#get_document_number_variants" do it "trims and cleans up entry" do expect(DocumentParser.get_document_number_variants(2, " 1 2@ 34")).to eq(["1234"]) @@ -26,5 +25,4 @@ describe DocumentParser do expect(DocumentParser.get_document_number_variants(1, "1234567A")).to eq(%w[1234567 01234567 1234567a 1234567A 01234567a 01234567A]) end end - end diff --git a/spec/lib/email_digests_spec.rb b/spec/lib/email_digests_spec.rb index 3a8413686..ab96fc0d6 100644 --- a/spec/lib/email_digests_spec.rb +++ b/spec/lib/email_digests_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" describe EmailDigest do - describe "notifications" do - it "returns notifications for a user" do user1 = create(:user) user2 = create(:user) @@ -29,7 +27,6 @@ describe EmailDigest do expect(email_digest.notifications).to eq [notification1] expect(email_digest.notifications).not_to include(notification2) end - end describe "pending_notifications?" do @@ -53,7 +50,6 @@ describe EmailDigest do email_digest = EmailDigest.new(user) expect(email_digest.pending_notifications?).not_to be end - end describe "deliver" do @@ -79,11 +75,9 @@ describe EmailDigest do expect(all_emails).to be_empty end - end describe "mark_as_emailed" do - it "marks notifications as emailed" do user1 = create(:user) user2 = create(:user) @@ -120,11 +114,9 @@ describe EmailDigest do expect(user1.failed_email_digests_count).to eq(0) expect(user2.failed_email_digests_count).to eq(0) end - end describe "#valid_email?" do - it "returns a MatchData if email is valid" do user = create(:user, email: "valid_email@email.com") @@ -147,5 +139,4 @@ describe EmailDigest do expect(email_digest.valid_email?).to be(false) end end - end diff --git a/spec/lib/evaluation_comment_email_spec.rb b/spec/lib/evaluation_comment_email_spec.rb index f45901752..9e9688fec 100644 --- a/spec/lib/evaluation_comment_email_spec.rb +++ b/spec/lib/evaluation_comment_email_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe EvaluationCommentEmail do - let(:author) { create(:user) } let(:administrator) { create(:administrator) } let(:investment) { create(:budget_investment, author: author, administrator: administrator) } @@ -53,5 +52,4 @@ describe EvaluationCommentEmail do expect(comment_email.can_be_sent?).to be false end end - end diff --git a/spec/lib/graphql_spec.rb b/spec/lib/graphql_spec.rb index a69f0b0b5..f38970f96 100644 --- a/spec/lib/graphql_spec.rb +++ b/spec/lib/graphql_spec.rb @@ -128,7 +128,6 @@ describe "Consul Schema" do expect(received_comments).to eq [] end - end describe "Proposals" do @@ -196,7 +195,6 @@ describe "Consul Schema" do votes = response["data"]["proposal"]["votes_for"]["edges"] expect(votes.count).to eq(2) end - end describe "Debates" do @@ -408,7 +406,6 @@ describe "Consul Schema" do end describe "Proposal notifications" do - it "does not include proposal notifications for hidden proposals" do visible_proposal = create(:proposal) hidden_proposal = create(:proposal, :hidden) @@ -455,7 +452,6 @@ describe "Consul Schema" do expect(received_proposals).to match_array ["Visible"] end - end describe "Tags" do @@ -528,11 +524,9 @@ describe "Consul Schema" do expect(received_tags).not_to include("Health") end - end describe "Votes" do - it "only returns votes from proposals, debates and comments" do create(:proposal, voters: [create(:user)]) create(:debate, voters: [create(:user)]) @@ -640,7 +634,5 @@ describe "Consul Schema" do expect(Time.zone.parse(received_timestamps.first)).to eq Time.zone.parse("2017-12-31 9:00:00") end - end - end diff --git a/spec/lib/local_census_spec.rb b/spec/lib/local_census_spec.rb index 4a20e107e..5b2bc7af2 100644 --- a/spec/lib/local_census_spec.rb +++ b/spec/lib/local_census_spec.rb @@ -27,5 +27,4 @@ describe LocalCensus do expect(response).not_to be_valid end end - end diff --git a/spec/lib/remote_census_api_spec.rb b/spec/lib/remote_census_api_spec.rb index 83fe1464c..85adafd7c 100644 --- a/spec/lib/remote_census_api_spec.rb +++ b/spec/lib/remote_census_api_spec.rb @@ -62,7 +62,6 @@ describe RemoteCensusApi do end describe "request structure correctly filled" do - before do Setting["feature.remote_census"] = true Setting["remote_census.request.structure"] = '{ "request": @@ -149,11 +148,9 @@ describe RemoteCensusApi do "nivel" => 3 } }) end - end describe "get_response_body" do - before do Setting["feature.remote_census"] = true end @@ -185,11 +182,9 @@ describe RemoteCensusApi do } }) end - end describe "RemoteCensusApi::Response" do - before do Setting["feature.remote_census"] = true access_user_data = "get_habita_datos_response.get_habita_datos_return.datos_habitante.item" @@ -217,7 +212,5 @@ describe RemoteCensusApi do expect(response.gender).to eq "male" expect(response.name).to eq "José García" end - end - end diff --git a/spec/lib/remote_translations/caller_spec.rb b/spec/lib/remote_translations/caller_spec.rb index 4ef68de1d..3b7818219 100644 --- a/spec/lib/remote_translations/caller_spec.rb +++ b/spec/lib/remote_translations/caller_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe RemoteTranslations::Caller do - before do RemoteTranslation.skip_callback(:create, :after, :enqueue_remote_translation) end @@ -62,7 +61,6 @@ describe RemoteTranslations::Caller do end context "Proposals" do - let!(:proposal) { create(:proposal) } let(:remote_translation) do create(:remote_translation, remote_translatable: proposal, locale: :es) @@ -113,7 +111,6 @@ describe RemoteTranslations::Caller do end context "Budget Investments" do - let(:budget_investment) { create(:budget_investment) } let(:remote_translation) do create(:remote_translation, remote_translatable: budget_investment, locale: :es) @@ -208,7 +205,5 @@ describe RemoteTranslations::Caller do expect(RemoteTranslation.count).to eq(0) end end - end - end diff --git a/spec/lib/remote_translations/microsoft/client_spec.rb b/spec/lib/remote_translations/microsoft/client_spec.rb index 9a6341406..8259219be 100644 --- a/spec/lib/remote_translations/microsoft/client_spec.rb +++ b/spec/lib/remote_translations/microsoft/client_spec.rb @@ -1,11 +1,9 @@ require "rails_helper" describe RemoteTranslations::Microsoft::Client do - let(:client) { RemoteTranslations::Microsoft::Client.new } describe "#call" do - context "when characters from request are less than the characters limit" do it "response has the expected result" do response = create_response("Nuevo título", "Nueva descripción") @@ -26,7 +24,6 @@ describe RemoteTranslations::Microsoft::Client do expect(result).to eq([nil, "Nueva descripción"]) end - end context "when characters from request are greater than characters limit" do @@ -96,13 +93,10 @@ describe RemoteTranslations::Microsoft::Client do expect(result).to eq([translated_text_es, another_translated_text_es]) end - end - end describe "#detect_split_position" do - context "text has less characters than characters limit" do it "does not split the text" do stub_const("RemoteTranslations::Microsoft::Client::CHARACTERS_LIMIT_PER_REQUEST", 20) @@ -149,7 +143,6 @@ describe RemoteTranslations::Microsoft::Client do expect(result).to eq([sub_part_text_1 + sub_part_text_2, sub_part_text_3 + sub_part_text_4]) end - end end end diff --git a/spec/lib/reply_email_spec.rb b/spec/lib/reply_email_spec.rb index 834eb89af..89c3a2779 100644 --- a/spec/lib/reply_email_spec.rb +++ b/spec/lib/reply_email_spec.rb @@ -33,7 +33,6 @@ describe ReplyEmail do end describe "#can_be_sent?" do - it "returns true if comment and recipient exist" do expect(reply_email.can_be_sent?).to be true end @@ -49,7 +48,5 @@ describe ReplyEmail do expect(reply_email.can_be_sent?).to be false end - end - end diff --git a/spec/lib/tag_sanitizer_spec.rb b/spec/lib/tag_sanitizer_spec.rb index 73bf7f07a..d3c25d594 100644 --- a/spec/lib/tag_sanitizer_spec.rb +++ b/spec/lib/tag_sanitizer_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe TagSanitizer do - subject { TagSanitizer.new } describe "#sanitize_tag" do @@ -25,5 +24,4 @@ describe TagSanitizer do expect(subject.sanitize_tag_list(%w[x=1 y?z])).to eq(%w[x1 yz]) end end - end diff --git a/spec/lib/tasks/budgets_spec.rb b/spec/lib/tasks/budgets_spec.rb index c816c2ad6..f1cd161a6 100644 --- a/spec/lib/tasks/budgets_spec.rb +++ b/spec/lib/tasks/budgets_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Budget do - let(:run_rake_task) do Rake::Task["budgets:set_original_heading_id"].reenable Rake.application.invoke_task("budgets:set_original_heading_id") diff --git a/spec/lib/tasks/dashboards_spec.rb b/spec/lib/tasks/dashboards_spec.rb index d8af4f81f..212979f91 100644 --- a/spec/lib/tasks/dashboards_spec.rb +++ b/spec/lib/tasks/dashboards_spec.rb @@ -2,9 +2,7 @@ require "rails_helper" require "rake" describe "Dashboards Rake" do - describe "#send_notifications" do - before do Rake.application.rake_require "tasks/dashboards" Rake::Task.define_task(:environment) @@ -18,7 +16,6 @@ describe "Dashboards Rake" do end describe "Not send notifications to proposal author" do - let!(:action) { create(:dashboard_action, :proposed_action, :active, day_offset: 1) } let!(:resource) { create(:dashboard_action, :resource, :active, day_offset: 1) } @@ -45,7 +42,6 @@ describe "Dashboards Rake" do expect { run_rake_task }.to change { ActionMailer::Base.deliveries.count }.by(0) end - end describe "Send notifications to proposal author" do @@ -78,7 +74,5 @@ describe "Dashboards Rake" do expect(email).to have_subject("More news about your citizen proposal") end end - end - end diff --git a/spec/lib/user_segments_spec.rb b/spec/lib/user_segments_spec.rb index 3aa15257e..f59f55968 100644 --- a/spec/lib/user_segments_spec.rb +++ b/spec/lib/user_segments_spec.rb @@ -218,5 +218,4 @@ describe UserSegments do expect(emails).to eq ["first@email.com", "last@email.com"] end end - end diff --git a/spec/lib/wysiwyg_sanitizer_spec.rb b/spec/lib/wysiwyg_sanitizer_spec.rb index 286c6f665..0defc07ff 100644 --- a/spec/lib/wysiwyg_sanitizer_spec.rb +++ b/spec/lib/wysiwyg_sanitizer_spec.rb @@ -1,11 +1,9 @@ require "rails_helper" describe WYSIWYGSanitizer do - subject { WYSIWYGSanitizer.new } describe "#sanitize" do - it "returns an html_safe string" do expect(subject.sanitize("hello")).to be_html_safe end @@ -35,5 +33,4 @@ describe WYSIWYGSanitizer do expect(subject.sanitize(html)).to eq("Dangerous image") end end - end diff --git a/spec/mailers/dashboard/mailer_spec.rb b/spec/mailers/dashboard/mailer_spec.rb index f9d430ce7..2bc2dd047 100644 --- a/spec/mailers/dashboard/mailer_spec.rb +++ b/spec/mailers/dashboard/mailer_spec.rb @@ -40,11 +40,9 @@ describe Dashboard::Mailer do expect(email).to have_body_text("Share in") expect(email).to have_body_text(proposal_path(proposal)) end - end describe "#new_actions_notification rake task" do - before do Rake.application.rake_require "tasks/dashboards" Rake::Task.define_task(:environment) @@ -150,7 +148,6 @@ describe Dashboard::Mailer do end describe "#new_actions_notification_on_create" do - before do ActionMailer::Base.deliveries.clear end @@ -214,7 +211,6 @@ describe Dashboard::Mailer do end describe "#new_actions_notification_on_published" do - before do ActionMailer::Base.deliveries.clear @@ -273,5 +269,4 @@ describe Dashboard::Mailer do expect(email).to have_body_text("Go ahead, discover them!") end end - end diff --git a/spec/models/abilities/common_spec.rb b/spec/models/abilities/common_spec.rb index 4e7b16ef6..4a109391c 100644 --- a/spec/models/abilities/common_spec.rb +++ b/spec/models/abilities/common_spec.rb @@ -316,5 +316,4 @@ describe Abilities::Common do it { should be_able_to(:disable_recommendations, Debate) } it { should be_able_to(:disable_recommendations, Proposal) } end - end diff --git a/spec/models/activity_spec.rb b/spec/models/activity_spec.rb index 1d13a48a5..16db70490 100644 --- a/spec/models/activity_spec.rb +++ b/spec/models/activity_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Activity do - it "is valid for different actionables" do expect(build(:activity, actionable: create(:proposal))).to be_valid expect(build(:activity, actionable: create(:debate))).to be_valid @@ -79,5 +78,4 @@ describe Activity do expect(Activity.on_budget_investments).to eq [on_investment] end end - end diff --git a/spec/models/admin_notification_spec.rb b/spec/models/admin_notification_spec.rb index 342f32a57..05eb7b5aa 100644 --- a/spec/models/admin_notification_spec.rb +++ b/spec/models/admin_notification_spec.rb @@ -89,5 +89,4 @@ describe AdminNotification do expect(admin_notification.list_of_recipients).not_to include(erased_user) end end - end diff --git a/spec/models/administrator_spec.rb b/spec/models/administrator_spec.rb index 7673b898a..fdf061ed1 100644 --- a/spec/models/administrator_spec.rb +++ b/spec/models/administrator_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Administrator do - describe "#description_or_name" do let!(:user) { create(:user, username: "Billy Wilder") } @@ -41,5 +40,4 @@ describe Administrator do expect(administrator.description_or_name_and_email).to eq("Billy Wilder (test@test.com)") end end - end diff --git a/spec/models/banner_spec.rb b/spec/models/banner_spec.rb index d253efc27..92e3ef407 100644 --- a/spec/models/banner_spec.rb +++ b/spec/models/banner_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Banner do - let(:banner) { build(:banner) } describe "Concerns" do @@ -12,5 +11,4 @@ describe Banner do it "is valid" do expect(banner).to be_valid end - end diff --git a/spec/models/budget/ballot/line_spec.rb b/spec/models/budget/ballot/line_spec.rb index 933b67ab4..a4a164cd8 100644 --- a/spec/models/budget/ballot/line_spec.rb +++ b/spec/models/budget/ballot/line_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Budget::Ballot::Line do - let(:budget) { create(:budget) } let(:group) { create(:budget_group, budget: budget) } let(:heading) { create(:budget_heading, group: group, price: 10000000) } @@ -10,7 +9,6 @@ describe Budget::Ballot::Line do let(:ballot_line) { build(:budget_ballot_line, ballot: ballot, investment: investment) } describe "Validations" do - it "is valid and automatically denormallyze budget, group and heading when validated" do expect(ballot_line).to be_valid expect(ballot_line.budget).to eq(budget) @@ -41,11 +39,9 @@ describe Budget::Ballot::Line do expect(ballot_line).to be_valid end end - end describe "#store_user_heading" do - it "stores the heading where the user has voted" do user = create(:user, :level_two) investment = create(:budget_investment, :selected) @@ -58,9 +54,7 @@ describe Budget::Ballot::Line do end describe "scopes" do - describe "by_investment" do - it "returns ballot lines for an investment" do investment1 = create(:budget_investment, :selected, heading: heading) investment2 = create(:budget_investment, :selected, heading: heading) @@ -78,7 +72,6 @@ describe Budget::Ballot::Line do expect(ballot_lines_by_investment).to match_array [ballot_line1, ballot_line2] expect(ballot_lines_by_investment).not_to include ballot_line3 end - end end end diff --git a/spec/models/budget/ballot_spec.rb b/spec/models/budget/ballot_spec.rb index 9d2f3e547..a06aad9d4 100644 --- a/spec/models/budget/ballot_spec.rb +++ b/spec/models/budget/ballot_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" describe Budget::Ballot do - describe "validations" do - it "is valid" do budget = create(:budget) ballot = create(:budget_ballot, budget: budget) @@ -18,7 +16,6 @@ describe Budget::Ballot do expect { ballot.investments << investment }.to raise_error(ActiveRecord::RecordNotUnique) end - end describe "#amount_spent" do @@ -97,7 +94,6 @@ describe Budget::Ballot do end describe "#heading_for_group" do - it "returns the heading with balloted investments for a group" do budget = create(:budget) ballot = create(:budget_ballot, budget: budget) @@ -121,7 +117,5 @@ describe Budget::Ballot do expect(ballot.heading_for_group(group)).to eq nil end - end - end diff --git a/spec/models/budget/group_spec.rb b/spec/models/budget/group_spec.rb index f74f3efa1..c38058dcd 100644 --- a/spec/models/budget/group_spec.rb +++ b/spec/models/budget/group_spec.rb @@ -5,7 +5,6 @@ describe Budget::Group do it_behaves_like "globalizable", :budget_group describe "Validations" do - let(:budget) { create(:budget) } let(:group) { create(:budget_group, budget: budget) } @@ -31,7 +30,6 @@ describe Budget::Group do expect(build(:budget_group, budget: budget, name_en: "Español")).not_to be_valid end end - end describe "#sort_by_name" do diff --git a/spec/models/budget/heading_spec.rb b/spec/models/budget/heading_spec.rb index fa15cd88d..61dfa7d2b 100644 --- a/spec/models/budget/heading_spec.rb +++ b/spec/models/budget/heading_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Budget::Heading do - let(:budget) { create(:budget) } let(:group) { create(:budget_group, budget: budget) } @@ -15,7 +14,6 @@ describe Budget::Heading do end describe "name" do - let(:heading) { create(:budget_heading, group: group) } before do @@ -73,7 +71,6 @@ describe Budget::Heading do end describe "save latitude" do - it "Doesn't allow latitude < -90" do heading = create(:budget_heading, group: group, name: "Latitude is < -90") @@ -170,7 +167,6 @@ describe Budget::Heading do end describe "save longitude" do - it "Doesn't allow longitude < -180" do heading = create(:budget_heading, group: group, name: "Longitude is < -180") @@ -280,7 +276,6 @@ describe Budget::Heading do end describe ".sort_by_name" do - it "returns headings sorted by DESC group name first and then ASC heading name" do last_group = create(:budget_group, name: "Group A") first_group = create(:budget_group, name: "Group B") @@ -303,7 +298,6 @@ describe Budget::Heading do expect(Budget::Heading.sort_by_name).to eq [first_heading, last_heading] end - end describe "scope allow_custom_content" do @@ -329,5 +323,4 @@ describe Budget::Heading do expect(Budget::Heading.allow_custom_content).to eq [translated_heading] end end - end diff --git a/spec/models/budget/investment_spec.rb b/spec/models/budget/investment_spec.rb index 7f0d4efa0..1b6d19a56 100644 --- a/spec/models/budget/investment_spec.rb +++ b/spec/models/budget/investment_spec.rb @@ -325,7 +325,6 @@ describe Budget::Investment do end describe "#by_budget" do - it "returns investments scoped by budget" do budget1 = create(:budget) budget2 = create(:budget) @@ -410,7 +409,6 @@ describe Budget::Investment do end describe "scoped_filter" do - let!(:budget) { create(:budget, slug: "budget_slug") } let!(:heading) { create(:budget_heading, budget: budget) } let!(:investment) { create(:budget_investment, :feasible, heading: heading) } @@ -429,7 +427,6 @@ describe Budget::Investment do result = Budget::Investment.scoped_filter({ budget_id: "wrong_budget" }, nil) expect(result).to be_empty end - end describe "scopes" do @@ -675,7 +672,6 @@ describe Budget::Investment do end describe "apply_filters_and_search" do - let(:budget) { create(:budget) } it "returns feasible investments" do @@ -786,7 +782,6 @@ describe Budget::Investment do results = Budget::Investment.search("Danny") expect(results).to eq([budget_investment]) end - end context "tags" do @@ -808,7 +803,6 @@ describe Budget::Investment do expect(investment.valuation_tag_list).to match_array(%w[Code Test Refactor]) end end - end describe "Permissions" do @@ -916,7 +910,6 @@ describe Budget::Investment do end describe "#can_vote_in_another_heading?" do - let(:districts) { create(:budget_group, budget: budget) } let(:carabanchel) { create(:budget_heading, group: districts) } let(:salamanca) { create(:budget_heading, group: districts) } @@ -947,7 +940,6 @@ describe Budget::Investment do end describe "#voted_in?" do - let(:user) { create(:user) } let(:investment) { create(:budget_investment) } @@ -960,12 +952,10 @@ describe Budget::Investment do it "returns false if the user has not voted in this heading" do expect(investment.voted_in?(investment.heading, user)).to eq(false) end - end describe "Order" do describe "#sort_by_confidence_score" do - it "orders by confidence_score" do least_voted = create(:budget_investment, cached_votes_up: 1) most_voted = create(:budget_investment, cached_votes_up: 10) @@ -1028,7 +1018,6 @@ describe Budget::Investment do end describe "Final Voting" do - describe "Permissions" do let(:budget) { create(:budget) } let(:heading) { create(:budget_heading, budget: budget) } @@ -1095,22 +1084,17 @@ describe Budget::Investment do expect(inv2.reason_for_not_being_ballotable_by(user, ballot)).to eq(:not_enough_money) end - end - end - end describe "Reclassification" do - let(:budget) { create(:budget, :balloting) } let(:group) { create(:budget_group, budget: budget) } let(:heading1) { create(:budget_heading, group: group) } let(:heading2) { create(:budget_heading, group: group) } describe "heading_changed?" do - it "returns true if budget is in balloting phase and heading has changed" do investment = create(:budget_investment, heading: heading1) investment.heading = heading2 @@ -1135,11 +1119,9 @@ describe Budget::Investment do expect(investment.heading_changed?).to eq(false) end end - end describe "log_heading_change" do - it "stores the previous heading before being reclassified" do investment = create(:budget_investment, heading: heading1) @@ -1153,11 +1135,9 @@ describe Budget::Investment do expect(investment.heading_id).to eq(heading2.id) expect(investment.previous_heading_id).to eq(heading1.id) end - end describe "store_reclassified_votes" do - it "stores the votes for a reclassified investment" do investment = create(:budget_investment, :selected, heading: heading1) @@ -1178,7 +1158,6 @@ describe Budget::Investment do end describe "remove_reclassified_votes" do - it "removes votes from invesment" do investment = create(:budget_investment, :selected, heading: heading1) @@ -1192,11 +1171,9 @@ describe Budget::Investment do investment.reload expect(investment.ballot_lines_count).to eq(0) end - end describe "check_for_reclassification" do - it "stores reclassfied votes and removes actual votes if an investment has been reclassified" do investment = create(:budget_investment, :selected, heading: heading1) @@ -1225,9 +1202,7 @@ describe Budget::Investment do expect(investment.ballot_lines_count).to eq(3) expect(Budget::ReclassifiedVote.count).to eq(0) end - end - end describe "scoped_filter" do @@ -1330,7 +1305,6 @@ describe Budget::Investment do investment.valuators << valuator investment.administrator = administrator expect(investment.admin_and_valuator_users_associated).to eq([valuator, administrator]) - end end diff --git a/spec/models/budget/phase_spec.rb b/spec/models/budget/phase_spec.rb index 8fae98edd..c0b4852b7 100644 --- a/spec/models/budget/phase_spec.rb +++ b/spec/models/budget/phase_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Budget::Phase do - let(:budget) { create(:budget) } let(:first_phase) { budget.phases.drafting } let(:second_phase) { budget.phases.informing } diff --git a/spec/models/budget/reclassified_vote_spec.rb b/spec/models/budget/reclassified_vote_spec.rb index a683e3564..90f0e04f5 100644 --- a/spec/models/budget/reclassified_vote_spec.rb +++ b/spec/models/budget/reclassified_vote_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Budget::ReclassifiedVote do - describe "Validations" do let(:reclassified_vote) { build(:budget_reclassified_vote) } @@ -36,5 +35,4 @@ describe Budget::ReclassifiedVote do expect(reclassified_vote).to be_valid end end - end diff --git a/spec/models/budget/result_spec.rb b/spec/models/budget/result_spec.rb index 9837d395e..7a02ede50 100644 --- a/spec/models/budget/result_spec.rb +++ b/spec/models/budget/result_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Budget::Result do - describe "calculate_winners" do let(:budget) { create(:budget) } let(:heading) { create(:budget_heading, budget: budget, price: 1000) } diff --git a/spec/models/budget_spec.rb b/spec/models/budget_spec.rb index 3eeebf1c9..7c3eea4f1 100644 --- a/spec/models/budget_spec.rb +++ b/spec/models/budget_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Budget do - let(:budget) { create(:budget) } it_behaves_like "sluggable", updatable_slug_trait: :drafting @@ -151,7 +150,6 @@ describe Budget do end describe "#current" do - it "returns nil if there is only one budget and it is still in drafting phase" do create(:budget, :drafting) @@ -172,18 +170,15 @@ describe Budget do expect(Budget.current.name).to eq "Current" end - end describe "#open" do - it "returns all budgets that are not in the finished phase" do (Budget::Phase::PHASE_KINDS - ["finished"]).each do |phase| budget = create(:budget, phase: phase) expect(Budget.open).to include(budget) end end - end describe "heading_price" do diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb index e934db833..ea4ff934f 100644 --- a/spec/models/comment_spec.rb +++ b/spec/models/comment_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Comment do - let(:comment) { build(:comment) } it_behaves_like "has_public_author" @@ -44,7 +43,6 @@ describe Comment do end describe "#confidence_score" do - it "takes into account percentage of total votes and total_positive and total negative votes" do comment = create(:comment, :with_confidence_score, cached_votes_up: 100, cached_votes_total: 100) expect(comment.confidence_score).to eq(10000) @@ -81,7 +79,6 @@ describe Comment do expect(previous).to be > comment.confidence_score end end - end describe "cache" do diff --git a/spec/models/community_spec.rb b/spec/models/community_spec.rb index 90ac3279f..7354bc717 100644 --- a/spec/models/community_spec.rb +++ b/spec/models/community_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" RSpec.describe Community, type: :model do - it "is valid when create proposal" do proposal = create(:proposal) @@ -9,7 +8,6 @@ RSpec.describe Community, type: :model do end describe "#participants" do - it "returns participants without duplicates" do proposal = create(:proposal) community = proposal.community diff --git a/spec/models/concerns/sluggable.rb b/spec/models/concerns/sluggable.rb index 1b91d40a5..bdc43b284 100644 --- a/spec/models/concerns/sluggable.rb +++ b/spec/models/concerns/sluggable.rb @@ -1,7 +1,6 @@ require "spec_helper" shared_examples_for "sluggable" do |updatable_slug_trait:| - describe "generate_slug" do let(:factory_name) { described_class.name.parameterize(separator: "_").to_sym } let(:sluggable) { create(factory_name, name: "Marló Brañido Carlo") } diff --git a/spec/models/custom/verification/residence_spec.rb b/spec/models/custom/verification/residence_spec.rb index b2a33215a..493e60b91 100644 --- a/spec/models/custom/verification/residence_spec.rb +++ b/spec/models/custom/verification/residence_spec.rb @@ -1,11 +1,9 @@ require "rails_helper" describe Verification::Residence do - let(:residence) { build(:verification_residence, document_number: "12345678Z") } describe "verification" do - describe "postal code" do it "is valid with postal codes starting with 280" do residence.postal_code = "28012" @@ -27,7 +25,5 @@ describe Verification::Residence do expect(residence.errors[:postal_code]).to eq ["In order to be verified, you must be registered."] end end - end - end diff --git a/spec/models/dashboard/action_spec.rb b/spec/models/dashboard/action_spec.rb index e1973a7a5..f9453def5 100644 --- a/spec/models/dashboard/action_spec.rb +++ b/spec/models/dashboard/action_spec.rb @@ -240,9 +240,7 @@ describe Dashboard::Action do end context "#detect_new_actions_since" do - describe "No detect new actions" do - let!(:action) { create(:dashboard_action, :proposed_action, :active, day_offset: 1) } let!(:resource) { create(:dashboard_action, :resource, :active, day_offset: 1) } @@ -277,11 +275,9 @@ describe Dashboard::Action do expect(Dashboard::Action.detect_new_actions_since(Date.yesterday, proposal)).to eq [] end - end describe "Detect new actions when there are news actions actived" do - context "for published proposals" do let!(:proposal) { create(:proposal) } @@ -311,7 +307,6 @@ describe Dashboard::Action do expect(Dashboard::Action.detect_new_actions_since(Date.yesterday, proposal)).not_to include(resource.id) end - end context "for draft proposals" do @@ -343,7 +338,6 @@ describe Dashboard::Action do expect(Dashboard::Action.detect_new_actions_since(Date.yesterday, proposal)).not_to include(resource.id) end - end end end diff --git a/spec/models/debate_spec.rb b/spec/models/debate_spec.rb index cc6662297..4152db11e 100644 --- a/spec/models/debate_spec.rb +++ b/spec/models/debate_spec.rb @@ -287,7 +287,6 @@ describe Debate do end describe "actions which affect it" do - let(:debate) { create(:debate) } before do @@ -310,7 +309,6 @@ describe Debate do end describe "#confidence_score" do - it "takes into account percentage of total votes and total_positive and total negative votes" do debate = create(:debate, :with_confidence_score, cached_votes_up: 100, cached_votes_score: 100, cached_votes_total: 100) expect(debate.confidence_score).to eq(10000) @@ -347,7 +345,6 @@ describe Debate do expect(previous).to be > debate.confidence_score end end - end describe "cache" do @@ -415,7 +412,6 @@ describe Debate do end describe "conflictive debates" do - it "returns true when it has more than 1 flag for 5 positive votes" do debate.update!(cached_votes_up: 4) debate.update!(flags_count: 1) @@ -457,7 +453,6 @@ describe Debate do debate.update!(cached_votes_up: 0) expect(debate).not_to be_conflictive end - end describe "search" do @@ -506,11 +501,9 @@ describe Debate do results = Debate.search("California") expect(results).to eq([debate]) end - end context "stemming" do - it "searches word stems" do debate = create(:debate, title: "limpiar") @@ -523,11 +516,9 @@ describe Debate do results = Debate.search("limpió") expect(results).to eq([debate]) end - end context "accents" do - it "searches with accents" do debate = create(:debate, title: "difusión") @@ -542,7 +533,6 @@ describe Debate do results = Debate.search("publico") expect(results).to eq([debate3]) end - end context "case" do @@ -571,7 +561,6 @@ describe Debate do end context "order" do - it "orders by weight" do debate_description = create(:debate, description: "stop corruption") debate_title = create(:debate, title: "stop corruption") @@ -600,11 +589,9 @@ describe Debate do expect(results).to eq [exact_title_few_votes, similar_title_many_votes] end - end context "reorder" do - it "is able to reorder by hot_score after searching" do lowest_score = create(:debate, title: "stop corruption", cached_votes_up: 1) highest_score = create(:debate, title: "stop corruption", cached_votes_up: 2) @@ -668,11 +655,9 @@ describe Debate do expect(results).to eq [most_commented, some_comments, least_commented] end - end context "no results" do - it "no words match" do create(:debate, title: "save world") @@ -700,7 +685,6 @@ describe Debate do results = Debate.search("") expect(results).to eq([]) end - end end @@ -739,7 +723,6 @@ describe Debate do end describe "#recommendations" do - let(:user) { create(:user) } it "does not return any debates when user has not interests" do @@ -777,7 +760,5 @@ describe Debate do expect(results).to be_empty end - end - end diff --git a/spec/models/direct_message_spec.rb b/spec/models/direct_message_spec.rb index 5dda929e2..2f68263ff 100644 --- a/spec/models/direct_message_spec.rb +++ b/spec/models/direct_message_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe DirectMessage do - let(:direct_message) { build(:direct_message) } it "is valid" do @@ -71,7 +70,6 @@ describe DirectMessage do end describe "scopes" do - describe "today", :with_non_utc_time_zone do it "returns direct messages created today" do create(:direct_message, created_at: Date.current.beginning_of_day) @@ -88,7 +86,5 @@ describe DirectMessage do expect(DirectMessage.today.count).to eq 0 end end - end - end diff --git a/spec/models/direct_upload_spec.rb b/spec/models/direct_upload_spec.rb index 2c40bc9ee..c4bc491aa 100644 --- a/spec/models/direct_upload_spec.rb +++ b/spec/models/direct_upload_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" describe DirectUpload do - context "configurations" do - it "is valid for different kind of combinations when attachment is valid" do expect(build(:direct_upload, :proposal, :documents)).to be_valid expect(build(:direct_upload, :proposal, :image)).to be_valid @@ -36,7 +34,6 @@ describe DirectUpload do end context "save_attachment" do - it "saves uploaded file" do proposal_document_direct_upload = build(:direct_upload, :proposal, :documents) @@ -45,11 +42,9 @@ describe DirectUpload do expect(File.exist?(proposal_document_direct_upload.relation.attachment.path)).to eq(true) expect(proposal_document_direct_upload.relation.attachment.path).to include("cached_attachments") end - end context "destroy_attachment" do - it "removes uploaded file" do proposal_document_direct_upload = build(:direct_upload, :proposal, :documents) @@ -59,7 +54,5 @@ describe DirectUpload do expect(File.exist?(uploaded_path)).to eq(false) end - end - end diff --git a/spec/models/document_spec.rb b/spec/models/document_spec.rb index e4d601ecd..59a27e036 100644 --- a/spec/models/document_spec.rb +++ b/spec/models/document_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Document do - it_behaves_like "document validations", "budget_investment_document" it_behaves_like "document validations", "proposal_document" diff --git a/spec/models/flag_spec.rb b/spec/models/flag_spec.rb index 693fa5b55..4878133dc 100644 --- a/spec/models/flag_spec.rb +++ b/spec/models/flag_spec.rb @@ -1,12 +1,10 @@ require "rails_helper" describe Flag do - let(:user) { create(:user) } let(:comment) { create(:comment) } describe ".flag" do - it "creates a flag when there is none" do expect { Flag.flag(user, comment) }.to change { Flag.count }.by(1) expect(Flag.last.user).to eq(user) @@ -52,5 +50,4 @@ describe Flag do expect(Flag.flagged?(user, comment)).to be end end - end diff --git a/spec/models/follow_spec.rb b/spec/models/follow_spec.rb index 122062d12..60dbfe288 100644 --- a/spec/models/follow_spec.rb +++ b/spec/models/follow_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Follow do - let(:follow) { build(:follow, :followed_proposal) } it "is valid" do @@ -22,5 +21,4 @@ describe Follow do follow.followable_type = nil expect(follow).not_to be_valid end - end diff --git a/spec/models/image_spec.rb b/spec/models/image_spec.rb index 5f6f9f8e6..5f1725521 100644 --- a/spec/models/image_spec.rb +++ b/spec/models/image_spec.rb @@ -1,8 +1,6 @@ require "rails_helper" describe Image do - it_behaves_like "image validations", "budget_investment_image" it_behaves_like "image validations", "proposal_image" - end diff --git a/spec/models/legislation/people_proposals_spec.rb b/spec/models/legislation/people_proposals_spec.rb index 0dd0a577a..f03ea952d 100644 --- a/spec/models/legislation/people_proposals_spec.rb +++ b/spec/models/legislation/people_proposals_spec.rb @@ -84,7 +84,6 @@ describe Legislation::PeopleProposal do end describe "actions which affect it" do - let(:people_proposal) { create(:legislation_people_proposal) } before do diff --git a/spec/models/legislation/process/phase_spec.rb b/spec/models/legislation/process/phase_spec.rb index 965b5ced3..2fc17862a 100644 --- a/spec/models/legislation/process/phase_spec.rb +++ b/spec/models/legislation/process/phase_spec.rb @@ -142,7 +142,6 @@ RSpec.describe Legislation::Process::Phase, type: :model do end it "checks allegations phase" do - # future process.update!(allegations_start_date: Date.current + 2.days, allegations_end_date: Date.current + 3.days) @@ -164,5 +163,4 @@ RSpec.describe Legislation::Process::Phase, type: :model do expect(process.allegations_phase.open?).to be false end end - end diff --git a/spec/models/legislation/process_spec.rb b/spec/models/legislation/process_spec.rb index 75401b762..6c31e175f 100644 --- a/spec/models/legislation/process_spec.rb +++ b/spec/models/legislation/process_spec.rb @@ -157,7 +157,6 @@ describe Legislation::Process do expect(processes_not_in_draft).not_to include(process_with_draft_enabled) expect(processes_not_in_draft).not_to include(process_with_draft_only_today) end - end describe "#status" do @@ -216,14 +215,11 @@ describe Legislation::Process do end context "with milestone_tags" do - let(:process) { create(:legislation_process, :with_milestone_tags) } it "has milestone_tags" do expect(process.milestone_tag_list.count).to eq(1) end end - end - end diff --git a/spec/models/legislation/proposal_spec.rb b/spec/models/legislation/proposal_spec.rb index 2959a7a5f..ab8f4473d 100644 --- a/spec/models/legislation/proposal_spec.rb +++ b/spec/models/legislation/proposal_spec.rb @@ -84,7 +84,6 @@ describe Legislation::Proposal do end describe "actions which affect it" do - let(:proposal) { create(:legislation_proposal) } before do diff --git a/spec/models/legislation/question_spec.rb b/spec/models/legislation/question_spec.rb index 1b3b62355..2168be88b 100644 --- a/spec/models/legislation/question_spec.rb +++ b/spec/models/legislation/question_spec.rb @@ -70,5 +70,4 @@ describe Legislation::Question do describe "notifications" do it_behaves_like "notifiable" end - end diff --git a/spec/models/local_census_records/import_spec.rb b/spec/models/local_census_records/import_spec.rb index e9e7a7953..0ca18adce 100644 --- a/spec/models/local_census_records/import_spec.rb +++ b/spec/models/local_census_records/import_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe LocalCensusRecords::Import do - let(:base_files_path) { %w[spec fixtures files local_census_records import] } let(:import) { build(:local_census_records_import) } diff --git a/spec/models/lock_spec.rb b/spec/models/lock_spec.rb index 02c05e829..fcb8464bc 100644 --- a/spec/models/lock_spec.rb +++ b/spec/models/lock_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Lock do - let(:lock) { create(:lock) } describe "#locked?" do @@ -55,5 +54,4 @@ describe Lock do expect(lock.too_many_tries?).to be false end end - end diff --git a/spec/models/map_location_spec.rb b/spec/models/map_location_spec.rb index a00a00485..63c188131 100644 --- a/spec/models/map_location_spec.rb +++ b/spec/models/map_location_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe MapLocation do - let(:map_location) { build(:map_location, :proposal_map_location) } it "is valid" do @@ -27,7 +26,6 @@ describe MapLocation do end context "#available?" do - it "returns true when latitude, longitude and zoom defined" do expect(map_location.available?).to be(true) end @@ -50,5 +48,4 @@ describe MapLocation do expect(map_location.available?).to be(false) end end - end diff --git a/spec/models/milestone/status_spec.rb b/spec/models/milestone/status_spec.rb index 23f569cec..396a95bb4 100644 --- a/spec/models/milestone/status_spec.rb +++ b/spec/models/milestone/status_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Milestone::Status do - describe "Validations" do let(:status) { build(:milestone_status) } diff --git a/spec/models/newsletter_spec.rb b/spec/models/newsletter_spec.rb index f95383156..275bd39fd 100644 --- a/spec/models/newsletter_spec.rb +++ b/spec/models/newsletter_spec.rb @@ -48,7 +48,6 @@ describe Newsletter do end describe "#list_of_recipient_emails" do - before do create(:user, newsletter: true, email: "newsletter_user@consul.dev") create(:user, newsletter: false, email: "no_news_user@consul.dev") @@ -138,6 +137,5 @@ describe Newsletter do expect(Activity.first.action).to eq("email") expect(Activity.first.actionable).to eq(newsletter) end - end end diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rb index 80b442ca5..fc60dfd91 100644 --- a/spec/models/notification_spec.rb +++ b/spec/models/notification_spec.rb @@ -1,11 +1,9 @@ require "rails_helper" describe Notification do - let(:notification) { build(:notification) } context "validations" do - it "is valid" do expect(notification).to be_valid end @@ -14,11 +12,9 @@ describe Notification do notification.user = nil expect(notification).not_to be_valid end - end context "scopes" do - describe "#read" do it "returns only read notifications" do read_notification1 = create(:notification, :read) @@ -56,7 +52,6 @@ describe Notification do Notification.for_render end end - end describe "#mark_as_read" do @@ -172,7 +167,5 @@ describe Notification do expect(notification.notifiable_action).to eq "replies_to" end - end - end diff --git a/spec/models/officing/residence_spec.rb b/spec/models/officing/residence_spec.rb index f6d76cf39..1925ac6f7 100644 --- a/spec/models/officing/residence_spec.rb +++ b/spec/models/officing/residence_spec.rb @@ -1,12 +1,10 @@ require "rails_helper" describe Officing::Residence do - let!(:geozone) { create(:geozone, census_code: "01") } let(:residence) { build(:officing_residence, document_number: "12345678Z") } describe "validations" do - it "is valid" do expect(residence).to be_valid end @@ -125,7 +123,6 @@ describe Officing::Residence do year_of_birth: Time.current.year ) end - end describe "allowed age" do @@ -141,7 +138,6 @@ describe Officing::Residence do expect(residence.errors[:year_of_birth]).to be_empty end end - end describe "new" do @@ -157,7 +153,6 @@ describe Officing::Residence do end describe "save" do - it "stores document number, document type, geozone, date of birth and gender" do residence.save! user = residence.user @@ -220,6 +215,5 @@ describe Officing::Residence do year_of_birth: Time.current.year ) end - end end diff --git a/spec/models/organization_spec.rb b/spec/models/organization_spec.rb index 5e3af632c..4ae9cdb36 100644 --- a/spec/models/organization_spec.rb +++ b/spec/models/organization_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Organization do - subject { create(:organization) } describe "verified?" do diff --git a/spec/models/poll/answer_spec.rb b/spec/models/poll/answer_spec.rb index 9815ae6fa..6ffb5e3d1 100644 --- a/spec/models/poll/answer_spec.rb +++ b/spec/models/poll/answer_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" describe Poll::Answer do - describe "validations" do - let(:answer) { build(:poll_answer) } it "is valid" do @@ -40,7 +38,6 @@ describe Poll::Answer do end describe "#record_voter_participation" do - let(:author) { create(:user, :level_two) } let(:poll) { create(:poll) } let(:question) { create(:poll_question, :yes_no, poll: poll) } @@ -74,5 +71,4 @@ describe Poll::Answer do expect(voter.poll_id).to eq(answer.poll.id) end end - end diff --git a/spec/models/poll/ballot_sheet_spec.rb b/spec/models/poll/ballot_sheet_spec.rb index 75f63fe68..f0c69485a 100644 --- a/spec/models/poll/ballot_sheet_spec.rb +++ b/spec/models/poll/ballot_sheet_spec.rb @@ -8,7 +8,6 @@ describe Poll::BallotSheet do end context "Validations" do - it "is valid" do expect(ballot_sheet).to be_valid end @@ -27,15 +26,12 @@ describe Poll::BallotSheet do ballot_sheet.data = nil expect(ballot_sheet).not_to be_valid end - end context "#author" do - it "returns the officer's name" do expect(ballot_sheet.author).to be(ballot_sheet.officer_assignment.officer.user.name) end - end describe "#verify_ballots" do diff --git a/spec/models/poll/ballot_spec.rb b/spec/models/poll/ballot_spec.rb index eaeae3a10..54f292020 100644 --- a/spec/models/poll/ballot_spec.rb +++ b/spec/models/poll/ballot_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Poll::Ballot do - let(:budget) { create(:budget) } let(:group) { create(:budget_group, budget: budget) } let(:heading) { create(:budget_heading, group: group, price: 10000000) } @@ -12,7 +11,6 @@ describe Poll::Ballot do before { create(:budget_ballot, budget: budget, physical: true, poll_ballot: poll_ballot) } describe "#verify" do - it "adds ballot lines until there are sufficiente funds" do investment2 = create(:budget_investment, :selected, price: 2000000, heading: heading) investment3 = create(:budget_investment, :selected, price: 2000000, heading: heading) @@ -47,11 +45,9 @@ describe Poll::Ballot do expect(poll_ballot.ballot.lines.pluck(:investment_id)).to match_array [investment.id, investment2.id, investment3.id] end - end describe "#add_investment" do - describe "Money" do it "is not valid if insufficient funds" do investment.update!(price: heading.price + 1) @@ -129,5 +125,4 @@ describe Poll::Ballot do expect(poll_ballot.find_investment("00#{investment.id}")).to eq(investment) end end - end diff --git a/spec/models/poll/booth_spec.rb b/spec/models/poll/booth_spec.rb index e19d82bd6..765e3b719 100644 --- a/spec/models/poll/booth_spec.rb +++ b/spec/models/poll/booth_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Poll::Booth do - let(:booth) { build(:poll_booth) } it "is valid" do @@ -45,7 +44,6 @@ describe Poll::Booth do end describe ".available" do - it "returns booths associated to current polls" do booth_for_current_poll = create(:poll_booth, polls: [create(:poll, :current)]) booth_for_expired_poll = create(:poll_booth, polls: [create(:poll, :expired)]) diff --git a/spec/models/poll/officer_spec.rb b/spec/models/poll/officer_spec.rb index 3e1911386..32a0a1039 100644 --- a/spec/models/poll/officer_spec.rb +++ b/spec/models/poll/officer_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Poll::Officer do - describe "#name" do let(:officer) { create(:poll_officer) } diff --git a/spec/models/poll/pair_answer_spec.rb b/spec/models/poll/pair_answer_spec.rb index 78b8fba1b..a77b49c07 100644 --- a/spec/models/poll/pair_answer_spec.rb +++ b/spec/models/poll/pair_answer_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" describe Poll::PairAnswer do - describe "validations" do - let(:pair_answer) { build(:poll_pair_answer) } it "is valid" do @@ -50,24 +48,20 @@ describe Poll::PairAnswer do let(:pair_answer_2) { create(:poll_pair_answer) } describe "#by_author" do - it "returns pair_answers associated to an user" do author = pair_answer_1.author expect(Poll::PairAnswer.by_author(author)).to eq [pair_answer_1] end - end describe "#by_question" do - it "returns pair_answers associated to a question" do question = pair_answer_1.question expect(Poll::PairAnswer.by_question(question)).to eq [pair_answer_1] end end - end describe "#generate_pair" do @@ -75,7 +69,6 @@ describe Poll::PairAnswer do let(:question) { create(:poll_question) } context "without question_answers" do - it "assigns nil value to pair_answers" do pair_answer = Poll::PairAnswer.generate_pair(question, user) @@ -122,5 +115,4 @@ describe Poll::PairAnswer do expect(pair_answer.answers).to eq [pair_answer.answer_left, pair_answer.answer_right] end end - end diff --git a/spec/models/poll/partial_result_spec.rb b/spec/models/poll/partial_result_spec.rb index e9124ec53..f53d6f522 100644 --- a/spec/models/poll/partial_result_spec.rb +++ b/spec/models/poll/partial_result_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Poll::PartialResult do - describe "validations" do it "validates that the answers are included in the Poll::Question's list" do question = create(:poll_question) @@ -81,5 +80,4 @@ describe Poll::PartialResult do expect(partial_result.author_id_log).to eq(":#{author1.id}:#{author2.id}") end end - end diff --git a/spec/models/poll/poll_spec.rb b/spec/models/poll/poll_spec.rb index cc0b18868..0a1fc94bd 100644 --- a/spec/models/poll/poll_spec.rb +++ b/spec/models/poll/poll_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Poll do - let(:poll) { build(:poll) } describe "Concerns" do @@ -233,7 +232,6 @@ describe Poll do expect(Poll.votable_by(user)).to eq [poll] end - end describe "#votable_by" do @@ -344,9 +342,7 @@ describe Poll do end context "scopes" do - describe "#not_budget" do - it "returns polls not associated to a budget" do poll1 = create(:poll) poll2 = create(:poll) @@ -355,9 +351,7 @@ describe Poll do expect(Poll.not_budget).to match_array [poll1, poll2] expect(Poll.not_budget).not_to include(poll3) end - end - end describe "#sort_for_list" do diff --git a/spec/models/poll/question_spec.rb b/spec/models/poll/question_spec.rb index 249742392..9cfc93c37 100644 --- a/spec/models/poll/question_spec.rb +++ b/spec/models/poll/question_spec.rb @@ -47,7 +47,6 @@ RSpec.describe Poll::Question, type: :model do end describe "#enum_type" do - it "returns nil if not has votation_type association" do expect(poll_question.votation_type).to be_nil expect(poll_question.enum_type).to be_nil @@ -59,11 +58,9 @@ RSpec.describe Poll::Question, type: :model do expect(question.votation_type).not_to be_nil expect(question.enum_type).to eq("answer_couples_open") end - end describe "#max_votes" do - it "returns nil if not has votation_type association" do expect(poll_question.votation_type).to be_nil expect(poll_question.max_votes).to be_nil @@ -75,6 +72,5 @@ RSpec.describe Poll::Question, type: :model do expect(question.votation_type).not_to be_nil expect(question.max_votes).to eq(5) end - end end diff --git a/spec/models/poll/recount_spec.rb b/spec/models/poll/recount_spec.rb index bdd34a7d0..fae60fb85 100644 --- a/spec/models/poll/recount_spec.rb +++ b/spec/models/poll/recount_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Poll::Recount do - describe "logging changes" do let(:author) { create(:user) } let(:officer_assignment) { create(:poll_officer_assignment) } @@ -100,5 +99,4 @@ describe Poll::Recount do expect(poll_recount.author_id_log).to eq(":#{author.id}:#{first_author.id}:#{second_author.id}") end end - end diff --git a/spec/models/poll/shift_spec.rb b/spec/models/poll/shift_spec.rb index 757151be4..599a1dd8f 100644 --- a/spec/models/poll/shift_spec.rb +++ b/spec/models/poll/shift_spec.rb @@ -51,11 +51,9 @@ describe Poll::Shift do expect(build(:poll_shift, booth: booth, officer: officer, date: Date.tomorrow, task: :recount_scrutiny)).to be_valid end - end describe "officer_assignments" do - it "creates and destroy corresponding officer_assignments" do booth_assignment1 = create(:poll_booth_assignment, booth: booth) booth_assignment2 = create(:poll_booth_assignment, booth: booth) @@ -95,7 +93,6 @@ describe Poll::Shift do expect(officer_assignment.booth_assignment).to eq(booth_assignment) expect(officer_assignment.final).to be_truthy end - end describe "#persist_data" do @@ -114,7 +111,5 @@ describe Poll::Shift do expect(shift.officer_name).to eq "Ana" expect(shift.officer_email).to eq "ana@example.com" end - end - end diff --git a/spec/models/poll/voter_spec.rb b/spec/models/poll/voter_spec.rb index 1b5d5f1bd..8cf664d68 100644 --- a/spec/models/poll/voter_spec.rb +++ b/spec/models/poll/voter_spec.rb @@ -73,7 +73,6 @@ describe Poll::Voter do end context "origin" do - it "is not valid without an origin" do voter.origin = nil expect(voter).not_to be_valid @@ -116,11 +115,9 @@ describe Poll::Voter do expect(voter).to be_valid end end - end describe "scopes" do - describe "#web" do it "returns voters with a web origin" do voter = create(:poll_voter, :from_web) @@ -148,11 +145,9 @@ describe Poll::Voter do expect(Poll::Voter.booth).to be_empty end end - end describe "save" do - it "sets demographic info" do geozone = create(:geozone) user = create(:user, :level_two, diff --git a/spec/models/proposal_notification_spec.rb b/spec/models/proposal_notification_spec.rb index b47dbaeda..4bd337c36 100644 --- a/spec/models/proposal_notification_spec.rb +++ b/spec/models/proposal_notification_spec.rb @@ -43,7 +43,6 @@ describe ProposalNotification do end describe "minimum interval between notifications" do - before do Setting[:proposal_notification_minimum_interval_in_days] = 3 end @@ -71,36 +70,29 @@ describe ProposalNotification do expect(notification1).to be_valid end - end describe "notifications in-app" do - let(:notifiable) { create(model_name(ProposalNotification)) } let(:proposal) { notifiable.proposal } describe "#notification_title" do - it "returns the proposal title" do notification = create(:notification, notifiable: notifiable) expect(notification.notifiable_title).to eq notifiable.proposal.title end - end describe "#notification_action" do - it "returns the correct action" do notification = create(:notification, notifiable: notifiable) expect(notification.notifiable_action).to eq "proposal_notification" end - end describe "notifiable_available?" do - it "returns true when the proposal is available" do notification = create(:notification, notifiable: notifiable) @@ -114,11 +106,9 @@ describe ProposalNotification do expect(notification.notifiable_available?).to be(false) end - end describe "check_availability" do - it "returns true if the resource is present, not hidden, nor retired" do notification = create(:notification, notifiable: notifiable) @@ -147,7 +137,6 @@ describe ProposalNotification do retired_reason: "unfeasible") expect(notification.check_availability(proposal)).to be(false) end - end describe "#moderate_system_email" do diff --git a/spec/models/proposal_spec.rb b/spec/models/proposal_spec.rb index eb33273ef..673155a18 100644 --- a/spec/models/proposal_spec.rb +++ b/spec/models/proposal_spec.rb @@ -249,9 +249,7 @@ describe Proposal do end describe "#cached_votes_up" do - describe "with deprecated long tag list" do - it "increases number of cached_total_votes" do proposal = create(:proposal) @@ -260,7 +258,6 @@ describe Proposal do expect(proposal.update_cached_votes).to eq(true) end - end end @@ -321,7 +318,6 @@ describe Proposal do end describe "actions which affect it" do - let(:proposal) { create(:proposal) } before do @@ -358,7 +354,6 @@ describe Proposal do end describe "#confidence_score" do - it "takes into account votes" do proposal = create(:proposal, :with_confidence_score, cached_votes_up: 100) expect(proposal.confidence_score).to eq(10000) @@ -385,7 +380,6 @@ describe Proposal do expect(previous).to be < proposal.confidence_score end end - end describe "cache" do @@ -439,7 +433,6 @@ describe Proposal do end describe "voters" do - it "returns users that have voted for the proposal" do proposal = create(:proposal) voter1 = create(:user, :level_two, votables: [proposal]) @@ -469,7 +462,6 @@ describe Proposal do expect(proposal.voters).to eq [voter1] end - end describe "search" do @@ -532,11 +524,9 @@ describe Proposal do results = Proposal.search("California") expect(results).to eq([proposal]) end - end context "stemming" do - it "searches word stems" do proposal = create(:proposal, summary: "Economía") @@ -549,7 +539,6 @@ describe Proposal do results = Proposal.search("eco") expect(results).to eq([proposal]) end - end context "accents" do @@ -595,7 +584,6 @@ describe Proposal do end context "order" do - it "orders by weight" do proposal_title = create(:proposal, title: "stop corruption") proposal_description = create(:proposal, description: "stop corruption") @@ -626,11 +614,9 @@ describe Proposal do expect(results).to eq [exact_title_few_votes, similar_title_many_votes] end - end context "reorder" do - it "is able to reorder by hot_score after searching" do lowest_score = create(:proposal, title: "stop corruption", cached_votes_up: 1) highest_score = create(:proposal, title: "stop corruption", cached_votes_up: 2) @@ -694,11 +680,9 @@ describe Proposal do expect(results).to eq [most_commented, some_comments, least_commented] end - end context "no results" do - it "no words match" do create(:proposal, title: "save world") @@ -726,7 +710,6 @@ describe Proposal do results = Proposal.search("") expect(results).to eq([]) end - end end @@ -745,9 +728,7 @@ describe Proposal do end describe "for_summary" do - context "categories" do - it "returns proposals tagged with a category" do create(:tag, :category, name: "culture") proposal = create(:proposal, tag_list: "culture") @@ -764,7 +745,6 @@ describe Proposal do end context "districts" do - it "returns proposals with a geozone" do california = create(:geozone, name: "california") proposal = create(:proposal, geozone: california) @@ -910,7 +890,6 @@ describe Proposal do end describe "#user_to_notify" do - it "returns voters and followers" do proposal = create(:proposal) voter = create(:user, :level_two, votables: [proposal]) @@ -935,11 +914,9 @@ describe Proposal do expect(proposal.users_to_notify).to eq([voter_and_follower]) end - end describe "#recommendations" do - let(:user) { create(:user) } it "does not return any proposals when user has not interests" do @@ -1003,11 +980,9 @@ describe Proposal do expect(results).to be_empty end - end describe "#send_new_actions_notification_on_create" do - before do Setting["dashboard.emails"] = true ActionMailer::Base.deliveries.clear @@ -1030,11 +1005,9 @@ describe Proposal do expect(ActionMailer::Base.deliveries.count).to eq(0) end - end describe "#send_new_actions_notification_on_published" do - before do Setting["dashboard.emails"] = true ActionMailer::Base.deliveries.clear @@ -1059,13 +1032,10 @@ describe Proposal do expect(ActionMailer::Base.deliveries.count).to eq(0) end - end describe "milestone_tags" do - context "without milestone_tags" do - let(:proposal) { create(:proposal) } it "do not have milestone_tags" do @@ -1081,7 +1051,6 @@ describe Proposal do end context "with milestone_tags" do - let(:proposal) { create(:proposal, :with_milestone_tags) } it "has milestone_tags" do @@ -1089,5 +1058,4 @@ describe Proposal do end end end - end diff --git a/spec/models/related_content_spec.rb b/spec/models/related_content_spec.rb index 5ed206ef0..79155f69f 100644 --- a/spec/models/related_content_spec.rb +++ b/spec/models/related_content_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe RelatedContent do - let(:parent_relationable) { create([:proposal, :debate].sample) } let(:child_relationable) { create([:proposal, :debate].sample) } @@ -59,5 +58,4 @@ describe RelatedContent do expect(parent_relationable.relationed_contents).to eq [child_relationable] end end - end diff --git a/spec/models/remote_translation_spec.rb b/spec/models/remote_translation_spec.rb index 471418fbe..0c6723a0e 100644 --- a/spec/models/remote_translation_spec.rb +++ b/spec/models/remote_translation_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe RemoteTranslation do - let(:remote_translation) { build(:remote_translation, locale: :es) } it "is valid" do @@ -32,7 +31,5 @@ describe RemoteTranslation do it "after create enqueue Delayed Job" do expect { remote_translation.save }.to change { Delayed::Job.count }.by(1) end - end - end diff --git a/spec/models/setting_spec.rb b/spec/models/setting_spec.rb index b2006a24a..99522f866 100644 --- a/spec/models/setting_spec.rb +++ b/spec/models/setting_spec.rb @@ -238,7 +238,6 @@ describe Setting do end describe ".force_presence_date_of_birth?" do - it "return false when feature remote_census is not active" do Setting["feature.remote_census"] = false @@ -261,7 +260,6 @@ describe Setting do end describe ".force_presence_postal_code?" do - it "return false when feature remote_census is not active" do Setting["feature.remote_census"] = false diff --git a/spec/models/signature_sheet_spec.rb b/spec/models/signature_sheet_spec.rb index 1318b8ec3..faaf5b9a6 100644 --- a/spec/models/signature_sheet_spec.rb +++ b/spec/models/signature_sheet_spec.rb @@ -1,11 +1,9 @@ require "rails_helper" describe SignatureSheet do - let(:signature_sheet) { build(:signature_sheet) } describe "validations" do - it "is valid" do expect(signature_sheet).to be_valid end @@ -77,7 +75,6 @@ describe SignatureSheet do end context "with remote census active" do - before do Setting["feature.remote_census"] = true end @@ -151,9 +148,7 @@ describe SignatureSheet do Setting["remote_census.request.date_of_birth"] = nil Setting["remote_census.request.postal_code"] = nil end - end - end describe "#parsed_required_fields_to_verify" do @@ -177,5 +172,4 @@ describe SignatureSheet do expect(signature_sheet.parsed_required_fields_to_verify_groups).to eq([["123A", "01/01/1980", "28001"], ["456B", "01/02/1980", "28002"], ["789C", "01/03/1980", "28003"]]) end end - end diff --git a/spec/models/signature_spec.rb b/spec/models/signature_spec.rb index ce7dcfb70..c55136d47 100644 --- a/spec/models/signature_spec.rb +++ b/spec/models/signature_spec.rb @@ -1,11 +1,9 @@ require "rails_helper" describe Signature do - let(:signature) { build(:signature) } describe "validations" do - it "is valid" do expect(signature).to be_valid end @@ -25,7 +23,6 @@ describe Signature do signature.signature_sheet = nil expect(signature).not_to be_valid end - end describe "custom validations" do @@ -62,7 +59,6 @@ describe Signature do expect(signature).not_to be_valid end - end describe "#clean_document_number" do @@ -84,9 +80,7 @@ describe Signature do end describe "#verify" do - describe "existing user" do - it "assigns vote to user on proposal" do user = create(:user, :level_two, document_number: "123A") signature = create(:signature, document_number: user.document_number) @@ -174,11 +168,9 @@ describe Signature do expect(Vote.last.signature).to eq(signature) end - end describe "inexistent user" do - it "creates a user with that document number" do create(:geozone, census_code: "01") signature = create(:signature, document_number: "12345678Z") @@ -215,7 +207,6 @@ describe Signature do end describe "document in census" do - it "calls assign_vote_to_user" do signature = create(:signature, document_number: "12345678Z") @@ -231,11 +222,9 @@ describe Signature do expect(signature).to be_verified end - end describe "document in census throught CustomCensusApi" do - before do Setting["feature.remote_census"] = true Setting["remote_census.request.date_of_birth"] = "some.value" @@ -256,11 +245,9 @@ describe Signature do signature.verify end - end describe "document not in census" do - it "does not call assign_vote_to_user" do signature = create(:signature, document_number: "123A") @@ -275,7 +262,5 @@ describe Signature do expect(signature).not_to be_verified end end - end - end diff --git a/spec/models/tag_cloud_spec.rb b/spec/models/tag_cloud_spec.rb index e5a3073d3..8102ae5d4 100644 --- a/spec/models/tag_cloud_spec.rb +++ b/spec/models/tag_cloud_spec.rb @@ -1,9 +1,7 @@ require "rails_helper" describe TagCloud do - describe "#tags" do - it "returns proposal tags" do create(:proposal, tag_list: "participation") create(:debate, tag_list: "world hunger") @@ -118,5 +116,4 @@ describe TagCloud do expect(tag_names(tag_cloud).count).to eq(10) end end - end diff --git a/spec/models/tag_spec.rb b/spec/models/tag_spec.rb index f0b6d40fa..2a9f098f7 100644 --- a/spec/models/tag_spec.rb +++ b/spec/models/tag_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Tag do - it "decreases tag_count when a debate is hidden" do debate = create(:debate) tag = create(:tag, taggables: [debate]) diff --git a/spec/models/topic_spec.rb b/spec/models/topic_spec.rb index f361eeb69..05d25587a 100644 --- a/spec/models/topic_spec.rb +++ b/spec/models/topic_spec.rb @@ -27,7 +27,6 @@ describe Topic do end context "order" do - it "orders by newest" do proposal = create(:proposal) community = proposal.community @@ -68,7 +67,6 @@ describe Topic do expect(results).to eq [topic1, topic2, topic3] end - end describe "notifications" do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index d97679bdd..36addcc16 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe User do - describe "#headings_voted_within_group" do it "returns the headings voted by a user" do budget = create(:budget) @@ -341,9 +340,7 @@ describe User do end describe "official_position_badge" do - describe "Users of level 1" do - it "displays the badge if set in preferences" do user = create(:user, official_level: 1, official_position_badge: true) @@ -355,11 +352,9 @@ describe User do expect(user.display_official_position_badge?).to eq false end - end describe "Users higher than level 1" do - it "displays the badge regardless of preferences" do user1 = create(:user, official_level: 2, official_position_badge: false) user2 = create(:user, official_level: 3, official_position_badge: false) @@ -371,15 +366,11 @@ describe User do expect(user3.display_official_position_badge?).to eq true expect(user4.display_official_position_badge?).to eq true end - end - end describe "scopes" do - describe "active" do - it "returns users that have not been erased" do user1 = create(:user, erased_at: nil) user2 = create(:user, erased_at: nil) @@ -398,11 +389,9 @@ describe User do expect(User.active).to match_array [user1, user2] expect(User.active).not_to include(user3) end - end describe "erased" do - it "returns users that have been erased" do user1 = create(:user, erased_at: Time.current) user2 = create(:user, erased_at: Time.current) @@ -411,7 +400,6 @@ describe User do expect(User.erased).to match_array [user1, user2] expect(User.erased).not_to include(user3) end - end end @@ -473,7 +461,6 @@ describe User do user.valid? expect(user.document_number).to eq("12345678B") end - end describe "#erase" do @@ -528,7 +515,6 @@ describe User do expect(Identity.exists?(identity.id)).not_to be end - end describe "#take_votes_from" do @@ -658,7 +644,6 @@ describe User do expect(user_2.reload.former_users_data_log).to include("id: #{user_1.id}") expect(user_1.reload.document_number).to be_blank end - end describe "email_required?" do @@ -710,7 +695,6 @@ describe User do expect(user.interests).to eq ["Sport"] end - end describe ".find_by_manager_login" do @@ -725,5 +709,4 @@ describe User do expect(User.find_by_manager_login("admin_user_#{user.id}")).to eq user end end - end diff --git a/spec/models/valuator_group_spec.rb b/spec/models/valuator_group_spec.rb index 2aadfb31b..7e8c172d6 100644 --- a/spec/models/valuator_group_spec.rb +++ b/spec/models/valuator_group_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe ValuatorGroup do - describe "Validations" do it "is valid" do expect(build(:valuator_group)).to be_valid diff --git a/spec/models/valuator_spec.rb b/spec/models/valuator_spec.rb index f652757b1..e683e0b5c 100644 --- a/spec/models/valuator_spec.rb +++ b/spec/models/valuator_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Valuator do - describe "#description_or_email" do it "returns description if present" do valuator = create(:valuator, description: "Urbanism manager") @@ -17,7 +16,6 @@ describe Valuator do end describe "#assigned_investment_ids" do - it "returns investments assigned to a valuator" do valuator = create(:valuator) investment1 = create(:budget_investment, valuators: [valuator]) @@ -52,5 +50,4 @@ describe Valuator do it { expect(valuator.can_edit_dossier).to be_truthy } end end - end diff --git a/spec/models/verification/letter_spec.rb b/spec/models/verification/letter_spec.rb index 4c7577bb9..110dcc401 100644 --- a/spec/models/verification/letter_spec.rb +++ b/spec/models/verification/letter_spec.rb @@ -1,11 +1,9 @@ require "rails_helper" describe Verification::Letter do - let(:user) { create(:user) } describe "validations" do - let(:letter) { build(:verification_letter) } it "is valid" do @@ -16,21 +14,17 @@ describe Verification::Letter do letter.user = nil expect(letter).not_to be_valid end - end describe "save" do - it "updates letter_requested" do letter = build(:verification_letter) letter.save! expect(letter.user.letter_requested_at).to be end - end describe "#verify" do - let(:letter) { build(:verification_letter, verify: true) } it "incorrect code" do @@ -57,5 +51,4 @@ describe Verification::Letter do expect(letter.errors).to be_empty end end - end diff --git a/spec/models/verification/management/document_spec.rb b/spec/models/verification/management/document_spec.rb index d5710362e..5e8752108 100644 --- a/spec/models/verification/management/document_spec.rb +++ b/spec/models/verification/management/document_spec.rb @@ -1,11 +1,9 @@ require "rails_helper" describe Verification::Management::Document do - let(:verification_document) { build(:verification_document, document_number: "12345678Z") } describe "validations" do - it "is valid" do expect(verification_document).to be_valid end @@ -31,7 +29,6 @@ describe Verification::Management::Document do end describe "custom validations with RemoteCensus enabled" do - before do Setting["feature.remote_census"] = true Setting["remote_census.request.date_of_birth"] = "some.value" @@ -86,7 +83,6 @@ describe Verification::Management::Document do expect(verification_document.errors[:date_of_birth]).to include("can't be blank") end end - end describe "Allowed Age" do @@ -130,5 +126,4 @@ describe Verification::Management::Document do end end end - end diff --git a/spec/models/verification/management/email_spec.rb b/spec/models/verification/management/email_spec.rb index 989e222ee..8f081b061 100644 --- a/spec/models/verification/management/email_spec.rb +++ b/spec/models/verification/management/email_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Verification::Management::Email do - describe "#user" do subject { Verification::Management::Email.new(document_type: "1", document_number: "1234", email: "inexisting@gmail.com") } diff --git a/spec/models/verification/residence_spec.rb b/spec/models/verification/residence_spec.rb index 06365c2d0..f34becd1f 100644 --- a/spec/models/verification/residence_spec.rb +++ b/spec/models/verification/residence_spec.rb @@ -1,12 +1,10 @@ require "rails_helper" describe Verification::Residence do - let!(:geozone) { create(:geozone, census_code: "01") } let(:residence) { build(:verification_residence, document_number: "12345678Z") } describe "validations" do - it "is valid" do expect(residence).to be_valid end @@ -48,7 +46,6 @@ describe Verification::Residence do residence.terms_of_service = nil expect(residence).not_to be_valid end - end describe "new" do @@ -64,7 +61,6 @@ describe Verification::Residence do end describe "save" do - it "stores document number, document type, geozone, date of birth and gender" do user = create(:user) residence.user = user @@ -79,7 +75,6 @@ describe Verification::Residence do expect(user.gender).to eq("male") expect(user.geozone).to eq(geozone) end - end describe "tries" do @@ -111,5 +106,4 @@ describe Verification::Residence do ) end end - end diff --git a/spec/models/verification/sms_spec.rb b/spec/models/verification/sms_spec.rb index 37ef5d461..ea2b74c2f 100644 --- a/spec/models/verification/sms_spec.rb +++ b/spec/models/verification/sms_spec.rb @@ -18,5 +18,4 @@ describe Verification::Sms do expect(build(:verification_sms, phone: "hello there")).not_to be_valid expect(build(:verification_sms, phone: "555; DROP TABLE USERS")).not_to be_valid end - end diff --git a/spec/models/vote_spec.rb b/spec/models/vote_spec.rb index 6e55c9600..c22d47fd4 100644 --- a/spec/models/vote_spec.rb +++ b/spec/models/vote_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Vote do - describe "#for_debates" do it "does not returns votes for other votables" do debate = create(:debate) diff --git a/spec/models/widget/card_spec.rb b/spec/models/widget/card_spec.rb index b9e81f450..8f925fefd 100644 --- a/spec/models/widget/card_spec.rb +++ b/spec/models/widget/card_spec.rb @@ -6,11 +6,9 @@ describe Widget::Card do it_behaves_like "globalizable", :widget_card context "validations" do - it "is valid" do expect(card).to be_valid end - end describe "#header" do @@ -28,7 +26,6 @@ describe Widget::Card do end describe "#body" do - it "returns cards for the homepage body" do header = create(:widget_card, header: true) card1 = create(:widget_card, header: false) diff --git a/spec/models/widget/feed_spec.rb b/spec/models/widget/feed_spec.rb index 5500c7fde..476fecbb7 100644 --- a/spec/models/widget/feed_spec.rb +++ b/spec/models/widget/feed_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" describe Widget::Feed do - let(:feed) { build(:widget_feed) } context "validations" do @@ -11,9 +10,7 @@ describe Widget::Feed do end context "kinds" do - describe "#proposals" do - it "returns the most active proposals" do best_proposal = create(:proposal, title: "Best proposal") best_proposal.update_column(:hot_score, 10) @@ -31,11 +28,9 @@ describe Widget::Feed do expect(feed.proposals).to eq([best_proposal, medium_proposal, worst_proposal]) end - end describe "#debates" do - it "returns the most active debates" do best_debate = create(:debate, title: "Best debate") best_debate.update_column(:hot_score, 10) @@ -53,7 +48,6 @@ describe Widget::Feed do expect(feed.debates).to eq([best_debate, medium_debate, worst_debate]) end - end describe "#processes" do @@ -77,7 +71,5 @@ describe Widget::Feed do expect(feed.processes).to be_empty end end - end - end diff --git a/spec/shared/features/documentable.rb b/spec/shared/features/documentable.rb index fe2e0435e..5eb40d605 100644 --- a/spec/shared/features/documentable.rb +++ b/spec/shared/features/documentable.rb @@ -16,7 +16,6 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path, end context "Show documents" do - scenario "Download action should be able to anyone" do visit send(documentable_path, arguments) @@ -36,7 +35,6 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path, end describe "Destroy action" do - scenario "Should not be able when no user logged in" do visit send(documentable_path, arguments) @@ -63,7 +61,6 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path, expect(page).not_to have_link("Delete document") end - end describe "When allow attached documents setting is enabled" do @@ -101,11 +98,9 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path, expect(page).not_to have_css("#documents") end end - end context "Destroy" do - scenario "Should show success notice after successful document upload" do login_as documentable.author @@ -143,9 +138,7 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path, expect(page).to have_selector "h1", text: documentable.title end end - end - end def attach_document(path, success = true) diff --git a/spec/shared/features/followable.rb b/spec/shared/features/followable.rb index 40b833236..6fd24d236 100644 --- a/spec/shared/features/followable.rb +++ b/spec/shared/features/followable.rb @@ -12,7 +12,6 @@ shared_examples "followable" do |followable_class_name, followable_path, followa end context "Show" do - scenario "Should not display follow button when there is no logged user" do visit send(followable_path, arguments) @@ -100,7 +99,5 @@ shared_examples "followable" do |followable_class_name, followable_path, followa expect(page).to have_content strip_tags(destroy_notice_message) end - end - end diff --git a/spec/shared/features/imageable.rb b/spec/shared/features/imageable.rb index 2af52d419..fa78b2b07 100644 --- a/spec/shared/features/imageable.rb +++ b/spec/shared/features/imageable.rb @@ -19,7 +19,6 @@ shared_examples "imageable" do |imageable_factory_name, imageable_path, imageabl end context "Show" do - scenario "Show descriptive image when exists", :js do image = create(:image, imageable: imageable) @@ -35,7 +34,6 @@ shared_examples "imageable" do |imageable_factory_name, imageable_path, imageabl expect(page).to have_content image.title end - end end diff --git a/spec/shared/features/imageable_destroy.rb b/spec/shared/features/imageable_destroy.rb index f1ccd7c07..539f0fe8b 100644 --- a/spec/shared/features/imageable_destroy.rb +++ b/spec/shared/features/imageable_destroy.rb @@ -19,7 +19,6 @@ shared_examples "imageable destroy" do |imageable_factory_name, imageable_path, end context "Destroy" do - before do create(:image, imageable: imageable, user: imageable.author) end @@ -66,7 +65,5 @@ shared_examples "imageable destroy" do |imageable_factory_name, imageable_path, expect(page).to have_selector "h1", text: imageable.title end end - end - end diff --git a/spec/shared/features/mappable.rb b/spec/shared/features/mappable.rb index ce6d84fa0..59488bd7c 100644 --- a/spec/shared/features/mappable.rb +++ b/spec/shared/features/mappable.rb @@ -1,5 +1,4 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name, mappable_new_path, mappable_edit_path, mappable_show_path, mappable_path_arguments, management: false| - include ActionView::Helpers let!(:user) { create(:user, :level_two) } @@ -13,7 +12,6 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name, end describe "At #{mappable_new_path}" do - before { set_arguments(arguments, mappable, mappable_path_arguments) } scenario "Should not show marker by default on create #{mappable_factory_name}", :js do @@ -108,11 +106,9 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name, expect(page).to have_css(".map") expect(page).to have_content("Remove map marker") end - end describe "At #{mappable_edit_path}" do - before { skip } if mappable_edit_path.blank? scenario "Should edit map on #{mappable_factory_name} and contain default values", :js do @@ -192,11 +188,9 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name, expect(page).not_to have_content "Map location can't be blank" end - end describe "At #{mappable_show_path}" do - before do set_arguments(arguments, mappable, mappable_path_arguments) do_login_for(user) if management @@ -228,9 +222,7 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name, expect(page).not_to have_css(".map_location") end - end - end def do_login_for(user) diff --git a/spec/shared/features/nested_documentable.rb b/spec/shared/features/nested_documentable.rb index 5f4cc1608..8f37db8e8 100644 --- a/spec/shared/features/nested_documentable.rb +++ b/spec/shared/features/nested_documentable.rb @@ -22,7 +22,6 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na end describe "at #{path}" do - scenario "Should show new document link when max documents allowed limit is not reached" do login_as user_to_login visit send(path, arguments) @@ -304,9 +303,7 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na expect(page).not_to have_content("Add new document") end end - end - end def documentable_redirected_to_resource_show_or_navigate_to diff --git a/spec/shared/features/nested_imageable.rb b/spec/shared/features/nested_imageable.rb index 9debd4a4d..c0f532f0c 100644 --- a/spec/shared/features/nested_imageable.rb +++ b/spec/shared/features/nested_imageable.rb @@ -17,7 +17,6 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p end describe "at #{path}" do - scenario "Should show new image link when imageable has not an associated image defined" do login_as user visit send(path, arguments) @@ -250,9 +249,7 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p end end - end - end def imageable_redirected_to_resource_show_or_navigate_to diff --git a/spec/shared/features/notifiable_in_app.rb b/spec/shared/features/notifiable_in_app.rb index 9d748bf11..c141b98c4 100644 --- a/spec/shared/features/notifiable_in_app.rb +++ b/spec/shared/features/notifiable_in_app.rb @@ -1,5 +1,4 @@ shared_examples "notifiable in-app" do |factory_name| - let(:author) { create(:user, :verified) } let!(:notifiable) { create(factory_name, author: author) } @@ -134,7 +133,5 @@ shared_examples "notifiable in-app" do |factory_name| find(".icon-no-notification").click expect(page).to have_css ".notification", count: 0 end - end - end diff --git a/spec/shared/features/relationable.rb b/spec/shared/features/relationable.rb index 70d5f999a..094dc1873 100644 --- a/spec/shared/features/relationable.rb +++ b/spec/shared/features/relationable.rb @@ -1,5 +1,4 @@ shared_examples "relationable" do |relationable_model_name| - let(:relationable) { create(relationable_model_name.name.parameterize(separator: "_").to_sym) } let(:related1) { create([:proposal, :debate, :budget_investment].sample) } let(:related2) { create([:proposal, :debate, :budget_investment].sample) } @@ -99,7 +98,6 @@ shared_examples "relationable" do |relationable_model_name| expect(related_content.related_content_scores.find_by(user_id: user.id, related_content_id: related_content.id).value).to eq(1) expect(related_content.opposite_related_content.related_content_scores.find_by(user_id: user.id, related_content_id: related_content.opposite_related_content.id).value).to eq(1) - end scenario "related content can be scored negatively", :js do diff --git a/spec/shared/features/remotely_translatable.rb b/spec/shared/features/remotely_translatable.rb index 98e9a5650..1913cd683 100644 --- a/spec/shared/features/remotely_translatable.rb +++ b/spec/shared/features/remotely_translatable.rb @@ -1,5 +1,4 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_arguments| - let(:arguments) do path_arguments.map do |argument_name, path_to_value| [argument_name, resource.send(path_to_value)] @@ -16,7 +15,6 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume end context "Button to request remote translation" do - scenario "should not be present when current locale translation exists", :js do visit path @@ -64,7 +62,6 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume end describe "should ignore missing translations on resource comments" do - before do if show_path?(path_name) || !commentable?(resource) skip("only index_path") @@ -81,11 +78,9 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume expect(page).not_to have_button("Translate page") end - end describe "should evaluate missing translations on resource comments" do - before do if index_path?(path_name) skip("only show_path") @@ -113,11 +108,9 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume expect(page).not_to have_button("Translate page") end - end describe "should evaluate missing translations on featured_debates" do - before { skip("only debates index path") if path_name != "debates_path" } scenario "display when exists featured_debates without tanslations", :js do @@ -130,11 +123,9 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume expect(page).to have_button("Translate page") end - end describe "should evaluate missing translations on featured_proposals" do - before { skip("only proposals index path") if path_name != "proposals_path" } scenario "display when exists featured_proposals without tanslations", :js do @@ -147,13 +138,10 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume expect(page).to have_button("Translate page") end - end - end context "After click remote translations button" do - describe "with delayed jobs", :delay_jobs do scenario "the remote translation button should not be present", :js do visit path @@ -194,11 +182,9 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume expect(page).not_to have_content("Translations have been correctly requested.") expect(page).to have_content("In a short period of time refreshing the page you will be able to see all the content in your language.") end - end describe "without delayed jobs" do - scenario "the remote translation button should not be present", :js do microsoft_translate_client_response = generate_response(resource) expect_any_instance_of(RemoteTranslations::Microsoft::Client).to receive(:call).and_return(microsoft_translate_client_response) @@ -221,11 +207,8 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume expect(RemoteTranslation.count).to eq(0) expect(resource.translations.count).to eq(2) end - end - end - end def add_translations(resource) diff --git a/spec/shared/models/acts_as_imageable.rb b/spec/shared/models/acts_as_imageable.rb index 135879475..c296d570d 100644 --- a/spec/shared/models/acts_as_imageable.rb +++ b/spec/shared/models/acts_as_imageable.rb @@ -1,5 +1,4 @@ shared_examples "acts as imageable" do |imageable_factory| - let!(:image) { build(:image, imageable_factory.to_sym) } let!(:imageable) { image.imageable } @@ -8,7 +7,6 @@ shared_examples "acts as imageable" do |imageable_factory| end describe "file extension" do - it "is not valid with '.png' extension" do image.attachment = File.new("spec/fixtures/files/clippy.png") @@ -28,11 +26,9 @@ shared_examples "acts as imageable" do |imageable_factory| expect(image).to be_valid end - end describe "image dimmessions" do - it "is valid when image dimmessions are 475X475 at least" do expect(image).to be_valid end @@ -45,7 +41,6 @@ shared_examples "acts as imageable" do |imageable_factory| end describe "title" do - it "is not valid when correct image attached but no image title provided" do image.title = "" @@ -63,7 +58,6 @@ shared_examples "acts as imageable" do |imageable_factory| expect(image).not_to be_valid end - end it "image destroy should remove image from file storage" do @@ -73,5 +67,4 @@ shared_examples "acts as imageable" do |imageable_factory| expect { image.attachment.destroy }.to change { image.attachment.url }.from(image_url).to(new_url) end - end diff --git a/spec/shared/models/acts_as_paranoid.rb b/spec/shared/models/acts_as_paranoid.rb index 499090b68..899032d02 100644 --- a/spec/shared/models/acts_as_paranoid.rb +++ b/spec/shared/models/acts_as_paranoid.rb @@ -13,7 +13,6 @@ shared_examples "acts as paranoid" do |factory_name| end describe "#{described_class} translations" do - it "is hidden after parent resource destroy" do resource.destroy! resource.reload diff --git a/spec/shared/models/document_validations.rb b/spec/shared/models/document_validations.rb index 5e289cc88..9ef685d6f 100644 --- a/spec/shared/models/document_validations.rb +++ b/spec/shared/models/document_validations.rb @@ -59,5 +59,4 @@ shared_examples "document validations" do |documentable_factory| expect(document).not_to be_valid end - end diff --git a/spec/shared/models/image_validations.rb b/spec/shared/models/image_validations.rb index c9123ba05..e3a59b684 100644 --- a/spec/shared/models/image_validations.rb +++ b/spec/shared/models/image_validations.rb @@ -67,5 +67,4 @@ shared_examples "image validations" do |imageable_factory| expect(image).not_to be_valid end - end diff --git a/spec/shared/models/map_validations.rb b/spec/shared/models/map_validations.rb index 1eb828f7c..5d3e2ee4f 100644 --- a/spec/shared/models/map_validations.rb +++ b/spec/shared/models/map_validations.rb @@ -1,9 +1,7 @@ shared_examples "map validations" do - let(:mappable) { build(model_name(described_class)) } describe "validations" do - before do Setting["feature.map"] = true end @@ -43,11 +41,9 @@ shared_examples "map validations" do expect(mappable).not_to be_valid end - end describe "cache" do - it "expires cache when the map is updated" do map_location = create(:map_location) mappable.map_location = map_location @@ -56,7 +52,5 @@ shared_examples "map validations" do expect { map_location.update(latitude: 12.34) } .to change { mappable.reload.updated_at } end - end - end diff --git a/spec/shared/models/notifiable.rb b/spec/shared/models/notifiable.rb index 169cf53f1..e41e7db80 100644 --- a/spec/shared/models/notifiable.rb +++ b/spec/shared/models/notifiable.rb @@ -1,9 +1,7 @@ shared_examples "notifiable" do - let(:notifiable) { create(model_name(described_class)) } describe "#notification_title" do - it "returns the notifiable title when it's a root comment" do notification = create(:notification, notifiable: notifiable) @@ -16,11 +14,9 @@ shared_examples "notifiable" do expect(notification.notifiable_title).to eq notifiable.title end - end describe "notifiable_available?" do - it "returns true when it's a root comment and the notifiable is available" do notification = create(:notification, notifiable: notifiable) @@ -52,11 +48,9 @@ shared_examples "notifiable" do expect(notification.notifiable_available?).to be(false) end - end describe "check_availability" do - it "returns true if the resource is present, not hidden, nor retired" do notification = create(:notification, notifiable: notifiable) expect(notification.check_availability(notifiable)).to be(true) @@ -83,7 +77,5 @@ shared_examples "notifiable" do expect(notification.check_availability(notifiable)).to be(false) end end - end - end diff --git a/spec/support/common_actions/budgets.rb b/spec/support/common_actions/budgets.rb index a99aed8e2..9477c6e3d 100644 --- a/spec/support/common_actions/budgets.rb +++ b/spec/support/common_actions/budgets.rb @@ -10,5 +10,4 @@ module Budgets expect(page).to have_content "Remove" end end - end diff --git a/spec/support/verifiable.rb b/spec/support/verifiable.rb index c57d30759..f8ffb97ea 100644 --- a/spec/support/verifiable.rb +++ b/spec/support/verifiable.rb @@ -174,7 +174,6 @@ shared_examples_for "verifiable" do end describe "methods modified by Setting user.skip_verification" do - let(:user) { create(:user) } before do @@ -243,5 +242,4 @@ shared_examples_for "verifiable" do end end end - end diff --git a/spec/views/welcome/index.html.erb_spec.rb b/spec/views/welcome/index.html.erb_spec.rb index 64cedc3e3..c0c2d4086 100644 --- a/spec/views/welcome/index.html.erb_spec.rb +++ b/spec/views/welcome/index.html.erb_spec.rb @@ -1,7 +1,6 @@ require "rails_helper" RSpec.describe "welcome#index" do - it "Display images on orbit carrousel when we have defined image_default" do debate = create(:debate) @@ -18,7 +17,6 @@ RSpec.describe "welcome#index" do within 'li[data-slide="0"] .card' do expect(page).to have_selector("img") end - end it "Not display images on orbit carrousel when we have not defined image_default" do @@ -37,7 +35,5 @@ RSpec.describe "welcome#index" do within 'li[data-slide="0"] .card' do expect(page).not_to have_selector("img") end - end - end