Merge pull request #4081 from consul/polls_feature_flag

Add feature flag exception for the module polls
This commit is contained in:
Javier Martín
2020-08-11 12:49:27 +02:00
committed by GitHub
4 changed files with 17 additions and 0 deletions

View File

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

View File

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

View File

@@ -6,6 +6,11 @@ describe "Admin polls" do
login_as(admin.user)
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
visit admin_root_path

View File

@@ -5,6 +5,11 @@ describe "Polls" do
it_behaves_like "notifiable in-app", :poll
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
scenario "Shows description for open polls" do
visit polls_path