Skip to content

Commit

Permalink
Remove references to ready_for_review
Browse files Browse the repository at this point in the history
We're removing this column so we need to remove all references to it.
  • Loading branch information
thomasleese committed Nov 8, 2023
1 parent 1d1e0f3 commit 1fe086a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def edit_locate
requestable:,
user: current_staff,
received: requestable.received?,
ready_for_review: requestable.ready_for_review,
location_note: requestable.location_note,
)
end
Expand Down Expand Up @@ -170,7 +169,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 review_form_params
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 1fe086a

Please sign in to comment.