Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the personal statement inset text #8633

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<div class="govuk-inset-text">
Any changes you make will be included in applications you’ve already submitted.
<% if @section_policy.personal_statement? %>
Any changes you make to your personal statement will not be included in applications you have already submitted.
<% else %>
Any changes you make will be included in applications you’ve already submitted.
<% end %>
</div>
4 changes: 4 additions & 0 deletions app/services/candidate_interface/section_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def can_edit?
any_offer_accepted? || all_applications_unsubmitted? || editable_section?
end

def personal_statement?
@controller_path.classify.eql?('CandidateInterface::PersonalStatement')
end

private

delegate :any_offer_accepted?, to: :current_application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
</div>
<% end %>

<%= render CandidateInterface::EditableSectionWarning.new(section_policy: @section_policy, current_application:) %>

<%= render(CandidateInterface::BecomingATeacherReviewComponent.new(application_form: @application_form, editable: @section_policy.can_edit?)) %>

<% if @becoming_a_teacher_form.valid? %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,27 @@
let(:current_application) { create(:application_form, :completed, submitted_application_choices_count: 1) }

context 'when candidate can edit the section' do
let(:section_policy) { instance_double(CandidateInterface::SectionPolicy, can_edit?: true) }
let(:section_policy) { instance_double(CandidateInterface::SectionPolicy, can_edit?: true, personal_statement?: false) }

it 'renders message' do
expect(result.text).to include(
'Any changes you make will be included in applications you’ve already submitted.',
)
end

context 'when the canidate can edit the section and it is the personal statement' do
let(:section_policy) { instance_double(CandidateInterface::SectionPolicy, can_edit?: true, personal_statement?: true) }

it 'renders message' do
expect(result.text).to include(
'Any changes you make to your personal statement will not be included in applications you have already submitted.',
)
end
end
end

context 'when candidate can not edit the section' do
let(:section_policy) { instance_double(CandidateInterface::SectionPolicy, can_edit?: false) }
let(:section_policy) { instance_double(CandidateInterface::SectionPolicy, can_edit?: false, personal_statement?: false) }

it 'renders nothing' do
expect(result.text).to be_blank
Expand All @@ -30,7 +40,7 @@
end

context 'when candidate did not submitted yet' do
let(:section_policy) { instance_double(CandidateInterface::SectionPolicy, can_edit?: true) }
let(:section_policy) { instance_double(CandidateInterface::SectionPolicy, can_edit?: true, personal_statement?: false) }
let(:current_application) { create(:application_form) }

it 'renders nothing' do
Expand Down