Add feature flag for the GraphQL API
This commit is contained in:
committed by
Javi Martín
parent
bb627a7117
commit
0063e7b4d8
@@ -1,4 +1,7 @@
|
||||
class GraphqlController < ApplicationController
|
||||
include FeatureFlags
|
||||
|
||||
feature_flag :graphql_api
|
||||
|
||||
skip_before_action :verify_authenticity_token
|
||||
skip_authorization_check
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user