diff --git a/lib/data_update_scripts/20220408203135_remove_profile_admin_flag.rb b/lib/data_update_scripts/20220408203135_remove_profile_admin_flag.rb new file mode 100644 index 000000000..b594b4dcb --- /dev/null +++ b/lib/data_update_scripts/20220408203135_remove_profile_admin_flag.rb @@ -0,0 +1,7 @@ +module DataUpdateScripts + class RemoveProfileAdminFlag + def run + FeatureFlag.remove(:profile_admin) + end + end +end diff --git a/spec/lib/data_update_scripts/remove_profile_admin_flag_spec.rb b/spec/lib/data_update_scripts/remove_profile_admin_flag_spec.rb new file mode 100644 index 000000000..a765368f8 --- /dev/null +++ b/spec/lib/data_update_scripts/remove_profile_admin_flag_spec.rb @@ -0,0 +1,30 @@ +require "rails_helper" +require Rails.root.join( + "lib/data_update_scripts/20220408203135_remove_profile_admin_flag.rb", +) + +describe DataUpdateScripts::RemoveProfileAdminFlag do + it "causes enabled? to be false" do + FeatureFlag.enable(:profile_admin) + + described_class.new.run + + expect(FeatureFlag.enabled?(:profile_admin)).to be false + end + + it "removes the profile_admin flag" do + FeatureFlag.enable(:profile_admin) + + described_class.new.run + + expect(FeatureFlag.exist?(:profile_admin)).to be false + end + + it "works if the flag does not exist" do + FeatureFlag.remove(:profile_admin) + + described_class.new.run + + expect(FeatureFlag.exist?(:profile_admin)).to be false + end +end diff --git a/spec/models/admin_menu_spec.rb b/spec/models/admin_menu_spec.rb index 375d8b9cf..5d590eafd 100644 --- a/spec/models/admin_menu_spec.rb +++ b/spec/models/admin_menu_spec.rb @@ -89,13 +89,6 @@ RSpec.describe AdminMenu do it { is_expected.to be_a(Menu::Item) } it { is_expected.to be_visible } - - context "when :profile_field FeatureFlag is not enabled" do - # leaving this in place to make sure item is visible even if flag not enabled - before { allow(FeatureFlag).to receive(:enabled?).with(:profile_admin).and_return(false) } - - it { is_expected.to be_visible } - end end describe "scope :apps" do diff --git a/spec/requests/admin/nested_sidebar_spec.rb b/spec/requests/admin/nested_sidebar_spec.rb index 5e66cdc4e..d42567dad 100644 --- a/spec/requests/admin/nested_sidebar_spec.rb +++ b/spec/requests/admin/nested_sidebar_spec.rb @@ -27,14 +27,6 @@ RSpec.describe "admin sidebar", type: :request do end describe "profile admin feature flag" do - it "shows the option in the sidebar even when the feature flag is disabled" do - allow(FeatureFlag).to receive(:enabled?).with(:profile_admin).and_return(false) - - get admin_articles_path - - expect(response.body).to include("Profile Fields") - end - it "shows the option in the sidebar" do get admin_articles_path diff --git a/spec/routing/profile_admin_routes_spec.rb b/spec/routing/profile_admin_routes_spec.rb index 411eada23..492c872d8 100644 --- a/spec/routing/profile_admin_routes_spec.rb +++ b/spec/routing/profile_admin_routes_spec.rb @@ -1,17 +1,7 @@ require "rails_helper" RSpec.describe "Profile admin routes", type: :routing do - it "renders the profile admin route if the feature flag is enabled" do - expect(get: admin_profile_fields_path).to route_to( - controller: "admin/profile_fields", - action: "index", - locale: nil, - ) - end - - it "renders the profile admin route even if the feature flag is disabled" do - allow(FeatureFlag).to receive(:enabled?).with(:profile_admin).and_return(false) - + it "renders the profile admin route" do expect(get: admin_profile_fields_path).to route_to( controller: "admin/profile_fields", action: "index",