From f7bfac67cd60d005f630e84f4d3559c5f0bd5890 Mon Sep 17 00:00:00 2001
From: Thomas Leese <thomas@leese.io>
Date: Wed, 11 Oct 2023 13:22:05 +0100
Subject: [PATCH] Remove references to ready_for_review

We're removing this column so we need to remove all references to it.
---
 ...ofessional_standing_requests_controller.rb |  3 +-
 ...essional_standing_request_location_form.rb |  8 +----
 ...nal_standing_request_location_form_spec.rb | 34 ++-----------------
 3 files changed, 4 insertions(+), 41 deletions(-)

diff --git a/app/controllers/assessor_interface/professional_standing_requests_controller.rb b/app/controllers/assessor_interface/professional_standing_requests_controller.rb
index fa2126dd25..83a842f2a8 100644
--- a/app/controllers/assessor_interface/professional_standing_requests_controller.rb
+++ b/app/controllers/assessor_interface/professional_standing_requests_controller.rb
@@ -16,7 +16,6 @@ def edit_locate
           requestable:,
           user: current_staff,
           received: requestable.received?,
-          ready_for_review: requestable.ready_for_review,
           location_note: requestable.location_note,
         )
     end
@@ -135,7 +134,7 @@ def set_variables
     def location_form_params
       params.require(
         :assessor_interface_professional_standing_request_location_form,
-      ).permit(:received, :ready_for_review, :location_note)
+      ).permit(:received, :location_note)
     end
 
     def request_form_params
diff --git a/app/forms/assessor_interface/professional_standing_request_location_form.rb b/app/forms/assessor_interface/professional_standing_request_location_form.rb
index e597a0b00c..f2f757e9f0 100644
--- a/app/forms/assessor_interface/professional_standing_request_location_form.rb
+++ b/app/forms/assessor_interface/professional_standing_request_location_form.rb
@@ -10,9 +10,6 @@ class AssessorInterface::ProfessionalStandingRequestLocationForm
   attribute :received, :boolean
   validates :received, inclusion: [true, false]
 
-  attribute :ready_for_review, :boolean
-  validates :ready_for_review, inclusion: [true, false], unless: :received
-
   attribute :location_note, :string
 
   def save
@@ -30,10 +27,7 @@ def save
         ApplicationFormStatusUpdater.call(application_form:, user:)
       end
 
-      requestable.update!(
-        location_note: location_note.presence || "",
-        ready_for_review: ready_for_review || false,
-      )
+      requestable.update!(location_note: location_note.presence || "")
     end
 
     true
diff --git a/spec/forms/assessor_interface/professional_standing_request_location_form_spec.rb b/spec/forms/assessor_interface/professional_standing_request_location_form_spec.rb
index 5393658f45..590cd7ea9b 100644
--- a/spec/forms/assessor_interface/professional_standing_request_location_form_spec.rb
+++ b/spec/forms/assessor_interface/professional_standing_request_location_form_spec.rb
@@ -8,30 +8,16 @@
   let(:user) { create(:staff) }
 
   let(:received) { "" }
-  let(:ready_for_review) { "" }
   let(:location_note) { "" }
 
   subject(:form) do
-    described_class.new(
-      requestable:,
-      user:,
-      received:,
-      ready_for_review:,
-      location_note:,
-    )
+    described_class.new(requestable:, user:, received:, location_note:)
   end
 
   describe "validations" do
     it { is_expected.to validate_presence_of(:requestable) }
     it { is_expected.to validate_presence_of(:user) }
     it { is_expected.to allow_values(true, false).for(:received) }
-    it { is_expected.to allow_values(true, false).for(:ready_for_review) }
-
-    context "when not received" do
-      let(:received) { "false" }
-
-      it { is_expected.to_not allow_values(nil).for(:ready_for_review) }
-    end
   end
 
   describe "#save" do
@@ -60,26 +46,10 @@
       end
     end
 
-    context "when not received and ready for review" do
-      let(:received) { "false" }
-      let(:ready_for_review) { "true" }
-
-      it { is_expected.to be true }
-
-      it "sets ready for review" do
-        expect { save }.to change(requestable, :ready_for_review).to(true)
-      end
-    end
-
-    context "when not received and not ready for review" do
+    context "when not received" do
       let(:received) { "false" }
-      let(:ready_for_review) { "false" }
 
       it { is_expected.to be true }
-
-      it "doesn't set ready for review" do
-        expect { save }.to_not change(requestable, :ready_for_review)
-      end
     end
   end
 end