Skip to content

Commit

Permalink
Candidate shouldn't see personal statement on their draft application
Browse files Browse the repository at this point in the history
They should only see it once they have submitted their application.
  • Loading branch information
tomas-stefano committed Oct 9, 2023
1 parent b1e8d57 commit 5a2c9f6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= render SummaryListComponent.new(rows: rows) %>

<% if @application_choice.personal_statement.present? %>
<% if show_personal_statement? %>
<div class="app-summary-card govuk-!-margin-bottom-6">
<div class="app-summary-card__header govuk-body">
Personal statement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ def initialize(application_choice:)
@application_choice = application_choice
end

def show_personal_statement?
@application_choice.submitted? && @application_choice.personal_statement.present?
end

def rows
[
status_row,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,26 @@
end

let(:application_choice) do
create(:application_choice, :awaiting_provider_decision)
create(:application_choice, :awaiting_provider_decision, personal_statement:)
end
let(:course) { application_choice.current_course }
let(:provider) { application_choice.current_provider }
let(:links) { result.css('a').map(&:text) }
let(:personal_statement) { 'some personal statement' }

context 'when application is unsubmitted' do
let(:application_choice) do
create(:application_choice, :unsubmitted)
create(:application_choice, :unsubmitted, personal_statement:)
end

it 'shows change course link' do
expect(links).to include("Change course for #{application_choice.current_course.name_and_code}")
end

it 'does not show the personal statement' do
expect(result.text).not_to include(personal_statement)
end

context 'when course has multiple study modes' do
before do
create(
Expand Down Expand Up @@ -57,6 +62,10 @@
expect(result.css('a')).to be_empty
end

it 'shows personal statement' do
expect(result.text).to include(personal_statement)
end

context 'when course has multiple study modes' do
before do
create(
Expand Down

0 comments on commit 5a2c9f6

Please sign in to comment.