-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If the admin decides that the LoPS is not acceptable, and they'd like to send this to review, we've decided to split this in to two pages so the internal notes appears on its own page.
- Loading branch information
1 parent
4beb197
commit eb17f3d
Showing
25 changed files
with
351 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
app/forms/assessor_interface/requestable_verify_failed_form.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
class AssessorInterface::RequestableVerifyFailedForm | ||
include ActiveModel::Model | ||
include ActiveModel::Attributes | ||
|
||
attr_accessor :requestable, :user | ||
validates :requestable, :user, presence: true | ||
|
||
attribute :note, :string | ||
validates :note, presence: true | ||
|
||
def save | ||
return false if invalid? | ||
|
||
VerifyRequestable.call(requestable:, user:, passed: false, note:) | ||
|
||
true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
app/views/assessor_interface/professional_standing_requests/edit_verify_failed.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<% content_for :page_title, "#{"Error: " if @form.errors.any?}Record LoPS response" %> | ||
<% content_for :back_link_url, assessor_interface_application_form_path(@application_form) %> | ||
|
||
<%= form_with model: @form, url: [:verify_failed, :assessor_interface, @application_form, @assessment, :professional_standing_request] do |f| %> | ||
<%= f.govuk_error_summary %> | ||
|
||
<h1 class="govuk-heading-xl">Record LoPS response</h1> | ||
|
||
<p class="govuk-body">You have opted to send this LoPS for review.</p> | ||
|
||
<%= f.govuk_text_area :note, label: { text: "Internal note: briefly explain to the assessor why you are sending this LoPS for review." } %> | ||
|
||
<%= f.govuk_submit do %> | ||
<%= govuk_link_to "Cancel", [:assessor_interface, @application_form] %> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
spec/forms/assessor_interface/requestable_verify_failed_form_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails_helper" | ||
|
||
RSpec.describe AssessorInterface::RequestableVerifyFailedForm, type: :model do | ||
let(:requestable) { create(:reference_request, :received) } | ||
let(:user) { create(:staff) } | ||
let(:note) { "" } | ||
|
||
subject(:form) { described_class.new(requestable:, user:, note:) } | ||
|
||
describe "validations" do | ||
it { is_expected.to validate_presence_of(:note) } | ||
end | ||
|
||
describe "#save" do | ||
subject(:save) { form.save } | ||
|
||
context "when passed is false" do | ||
let(:note) { "Note." } | ||
|
||
it "sets verify_passed" do | ||
expect { save }.to change(requestable, :verify_passed).from(nil).to( | ||
false, | ||
) | ||
end | ||
|
||
it "sets verify_note" do | ||
expect { save }.to change(requestable, :verify_note).from("").to( | ||
"Note.", | ||
) | ||
end | ||
|
||
it "sets verified_at" do | ||
freeze_time do | ||
expect { save }.to change(requestable, :verified_at).from(nil).to( | ||
Time.zone.now, | ||
) | ||
end | ||
end | ||
|
||
it "updates induction required" do | ||
expect(UpdateAssessmentInductionRequired).to receive(:call) | ||
save # rubocop:disable Rails/SaveBang | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.