From da121ebc5388237f76c3ea97f1d28daab419ca44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 20 Jun 2019 01:27:50 +0200 Subject: [PATCH] Remove redundant setting resets in `after` blocks Settings are stored in the database, and so any changes to the settings done during the tests are automatically rolled back between one test and the next one. There were also a few places where we weren't using an `after` block but changing the setting at the end of the test. --- .../concerns/remotely_translatable_spec.rb | 4 ---- spec/controllers/debates_controller_spec.rb | 4 ---- .../controllers/installation_controller_spec.rb | 10 ---------- spec/features/account_spec.rb | 6 ------ spec/features/admin/budget_groups_spec.rb | 4 ---- spec/features/admin/budget_headings_spec.rb | 4 ---- spec/features/admin/budget_investments_spec.rb | 4 ---- spec/features/admin/debates_spec.rb | 2 -- .../admin/legislation/processes_spec.rb | 1 - spec/features/admin/settings_spec.rb | 12 ------------ spec/features/admin/signature_sheets_spec.rb | 6 ------ spec/features/budgets/investments_spec.rb | 6 ------ spec/features/comments/topics_spec.rb | 4 ---- spec/features/communities_spec.rb | 4 ---- spec/features/debates_spec.rb | 8 -------- spec/features/home_spec.rb | 4 ---- .../management/document_verifications_spec.rb | 6 ------ spec/features/moderation_spec.rb | 4 ---- spec/features/officing/residence_spec.rb | 6 ------ spec/features/proposal_notifications_spec.rb | 4 ---- spec/features/proposals_spec.rb | 17 ----------------- spec/features/social_media_meta_tags_spec.rb | 10 ---------- spec/features/welcome_spec.rb | 2 -- spec/helpers/signature_sheets_helper_spec.rb | 4 ---- spec/lib/tasks/dashboards_spec.rb | 4 ---- spec/mailers/dashboard/mailer_spec.rb | 4 ---- spec/models/debate_spec.rb | 2 -- spec/models/officing/residence_spec.rb | 6 ------ spec/models/proposal_spec.rb | 9 --------- spec/models/signature_sheet_spec.rb | 4 ---- spec/models/signature_spec.rb | 12 ------------ .../verification/management/document_spec.rb | 6 ------ .../dashboard/successful_supports_spec.rb | 4 ---- spec/shared/features/documentable.rb | 8 -------- spec/shared/features/nested_documentable.rb | 4 ---- spec/shared/features/nested_imageable.rb | 4 ---- spec/shared/features/remotely_translatable.rb | 4 ---- spec/shared/models/map_validations.rb | 4 ---- spec/support/verifiable.rb | 4 ---- 39 files changed, 215 deletions(-) diff --git a/spec/controllers/concerns/remotely_translatable_spec.rb b/spec/controllers/concerns/remotely_translatable_spec.rb index 92ab5c8f6..69ab80845 100644 --- a/spec/controllers/concerns/remotely_translatable_spec.rb +++ b/spec/controllers/concerns/remotely_translatable_spec.rb @@ -7,10 +7,6 @@ describe RemotelyTranslatable do Setting["feature.remote_translations"] = true end - after do - Setting["feature.remote_translations"] = nil - end - describe "#detect_remote_translations" do describe "Should detect remote_translations" do diff --git a/spec/controllers/debates_controller_spec.rb b/spec/controllers/debates_controller_spec.rb index 67f98936e..6a7409dec 100644 --- a/spec/controllers/debates_controller_spec.rb +++ b/spec/controllers/debates_controller_spec.rb @@ -31,10 +31,6 @@ describe DebatesController do end describe "Vote with too many anonymous votes" do - after do - Setting["max_ratio_anon_votes_on_debates"] = 50 - end - it "allows vote if user is allowed" do Setting["max_ratio_anon_votes_on_debates"] = 100 debate = create(:debate) diff --git a/spec/controllers/installation_controller_spec.rb b/spec/controllers/installation_controller_spec.rb index 722bfa538..33b2cdb87 100644 --- a/spec/controllers/installation_controller_spec.rb +++ b/spec/controllers/installation_controller_spec.rb @@ -13,22 +13,12 @@ describe InstallationController, type: :request do let(:seeds_feature_settings) { Setting.where("key LIKE 'feature.%'") } before do - @current_feature_settings = seeds_feature_settings.pluck(:key, :value).to_h seeds_feature_settings.destroy_all test_feature_settings.each do |feature_name, feature_value| Setting["feature.#{feature_name}"] = feature_value end end - after do - test_feature_settings.each_key do |feature_name| - Setting.find_by(key: "feature.#{feature_name}").destroy - end - @current_feature_settings.each do |feature_name, feature_value| - Setting[feature_name] = feature_value - end - end - specify "with query string inside query params" do get "/consul.json" diff --git a/spec/features/account_spec.rb b/spec/features/account_spec.rb index aba01aa47..aa3312c68 100644 --- a/spec/features/account_spec.rb +++ b/spec/features/account_spec.rb @@ -183,12 +183,6 @@ describe "Account" do Setting["feature.user.recommendations_on_proposals"] = true end - after do - Setting["feature.user.recommendations"] = nil - Setting["feature.user.recommendations_on_debates"] = nil - Setting["feature.user.recommendations_on_proposals"] = nil - end - scenario "are enabled by default" do visit account_path diff --git a/spec/features/admin/budget_groups_spec.rb b/spec/features/admin/budget_groups_spec.rb index 176a4eac6..f1186b643 100644 --- a/spec/features/admin/budget_groups_spec.rb +++ b/spec/features/admin/budget_groups_spec.rb @@ -20,10 +20,6 @@ describe "Admin budget groups" do Setting["process.budgets"] = nil end - after do - Setting["process.budgets"] = true - end - scenario "Disabled with a feature flag" do expect do visit admin_budget_groups_path(budget) diff --git a/spec/features/admin/budget_headings_spec.rb b/spec/features/admin/budget_headings_spec.rb index ec15027ae..54d77b2ff 100644 --- a/spec/features/admin/budget_headings_spec.rb +++ b/spec/features/admin/budget_headings_spec.rb @@ -21,10 +21,6 @@ describe "Admin budget headings" do Setting["process.budgets"] = nil end - after do - Setting["process.budgets"] = true - end - scenario "Disabled with a feature flag" do expect do visit admin_budget_group_headings_path(budget, group) diff --git a/spec/features/admin/budget_investments_spec.rb b/spec/features/admin/budget_investments_spec.rb index 51f983939..f2cb72a50 100644 --- a/spec/features/admin/budget_investments_spec.rb +++ b/spec/features/admin/budget_investments_spec.rb @@ -28,10 +28,6 @@ describe "Admin budget investments" do Setting["process.budgets"] = nil end - after do - Setting["process.budgets"] = true - end - scenario "Disabled with a feature flag" do expect { visit admin_budgets_path }.to raise_exception(FeatureFlags::FeatureDisabled) end diff --git a/spec/features/admin/debates_spec.rb b/spec/features/admin/debates_spec.rb index 0b9252817..8b978b0a7 100644 --- a/spec/features/admin/debates_spec.rb +++ b/spec/features/admin/debates_spec.rb @@ -8,8 +8,6 @@ describe "Admin debates" do login_as(admin.user) expect { visit admin_hidden_debates_path }.to raise_exception(FeatureFlags::FeatureDisabled) - - Setting["process.debates"] = true end before do diff --git a/spec/features/admin/legislation/processes_spec.rb b/spec/features/admin/legislation/processes_spec.rb index 138f989c4..58cb3482c 100644 --- a/spec/features/admin/legislation/processes_spec.rb +++ b/spec/features/admin/legislation/processes_spec.rb @@ -287,7 +287,6 @@ describe "Admin collaborative legislation" do let!(:process) { create(:legislation_process) } before { Setting["feature.translation_interface"] = true } - after { Setting["feature.translation_interface"] = nil } scenario "Cant manage translations on homepage form" do visit edit_admin_legislation_process_homepage_path(process) diff --git a/spec/features/admin/settings_spec.rb b/spec/features/admin/settings_spec.rb index a1144a9ad..a15315994 100644 --- a/spec/features/admin/settings_spec.rb +++ b/spec/features/admin/settings_spec.rb @@ -138,10 +138,6 @@ describe "Admin settings" do Setting["feature.remote_census"] = true end - after do - Setting["feature.remote_census"] = nil - end - scenario "Should not be able when remote census feature deactivated" do Setting["feature.remote_census"] = nil admin = create(:administrator).user @@ -178,10 +174,6 @@ describe "Admin settings" do Setting["feature.remote_census"] = true end - after do - Setting["feature.remote_census"] = nil - end - scenario "On #tab-remote-census-configuration", :js do remote_census_setting = create(:setting, key: "remote_census.general.whatever") admin = create(:administrator).user @@ -221,10 +213,6 @@ describe "Admin settings" do Setting["feature.map"] = true end - after do - Setting["feature.map"] = nil - end - scenario "On #tab-map-configuration", :js do map_setting = Setting.create(key: "map.whatever") admin = create(:administrator).user diff --git a/spec/features/admin/signature_sheets_spec.rb b/spec/features/admin/signature_sheets_spec.rb index f37b47b57..5d10d7bae 100644 --- a/spec/features/admin/signature_sheets_spec.rb +++ b/spec/features/admin/signature_sheets_spec.rb @@ -89,12 +89,6 @@ describe "Signature sheets" do Setting["remote_census.response.valid"] = access_user_data end - after do - Setting["feature.remote_census"] = nil - Setting["remote_census.request.date_of_birth"] = nil - Setting["remote_census.request.postal_code"] = nil - end - scenario "Proposal" do proposal = create(:proposal) visit new_admin_signature_sheet_path diff --git a/spec/features/budgets/investments_spec.rb b/spec/features/budgets/investments_spec.rb index 4e5c70250..0f2f63dd2 100644 --- a/spec/features/budgets/investments_spec.rb +++ b/spec/features/budgets/investments_spec.rb @@ -17,10 +17,6 @@ describe "Budget Investments" do Setting["feature.allow_images"] = true end - after do - Setting["feature.allow_images"] = nil - end - context "Concerns" do it_behaves_like "notifiable in-app", Budget::Investment it_behaves_like "relationable", Budget::Investment @@ -1107,8 +1103,6 @@ describe "Budget Investments" do investment = create(:budget_investment, heading: heading) visit budget_investment_path(budget, id: investment.id) expect(page).to have_content "Access the community" - - Setting["feature.community"] = false end scenario "Can not access the community" do diff --git a/spec/features/comments/topics_spec.rb b/spec/features/comments/topics_spec.rb index a16cc1d89..02f6f7cd4 100644 --- a/spec/features/comments/topics_spec.rb +++ b/spec/features/comments/topics_spec.rb @@ -340,8 +340,6 @@ describe "Commenting topics from proposals" do page.find("#flag-expand-comment-#{comment.id}").click expect(page).to have_selector("#flag-comment-#{comment.id}") end - - Setting["feature.community"] = nil end scenario "Erasing a comment's author" do @@ -893,8 +891,6 @@ describe "Commenting topics from budget investments" do page.find("#flag-expand-comment-#{comment.id}").click expect(page).to have_selector("#flag-comment-#{comment.id}") end - - Setting["feature.community"] = nil end scenario "Erasing a comment's author" do diff --git a/spec/features/communities_spec.rb b/spec/features/communities_spec.rb index 6f76d7acd..46c56545f 100644 --- a/spec/features/communities_spec.rb +++ b/spec/features/communities_spec.rb @@ -6,10 +6,6 @@ describe "Communities" do Setting["feature.community"] = true end - after do - Setting["feature.community"] = nil - end - context "Show" do scenario "Should display default content" do diff --git a/spec/features/debates_spec.rb b/spec/features/debates_spec.rb index e9a14464b..5d1a5589e 100644 --- a/spec/features/debates_spec.rb +++ b/spec/features/debates_spec.rb @@ -460,11 +460,6 @@ describe "Debates" do Setting["feature.user.recommendations_on_debates"] = true end - after do - Setting["feature.user.recommendations"] = nil - Setting["feature.user.recommendations_on_debates"] = nil - end - scenario "can't be sorted if there's no logged user" do visit debates_path expect(page).not_to have_selector("a", text: "recommendations") @@ -1005,9 +1000,6 @@ describe "Debates" do expect(page).not_to have_content "Do not display with same tag" expect(page).not_to have_content "Do not display" end - - Setting["feature.user.recommendations"] = nil - Setting["feature.user.recommendations_on_debates"] = nil end scenario "After a search do not show featured debates" do diff --git a/spec/features/home_spec.rb b/spec/features/home_spec.rb index 108d55678..ab9d5372c 100644 --- a/spec/features/home_spec.rb +++ b/spec/features/home_spec.rb @@ -32,10 +32,6 @@ describe "Home" do login_as(user) end - after do - Setting["feature.user.recommendations"] = nil - end - scenario "Display recommended section when feature flag recommended is active" do debate = create(:debate, tag_list: "Sport") visit root_path diff --git a/spec/features/management/document_verifications_spec.rb b/spec/features/management/document_verifications_spec.rb index b845f819a..ce7bf8f2d 100644 --- a/spec/features/management/document_verifications_spec.rb +++ b/spec/features/management/document_verifications_spec.rb @@ -73,12 +73,6 @@ describe "DocumentVerifications" do Setting["remote_census.response.valid"] = access_user_data end - after do - Setting["feature.remote_census"] = nil - Setting["remote_census.request.date_of_birth"] = nil - Setting["remote_census.request.postal_code"] = nil - 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?). diff --git a/spec/features/moderation_spec.rb b/spec/features/moderation_spec.rb index 690e88a9f..42199fcca 100644 --- a/spec/features/moderation_spec.rb +++ b/spec/features/moderation_spec.rb @@ -98,10 +98,6 @@ describe "Moderation" do Setting["org_name"] = "OrgName" end - after do - Setting["org_name"] = "CONSUL" - end - scenario "Contains correct elements" do create(:moderator, user: user) login_as(user) diff --git a/spec/features/officing/residence_spec.rb b/spec/features/officing/residence_spec.rb index 3bf6a2db6..b6896cd8a 100644 --- a/spec/features/officing/residence_spec.rb +++ b/spec/features/officing/residence_spec.rb @@ -127,12 +127,6 @@ describe "Residence", :with_frozen_time do visit officing_root_path end - after do - Setting["feature.remote_census"] = nil - Setting["remote_census.request.date_of_birth"] = nil - Setting["remote_census.request.postal_code"] = nil - 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 diff --git a/spec/features/proposal_notifications_spec.rb b/spec/features/proposal_notifications_spec.rb index b277d8506..55230ba25 100644 --- a/spec/features/proposal_notifications_spec.rb +++ b/spec/features/proposal_notifications_spec.rb @@ -381,10 +381,6 @@ describe "Proposal Notifications" do Setting[:proposal_notification_minimum_interval_in_days] = 0 end - after do - Setting[:proposal_notification_minimum_interval_in_days] = 3 - end - scenario "for the same proposal", :js do author = create(:user) user = create(:user) diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index 54295dc8e..24c56ad5f 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -43,10 +43,6 @@ describe "Proposals" do Setting["featured_proposals_number"] = 3 end - after do - Setting["feature.allow_images"] = nil - end - scenario "Lists featured and regular proposals" do featured_proposals = create_featured_proposals proposals = [create(:proposal), create(:proposal), create(:proposal)] @@ -632,7 +628,6 @@ describe "Proposals" do context "Special interface translation behaviour" do before { Setting["feature.translation_interface"] = true } - after { Setting["feature.translation_interface"] = nil } scenario "Cant manage translations" do proposal = create(:proposal) @@ -776,11 +771,6 @@ describe "Proposals" do Setting["feature.user.recommendations_on_proposals"] = true end - after do - Setting["feature.user.recommendations"] = nil - Setting["feature.user.recommendations_on_proposals"] = nil - end - scenario "can't be sorted if there's no logged user" do visit proposals_path expect(page).not_to have_selector("a", text: "recommendations") @@ -1544,9 +1534,6 @@ describe "Proposals" do expect(page).not_to have_content "Do not display with same tag" expect(page).not_to have_content "Do not display" end - - Setting["feature.user.recommendations"] = nil - Setting["feature.user.recommendations_for_proposals"] = nil end scenario "After a search do not show featured proposals" do @@ -1959,10 +1946,6 @@ describe "Successful proposals" do Setting["feature.user.skip_verification"] = "true" end - after do - Setting["feature.user.skip_verification"] = nil - end - scenario "Create" do author = create(:user) login_as(author) diff --git a/spec/features/social_media_meta_tags_spec.rb b/spec/features/social_media_meta_tags_spec.rb index 34d43b337..023342f94 100644 --- a/spec/features/social_media_meta_tags_spec.rb +++ b/spec/features/social_media_meta_tags_spec.rb @@ -23,16 +23,6 @@ describe "Social media meta tags" do Setting["org_name"] = org_name end - after do - Setting["meta_keywords"] = nil - Setting["meta_title"] = nil - Setting["meta_description"] = nil - Setting["twitter_handle"] = nil - Setting["url"] = "http://example.com" - Setting["facebook_handle"] = nil - Setting["org_name"] = "CONSUL" - end - scenario "Social media meta tags partial render settings content" do visit root_path diff --git a/spec/features/welcome_spec.rb b/spec/features/welcome_spec.rb index a1835e5ba..5ba83d21b 100644 --- a/spec/features/welcome_spec.rb +++ b/spec/features/welcome_spec.rb @@ -117,8 +117,6 @@ describe "Welcome screen" do 4.times do |i| expect(page).to have_css "li:nth-child(#{i + 1})" end - - Setting["feature.user.skip_verification"] = nil end end diff --git a/spec/helpers/signature_sheets_helper_spec.rb b/spec/helpers/signature_sheets_helper_spec.rb index 1ed697c68..a02c79e0a 100644 --- a/spec/helpers/signature_sheets_helper_spec.rb +++ b/spec/helpers/signature_sheets_helper_spec.rb @@ -17,10 +17,6 @@ describe SignatureSheetsHelper do Setting["feature.remote_census"] = true end - after do - Setting["feature.remote_census"] = nil - end - it "returns text help when date_of_birth and postal_code are not required" do text_help_1 = "To verify a user, your application needs: Document number" text_help_2 = "Required fields for each user must be separated by commas and each user must be separated by semicolons." diff --git a/spec/lib/tasks/dashboards_spec.rb b/spec/lib/tasks/dashboards_spec.rb index 55368ee6f..5841092d7 100644 --- a/spec/lib/tasks/dashboards_spec.rb +++ b/spec/lib/tasks/dashboards_spec.rb @@ -12,10 +12,6 @@ describe "Dashboards Rake" do ActionMailer::Base.deliveries.clear end - after do - Setting["dashboard.emails"] = nil - end - let :run_rake_task do Rake::Task["dashboards:send_notifications"].reenable Rake.application.invoke_task "dashboards:send_notifications" diff --git a/spec/mailers/dashboard/mailer_spec.rb b/spec/mailers/dashboard/mailer_spec.rb index fff03da78..fffe88eb9 100644 --- a/spec/mailers/dashboard/mailer_spec.rb +++ b/spec/mailers/dashboard/mailer_spec.rb @@ -13,10 +13,6 @@ describe Dashboard::Mailer do Setting["dashboard.emails"] = true end - after do - Setting["dashboard.emails"] = nil - end - describe "#forward" do let!(:proposal) { create(:proposal) } diff --git a/spec/models/debate_spec.rb b/spec/models/debate_spec.rb index ecba4d46f..5988fd3c2 100644 --- a/spec/models/debate_spec.rb +++ b/spec/models/debate_spec.rb @@ -77,7 +77,6 @@ describe Debate do let(:debate) { create(:debate) } before { Setting["max_votes_for_debate_edit"] = 3 } - after { Setting["max_votes_for_debate_edit"] = 1000 } it "is true if debate has no votes yet" do expect(debate.total_votes).to eq(0) @@ -101,7 +100,6 @@ describe Debate do let(:debate) { create(:debate) } before { Setting["max_votes_for_debate_edit"] = 1 } - after { Setting["max_votes_for_debate_edit"] = 1000 } it "is true if user is the author and debate is editable" do expect(debate.editable_by?(debate.author)).to be true diff --git a/spec/models/officing/residence_spec.rb b/spec/models/officing/residence_spec.rb index 3aa28a6ae..1ca3d4e80 100644 --- a/spec/models/officing/residence_spec.rb +++ b/spec/models/officing/residence_spec.rb @@ -54,12 +54,6 @@ describe Officing::Residence do Setting["remote_census.response.valid"] = access_user_data end - after do - Setting["feature.remote_census"] = nil - Setting["remote_census.request.date_of_birth"] = nil - Setting["remote_census.request.postal_code"] = nil - end - it "is valid" do expect(custom_residence).to be_valid end diff --git a/spec/models/proposal_spec.rb b/spec/models/proposal_spec.rb index ddaee48dc..de5ea9731 100644 --- a/spec/models/proposal_spec.rb +++ b/spec/models/proposal_spec.rb @@ -178,7 +178,6 @@ describe Proposal do let(:proposal) { create(:proposal) } before { Setting["max_votes_for_proposal_edit"] = 5 } - after { Setting["max_votes_for_proposal_edit"] = 1000 } it "is true if proposal has no votes yet" do expect(proposal.total_votes).to eq(0) @@ -1083,10 +1082,6 @@ describe Proposal do ActionMailer::Base.deliveries.clear end - after do - Setting["dashboard.emails"] = nil - end - it "send notification after create when there are new actived actions" do create(:dashboard_action, :proposed_action, :active, day_offset: 0, published_proposal: false) create(:dashboard_action, :resource, :active, day_offset: 0, published_proposal: false) @@ -1114,10 +1109,6 @@ describe Proposal do ActionMailer::Base.deliveries.clear end - after do - Setting["dashboard.emails"] = nil - end - it "send notification after published when there are new actived actions" do create(:dashboard_action, :proposed_action, :active, day_offset: 0, published_proposal: true) create(:dashboard_action, :resource, :active, day_offset: 0, published_proposal: true) diff --git a/spec/models/signature_sheet_spec.rb b/spec/models/signature_sheet_spec.rb index 1a38d7444..1318b8ec3 100644 --- a/spec/models/signature_sheet_spec.rb +++ b/spec/models/signature_sheet_spec.rb @@ -82,10 +82,6 @@ describe SignatureSheet do Setting["feature.remote_census"] = true end - after do - Setting["feature.remote_census"] = nil - end - it "creates signatures for each group with document_number" do required_fields_to_verify = "123A; 456B" signature_sheet = create(:signature_sheet, required_fields_to_verify: required_fields_to_verify) diff --git a/spec/models/signature_spec.rb b/spec/models/signature_spec.rb index a6b90183a..3a3bebcd7 100644 --- a/spec/models/signature_spec.rb +++ b/spec/models/signature_spec.rb @@ -41,12 +41,6 @@ describe Signature do Setting["remote_census.request.postal_code"] = "some.value" end - after do - Setting["feature.remote_census"] = nil - Setting["remote_census.request.date_of_birth"] = nil - Setting["remote_census.request.postal_code"] = nil - end - it "is valid" do expect(signature).to be_valid end @@ -255,12 +249,6 @@ describe Signature do Setting["remote_census.response.valid"] = access_user_data end - after do - Setting["feature.remote_census"] = nil - Setting["remote_census.request.date_of_birth"] = nil - Setting["remote_census.request.postal_code"] = nil - end - it "calls assign_vote_to_user" do signature = create(:signature, document_number: "12345678Z", date_of_birth: "31/12/1980", diff --git a/spec/models/verification/management/document_spec.rb b/spec/models/verification/management/document_spec.rb index 789cfb2d0..eb7eaf58b 100644 --- a/spec/models/verification/management/document_spec.rb +++ b/spec/models/verification/management/document_spec.rb @@ -43,12 +43,6 @@ describe Verification::Management::Document do Setting["remote_census.response.valid"] = access_user_data end - after do - Setting["feature.remote_census"] = nil - Setting["remote_census.request.date_of_birth"] = nil - Setting["remote_census.request.postal_code"] = nil - end - it "is valid" do expect(verification_document).to be_valid end diff --git a/spec/requests/dashboard/successful_supports_spec.rb b/spec/requests/dashboard/successful_supports_spec.rb index 0d4c57942..b08357ff4 100644 --- a/spec/requests/dashboard/successful_supports_spec.rb +++ b/spec/requests/dashboard/successful_supports_spec.rb @@ -22,10 +22,6 @@ describe "Retrieves number of supports for the successful proposal" do sign_in(proposal.author) end - after do - Setting["proposals.successful_proposal_id"] = @successful_proposal_id - end - it "returns the number of supports grouped by day" do get proposal_dashboard_successful_supports_path(proposal, format: :json) diff --git a/spec/shared/features/documentable.rb b/spec/shared/features/documentable.rb index 8d03151ca..fe2e0435e 100644 --- a/spec/shared/features/documentable.rb +++ b/spec/shared/features/documentable.rb @@ -71,10 +71,6 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path, Setting["feature.allow_attached_documents"] = true end - after do - Setting["feature.allow_attached_documents"] = false - end - scenario "Documents list should be available" do login_as(user) visit send(documentable_path, arguments) @@ -98,10 +94,6 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path, Setting["feature.allow_attached_documents"] = false end - after do - Setting["feature.allow_attached_documents"] = true - end - scenario "Documents list should not be available" do login_as(create(:user)) visit send(documentable_path, arguments) diff --git a/spec/shared/features/nested_documentable.rb b/spec/shared/features/nested_documentable.rb index 702b3226a..664c8c37b 100644 --- a/spec/shared/features/nested_documentable.rb +++ b/spec/shared/features/nested_documentable.rb @@ -297,10 +297,6 @@ shared_examples "nested documentable" do |login_as_name, documentable_factory_na Setting["feature.allow_attached_documents"] = false end - after do - Setting["feature.allow_attached_documents"] = true - end - scenario "Add new document button should not be available" do login_as user_to_login visit send(path, arguments) diff --git a/spec/shared/features/nested_imageable.rb b/spec/shared/features/nested_imageable.rb index e2317ade5..4e0477789 100644 --- a/spec/shared/features/nested_imageable.rb +++ b/spec/shared/features/nested_imageable.rb @@ -19,10 +19,6 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p imageable.update(author: user) if imageable.respond_to?(:author) end - after do - Setting["feature.allow_images"] = nil - end - describe "at #{path}" do scenario "Should show new image link when imageable has not an associated image defined" do diff --git a/spec/shared/features/remotely_translatable.rb b/spec/shared/features/remotely_translatable.rb index a774be90f..37d2e66c5 100644 --- a/spec/shared/features/remotely_translatable.rb +++ b/spec/shared/features/remotely_translatable.rb @@ -12,10 +12,6 @@ shared_examples "remotely_translatable" do |factory_name, path_name, path_argume Setting["feature.remote_translations"] = true end - after do - Setting["feature.remote_translations"] = false - end - context "Button to request remote translation" do scenario "should not be present when current locale translation exists", :js do diff --git a/spec/shared/models/map_validations.rb b/spec/shared/models/map_validations.rb index 27f17167f..e76e766c0 100644 --- a/spec/shared/models/map_validations.rb +++ b/spec/shared/models/map_validations.rb @@ -8,10 +8,6 @@ shared_examples "map validations" do Setting["feature.map"] = true end - after do - Setting["feature.map"] = nil - end - it "is valid with a map location" do mappable.map_location = build(:map_location) mappable.skip_map = nil diff --git a/spec/support/verifiable.rb b/spec/support/verifiable.rb index 2558a8a1c..3548e700e 100644 --- a/spec/support/verifiable.rb +++ b/spec/support/verifiable.rb @@ -187,10 +187,6 @@ shared_examples_for "verifiable" do Setting["feature.user.skip_verification"] = "true" end - after do - Setting["feature.user.skip_verification"] = nil - end - describe "#residence_verified?" do it "is true if skipped" do expect(user.residence_verified?).to eq(true)