Skip to content

Commit

Permalink
5086 verify military access in controller (#12252)
Browse files Browse the repository at this point in the history
* added authorization check to controller

* fixed typo in controller

* added spec and cassette for 403 response

* fixed specs

* removed 403 yml file

* specs fix
  • Loading branch information
cadibemma authored Mar 27, 2023
1 parent ad0b487 commit 3e66962
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
module Mobile
module V0
class MilitaryInformationController < ApplicationController
before_action { authorize :vet360, :military_access? }
def get_service_history
response = service.get_service_history

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,5 +175,14 @@
expect(response).to have_http_status(:not_found)
end
end

context 'with a user not authorized' do
it 'returns a forbidden response' do
user = FactoryBot.build(:iam_user, :no_edipi_id)
iam_sign_in(user)
get '/mobile/v0/military-service-history', headers: iam_headers
expect(response).to have_http_status(:forbidden)
end
end
end
end

0 comments on commit 3e66962

Please sign in to comment.