From 0a17ed7d8269d91f49cd69668df6387cd370bac8 Mon Sep 17 00:00:00 2001 From: Thomas Leese Date: Thu, 7 Dec 2023 11:57:32 +0000 Subject: [PATCH] Remove AssessorPolicy It's no longer used anywhere. --- .../assessor_interface/base_controller.rb | 4 -- app/policies/assessor_policy.rb | 23 ---------- .../edit.html.erb | 2 +- spec/policies/assessor_policy_spec.rb | 46 ------------------- 4 files changed, 1 insertion(+), 74 deletions(-) delete mode 100644 app/policies/assessor_policy.rb delete mode 100644 spec/policies/assessor_policy_spec.rb diff --git a/app/controllers/assessor_interface/base_controller.rb b/app/controllers/assessor_interface/base_controller.rb index e4db4c2d31..a260b767fd 100644 --- a/app/controllers/assessor_interface/base_controller.rb +++ b/app/controllers/assessor_interface/base_controller.rb @@ -7,8 +7,4 @@ class AssessorInterface::BaseController < ApplicationController layout "two_thirds" after_action :verify_authorized - - def authorize_assessor - authorize :assessor - end end diff --git a/app/policies/assessor_policy.rb b/app/policies/assessor_policy.rb deleted file mode 100644 index 2de1632998..0000000000 --- a/app/policies/assessor_policy.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -class AssessorPolicy < ApplicationPolicy - def index? - true - end - - def show? - true - end - - def create? - user.assess_permission - end - - def update? - user.assess_permission - end - - def destroy? - user.assess_permission - end -end diff --git a/app/views/assessor_interface/further_information_requests/edit.html.erb b/app/views/assessor_interface/further_information_requests/edit.html.erb index 0b438ed516..2eb468a919 100644 --- a/app/views/assessor_interface/further_information_requests/edit.html.erb +++ b/app/views/assessor_interface/further_information_requests/edit.html.erb @@ -14,7 +14,7 @@ <% end %> <% end %> -<% if policy(:assessor).update? && @view_object.can_update? %> +<% if policy([:assessor_interface, @view_object.further_information_request]).update? && @view_object.can_update? %> <%= form_with model: @form, url: [:assessor_interface, @view_object.application_form, @view_object.assessment, @view_object.further_information_request], method: :put do |f| %> <%= f.govuk_error_summary %> diff --git a/spec/policies/assessor_policy_spec.rb b/spec/policies/assessor_policy_spec.rb deleted file mode 100644 index 8ef8d99f96..0000000000 --- a/spec/policies/assessor_policy_spec.rb +++ /dev/null @@ -1,46 +0,0 @@ -# frozen_string_literal: true - -require "rails_helper" - -RSpec.describe AssessorPolicy do - it_behaves_like "a policy" - - let(:user) { create(:staff, :confirmed) } - - subject(:policy) { described_class.new(user, nil) } - - describe "#index?" do - subject(:index?) { policy.index? } - it { is_expected.to be true } - end - - describe "#show?" do - subject(:show?) { policy.show? } - it { is_expected.to be true } - end - - describe "#create?" do - subject(:create?) { policy.create? } - it_behaves_like "a policy method requiring the assess permission" - end - - describe "#new?" do - subject(:new?) { policy.new? } - it_behaves_like "a policy method requiring the assess permission" - end - - describe "#update?" do - subject(:update?) { policy.update? } - it_behaves_like "a policy method requiring the assess permission" - end - - describe "#edit?" do - subject(:edit?) { policy.edit? } - it_behaves_like "a policy method requiring the assess permission" - end - - describe "#destroy?" do - subject(:destroy?) { policy.destroy? } - it_behaves_like "a policy method requiring the assess permission" - end -end