Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature flagging
Browse files Browse the repository at this point in the history
pixiitech committed Jan 24, 2025
1 parent 6532cfe commit bec1b98
Showing 3 changed files with 22 additions and 1 deletion.
4 changes: 4 additions & 0 deletions config/features.yml
Original file line number Diff line number Diff line change
@@ -23,6 +23,10 @@ features:
actor_type: user
description: Enables the endpoints of the accredited representative portal
enable_in_development: true
accredited_representative_portal_intent_to_file_api:
actor_type: user
description: Enables the endpoints of the accredited representative portal intent to file
enable_in_development: true
aedp_vadx:
actor_type: user
description: Enables the VADX experimental features in the AEDP application
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ module V0
class IntentToFileController < ApplicationController
INTENT_TO_FILE_TYPES = %w[compensation pension survivor].freeze

before_action :check_feature_toggle
before_action :validate_file_type, only: %i[show create]
before_action :validate_poa_code, only: %i[show create]

@@ -32,6 +33,15 @@ def create

private

def check_feature_toggle
unless Flipper.enabled?(:accredited_representative_portal_intent_to_file_api, @current_user)
message = 'The accredited_representative_portal_intent_to_file_api feature flag is disabled ' \
"for the user with uuid: #{@current_user.uuid}"

raise Common::Exceptions::Forbidden, detail: message
end
end

def validate_poa_code
authorize params[:id], policy_class: IntentToFilePolicy
end
Original file line number Diff line number Diff line change
@@ -8,12 +8,19 @@

before do
allow_any_instance_of(Auth::ClientCredentials::Service).to receive(:get_token).and_return('fake_access_token')
Flipper.enable(:accredited_representative_portal_pilot)
login_as(test_user)
travel_to(time)
end

describe 'GET /accredited_representative_portal/v0/intent_to_file' do
context 'feature flag is off' do
it 'returns not found' do
Flipper.disable(:accredited_representative_portal_intent_to_file_api)
get('/accredited_representative_portal/v0/intent_to_file/123498767V234859')
expect(response).to have_http_status(:forbidden)
end
end

context 'bad or missing filing type' do
it 'returns the appropriate error message' do
get('/accredited_representative_portal/v0/intent_to_file/123498767V234859')

0 comments on commit bec1b98

Please sign in to comment.