From 2ec176a2a8432ef615bbd3613baae9184bfa53b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Mon, 23 Sep 2019 13:48:28 +0200 Subject: [PATCH] Remove redundant feature settings enabled in tests These settings are enabled by default. It could be argued explicitely enabling the features makes tests more consistent, because they'll work if we change the default setting. It could also be argued that it makes tests more expressive because it makes the reader realize certain things will only work if a setting is enabled. However, we were only doing so in a few tests. The truth is, thousands of our tests depend on certain features being enabled. So IMHO we should be consistent and either set them on every test, or not at all. I'm choosing the latter option for simplicity. --- spec/features/account_spec.rb | 7 ------- spec/features/budgets/investments_spec.rb | 4 ---- spec/features/comments/topics_spec.rb | 4 ---- spec/features/communities_spec.rb | 4 ---- spec/features/debates_spec.rb | 8 -------- spec/features/emails_spec.rb | 5 ----- spec/features/home_spec.rb | 1 - spec/features/proposals_spec.rb | 9 --------- spec/shared/features/nested_imageable.rb | 3 --- 9 files changed, 45 deletions(-) diff --git a/spec/features/account_spec.rb b/spec/features/account_spec.rb index aa3312c68..3d3b85c27 100644 --- a/spec/features/account_spec.rb +++ b/spec/features/account_spec.rb @@ -176,13 +176,6 @@ describe "Account" do end context "Recommendations" do - - before do - Setting["feature.user.recommendations"] = true - Setting["feature.user.recommendations_on_debates"] = true - Setting["feature.user.recommendations_on_proposals"] = true - end - scenario "are enabled by default" do visit account_path diff --git a/spec/features/budgets/investments_spec.rb b/spec/features/budgets/investments_spec.rb index 0f2f63dd2..9613cf342 100644 --- a/spec/features/budgets/investments_spec.rb +++ b/spec/features/budgets/investments_spec.rb @@ -13,10 +13,6 @@ describe "Budget Investments" do :budget_investment, "budget_investment_path" - before do - Setting["feature.allow_images"] = true - end - context "Concerns" do it_behaves_like "notifiable in-app", Budget::Investment it_behaves_like "relationable", Budget::Investment diff --git a/spec/features/comments/topics_spec.rb b/spec/features/comments/topics_spec.rb index 02f6f7cd4..6686267f5 100644 --- a/spec/features/comments/topics_spec.rb +++ b/spec/features/comments/topics_spec.rb @@ -326,8 +326,6 @@ describe "Commenting topics from proposals" do end scenario "Flagging turbolinks sanity check", :js do - Setting["feature.community"] = true - community = proposal.community topic = create(:topic, community: community, title: "Should we change the world?") comment = create(:comment, commentable: topic) @@ -877,8 +875,6 @@ describe "Commenting topics from budget investments" do end scenario "Flagging turbolinks sanity check", :js do - Setting["feature.community"] = true - community = investment.community topic = create(:topic, community: community, title: "Should we change the world?") comment = create(:comment, commentable: topic) diff --git a/spec/features/communities_spec.rb b/spec/features/communities_spec.rb index 46c56545f..9880a2d15 100644 --- a/spec/features/communities_spec.rb +++ b/spec/features/communities_spec.rb @@ -2,10 +2,6 @@ require "rails_helper" describe "Communities" do - before do - Setting["feature.community"] = true - 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 5d1a5589e..9988e872b 100644 --- a/spec/features/debates_spec.rb +++ b/spec/features/debates_spec.rb @@ -455,11 +455,6 @@ describe "Debates" do 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") } - before do - Setting["feature.user.recommendations"] = true - Setting["feature.user.recommendations_on_debates"] = true - 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") @@ -975,9 +970,6 @@ describe "Debates" do end scenario "Reorder by recommendations results maintaing search" do - Setting["feature.user.recommendations"] = true - Setting["feature.user.recommendations_on_debates"] = true - user = create(:user, recommended_debates: true) login_as(user) diff --git a/spec/features/emails_spec.rb b/spec/features/emails_spec.rb index 975a3c536..c88e5f32a 100644 --- a/spec/features/emails_spec.rb +++ b/spec/features/emails_spec.rb @@ -350,11 +350,6 @@ describe "Emails" do end context "Budgets" do - - before do - Setting["process.budgets"] = true - end - let(:author) { create(:user, :level_two) } let(:budget) { create(:budget) } let(:group) { create(:budget_group, name: "Health", budget: budget) } diff --git a/spec/features/home_spec.rb b/spec/features/home_spec.rb index ab9d5372c..38a42be1f 100644 --- a/spec/features/home_spec.rb +++ b/spec/features/home_spec.rb @@ -25,7 +25,6 @@ describe "Home" do describe "Recommended" do before do - Setting["feature.user.recommendations"] = true user = create(:user) proposal = create(:proposal, tag_list: "Sport") create(:follow, followable: proposal, user: user) diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index 24c56ad5f..22e702204 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -38,7 +38,6 @@ describe "Proposals" do context "Index" do before do - Setting["feature.allow_images"] = true Setting["feature.featured_proposals"] = true Setting["featured_proposals_number"] = 3 end @@ -766,11 +765,6 @@ describe "Proposals" do 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") } - before do - Setting["feature.user.recommendations"] = true - Setting["feature.user.recommendations_on_proposals"] = true - 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") @@ -1509,9 +1503,6 @@ describe "Proposals" do end scenario "Reorder by recommendations results maintaing search" do - Setting["feature.user.recommendations"] = true - Setting["feature.user.recommendations_for_proposals"] = true - user = create(:user, recommended_proposals: true) login_as(user) diff --git a/spec/shared/features/nested_imageable.rb b/spec/shared/features/nested_imageable.rb index 4e0477789..fbbec8e02 100644 --- a/spec/shared/features/nested_imageable.rb +++ b/spec/shared/features/nested_imageable.rb @@ -9,9 +9,6 @@ shared_examples "nested imageable" do |imageable_factory_name, path, imageable_p let!(:imageable) { create(imageable_factory_name) } before do - - Setting["feature.allow_images"] = true - imageable_path_arguments&.each do |argument_name, path_to_value| arguments.merge!("#{argument_name}": imageable.send(path_to_value)) end