From 1abb3eea269e37b23a696d36e8399f92278c3eb6 Mon Sep 17 00:00:00 2001 From: Phil Lee Date: Thu, 3 Oct 2024 14:52:40 +0100 Subject: [PATCH] admin can view amendments after payrolled --- .../admin/amendments_controller.rb | 2 +- spec/features/admin/admin_amend_claim_spec.rb | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/amendments_controller.rb b/app/controllers/admin/amendments_controller.rb index 967a555237..ec50816503 100644 --- a/app/controllers/admin/amendments_controller.rb +++ b/app/controllers/admin/amendments_controller.rb @@ -1,7 +1,7 @@ class Admin::AmendmentsController < Admin::BaseAdminController before_action :load_claim before_action :ensure_service_operator - before_action :ensure_claim_is_amendable + before_action :ensure_claim_is_amendable, only: [:new, :create] def index end diff --git a/spec/features/admin/admin_amend_claim_spec.rb b/spec/features/admin/admin_amend_claim_spec.rb index 50b50c2963..ff89ec279f 100644 --- a/spec/features/admin/admin_amend_claim_spec.rb +++ b/spec/features/admin/admin_amend_claim_spec.rb @@ -186,4 +186,29 @@ expect(page).to have_content("Claim has been amended successfully") end end + + context "when claim is no longer amendable" do + let!(:payment) do + create( + :payment, + claims: [claim] + ) + end + + scenario "admin can view amendments" do + visit admin_claim_url(claim) + click_link "View tasks" + click_on "Claim amendments" + + expect(page).to have_content "Claim amendments" + end + + scenario "admin cannot make amendments" do + visit admin_claim_url(claim) + expect(page).not_to have_content "Amend claim" + + visit new_admin_claim_amendment_path(claim) + expect(page).to have_content "This claim cannot be amended" + end + end end