Skip to content

Commit

Permalink
Merge pull request #1933 from DFE-Digital/feature/show-form-a-mat-pro…
Browse files Browse the repository at this point in the history
…jects-handover

Show form a MAT projects for Handover
  • Loading branch information
mec authored Oct 3, 2024
2 parents 3a7cf8c + 2908eb5 commit 5bb1c7b
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 14 deletions.
27 changes: 20 additions & 7 deletions app/views/all/handover/projects/conversion/check.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,27 @@
row.with_key { t("project.handover.check.summary.form_a_mat") }
row.with_value { t(@project.form_a_mat?) }
end
summary_list.with_row do |row|
row.with_key { t("project.handover.check.summary.incoming_trust.name") }
row.with_value { @project.incoming_trust.name }
end
summary_list.with_row do |row|
row.with_key { t("project.handover.check.summary.incoming_trust.ukprn") }
row.with_value { @project.incoming_trust.ukprn }

if @project.form_a_mat?
summary_list.with_row do |row|
row.with_key { t("project.handover.check.summary.new_trust.name") }
row.with_value { @project.new_trust_name }
end
summary_list.with_row do |row|
row.with_key { t("project.handover.check.summary.new_trust.reference") }
row.with_value { @project.new_trust_reference_number }
end
else
summary_list.with_row do |row|
row.with_key { t("project.handover.check.summary.incoming_trust.name") }
row.with_value { @project.incoming_trust.name }
end
summary_list.with_row do |row|
row.with_key { t("project.handover.check.summary.incoming_trust.ukprn") }
row.with_value { @project.incoming_trust.ukprn }
end
end

summary_list.with_row do |row|
row.with_key { t("project.handover.check.summary.advisory_board_date") }
row.with_value { @project.advisory_board_date.to_fs(:govuk) }
Expand Down
27 changes: 20 additions & 7 deletions app/views/all/handover/projects/transfer/check.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,27 @@
row.with_key { t("project.handover.check.summary.form_a_mat") }
row.with_value { t(@project.form_a_mat?) }
end
summary_list.with_row do |row|
row.with_key { t("project.handover.check.summary.incoming_trust.name") }
row.with_value { @project.incoming_trust.name }
end
summary_list.with_row do |row|
row.with_key { t("project.handover.check.summary.incoming_trust.ukprn") }
row.with_value { @project.incoming_trust.ukprn }

if @project.form_a_mat?
summary_list.with_row do |row|
row.with_key { t("project.handover.check.summary.new_trust.name") }
row.with_value { @project.new_trust_name }
end
summary_list.with_row do |row|
row.with_key { t("project.handover.check.summary.new_trust.reference") }
row.with_value { @project.new_trust_reference_number }
end
else
summary_list.with_row do |row|
row.with_key { t("project.handover.check.summary.incoming_trust.name") }
row.with_value { @project.incoming_trust.name }
end
summary_list.with_row do |row|
row.with_key { t("project.handover.check.summary.incoming_trust.ukprn") }
row.with_value { @project.incoming_trust.ukprn }
end
end

summary_list.with_row do |row|
row.with_key { t("project.handover.check.summary.outgoing_trust.name") }
row.with_value { @project.outgoing_trust.name }
Expand Down
3 changes: 3 additions & 0 deletions config/locales/handover.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ en:
outgoing_trust:
name: Outgoing trust name
ukprn: Outgoing trust UKPRN
new_trust:
name: New trust
reference: Trust reference number
advisory_board_date: Advisory board date
provisional_conversion_date: Provisional conversion date
provisional_transfer_date: Provisional transfer date
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,33 @@
expect(page).to have_content("Projects to handover")
expect(page).to have_content("These projects have been worked on in Prepare")
end

context "when the conversion is a forming a MAT" do
let!(:conversion_project) {
create(
:conversion_project,
:form_a_mat,
state: :inactive, urn: 123456,
conversion_date: Date.new(2024, 2, 1)
)
}

scenario "they can check they have the right project and cancel if not" do
visit all_handover_projects_path
click_link "Add handover details"

expect(page).to have_content("Check you have the right project")
expect(page).to have_content("Conversion")
expect(page).to have_content(conversion_project.urn)
expect(page).to have_content(conversion_project.new_trust_reference_number)
expect(page).to have_content(conversion_project.new_trust_name)

click_link "Choose a different project"

expect(page).to have_content("Projects to handover")
expect(page).to have_content("These projects have been worked on in Prepare")
end
end
end

context "when the project is a transfer" do
Expand All @@ -54,5 +81,32 @@
expect(page).to have_content("Projects to handover")
expect(page).to have_content("These projects have been worked on in Prepare")
end

context "when the transfer is a forming a MAT" do
let!(:transfer_project) {
create(
:transfer_project,
:form_a_mat,
state: :inactive, urn: 123456,
transfer_date: Date.new(2024, 2, 1)
)
}

scenario "they can check they have the right project and cancel if not" do
visit all_handover_projects_path
click_link "Add handover details"

expect(page).to have_content("Check you have the right project")
expect(page).to have_content("Transfer")
expect(page).to have_content(transfer_project.urn)
expect(page).to have_content(transfer_project.new_trust_reference_number)
expect(page).to have_content(transfer_project.new_trust_name)

click_link "Choose a different project"

expect(page).to have_content("Projects to handover")
expect(page).to have_content("These projects have been worked on in Prepare")
end
end
end
end

0 comments on commit 5bb1c7b

Please sign in to comment.