Merge pull request #2151 from consul/feature-flag-api

Feature flag api
This commit is contained in:
Javier Martín
2019-10-20 18:21:28 +02:00
committed by GitHub
5 changed files with 15 additions and 0 deletions

View File

@@ -1,4 +1,7 @@
class GraphqlController < ApplicationController
include FeatureFlags
feature_flag :graphql_api
skip_before_action :verify_authenticity_token
skip_authorization_check

View File

@@ -99,6 +99,7 @@ class Setting < ApplicationRecord
"feature.translation_interface": nil,
"feature.remote_census": nil,
"feature.valuation_comment_notification": true,
"feature.graphql_api": true,
"homepage.widgets.feeds.debates": true,
"homepage.widgets.feeds.processes": true,
"homepage.widgets.feeds.proposals": true,

View File

@@ -124,6 +124,7 @@ en:
remote_census_description: "Allows to configure the connection to the remote census of each institution"
valuation_comment_notification: "Valuation comment notification"
valuation_comment_notification_description: "Send an email to all associated users except valuation commenter to budget investment when a new valuation comment is created"
graphql_api: "GraphQL API"
remote_census:
general:
endpoint: "Endpoint"

View File

@@ -124,6 +124,7 @@ es:
remote_census_description: "Permite configurar la conexión al censo remoto de cada institución"
valuation_comment_notification: "Notificar comentarios de evaluación"
valuation_comment_notification_description: "Envía un email a todos los usuarios menos al que haya comentado asociados a un presupuesto participativo cuando se cree un nuevo comentario de evaluación"
graphql_api: "API GraphQL"
remote_census:
general:
endpoint: "Endpoint"

View File

@@ -90,4 +90,13 @@ describe GraphqlController, type: :request do
expect(response).to have_http_status(:ok)
end
end
context "feature flag is set to false" do
before { Setting["feature.graphql_api"] = false }
it "is disabled" do
expect { get "/graphql" }.to raise_exception(FeatureFlags::FeatureDisabled)
expect { post "/graphql" }.to raise_exception(FeatureFlags::FeatureDisabled)
end
end
end