Add feature flag exception for the module polls

This commit is contained in:
Julian Herrero
2020-08-11 11:10:10 +07:00
parent 5d43b632e9
commit d720826e59
4 changed files with 17 additions and 0 deletions

View File

@@ -1,4 +1,8 @@
class Admin::Poll::BaseController < Admin::BaseController class Admin::Poll::BaseController < Admin::BaseController
include FeatureFlags
feature_flag :polls
helper_method :namespace helper_method :namespace
private private

View File

@@ -1,6 +1,9 @@
class PollsController < ApplicationController class PollsController < ApplicationController
include FeatureFlags
include PollsHelper include PollsHelper
feature_flag :polls
before_action :load_poll, except: [:index] before_action :load_poll, except: [:index]
before_action :load_active_poll, only: :index before_action :load_active_poll, only: :index

View File

@@ -6,6 +6,11 @@ describe "Admin polls" do
login_as(admin.user) login_as(admin.user)
end end
scenario "Disabled with a feature flag" do
Setting["process.polls"] = nil
expect { visit admin_polls_path }.to raise_exception(FeatureFlags::FeatureDisabled)
end
scenario "Index empty", :js do scenario "Index empty", :js do
visit admin_root_path visit admin_root_path

View File

@@ -5,6 +5,11 @@ describe "Polls" do
it_behaves_like "notifiable in-app", :poll it_behaves_like "notifiable in-app", :poll
end end
scenario "Disabled with a feature flag" do
Setting["process.polls"] = nil
expect { visit polls_path }.to raise_exception(FeatureFlags::FeatureDisabled)
end
context "#index" do context "#index" do
scenario "Shows description for open polls" do scenario "Shows description for open polls" do
visit polls_path visit polls_path