13 changed files with 141 additions and 44 deletions
@ -0,0 +1,33 @@ |
|||||||
|
<% content_for :title, "Review lettings log" %> |
||||||
|
<% content_for :breadcrumbs, govuk_breadcrumbs(breadcrumbs: { |
||||||
|
"Logs" => "/logs", |
||||||
|
"Log #{@case_log.id.to_s}" => "/logs/" + @case_log.id.to_s, |
||||||
|
"Review lettings log" => "" |
||||||
|
}) %> |
||||||
|
|
||||||
|
<%= turbo_frame_tag "case_log_form", target: "_top" do %> |
||||||
|
<div class="govuk-grid-row"> |
||||||
|
<div class="govuk-grid-column-two-thirds-from-desktop"> |
||||||
|
<h1 class="govuk-heading-xl"> |
||||||
|
<%= content_for(:title) %> |
||||||
|
</h1> |
||||||
|
<% @case_log.form.sections.map do |section| %> |
||||||
|
<h2 class="govuk-heading-m"><%= section.label %></h2> |
||||||
|
<% section.subsections.map do |subsection| %> |
||||||
|
<div class="x-govuk-summary-card govuk-!-margin-bottom-6"> |
||||||
|
<div class="x-govuk-summary-card__header"> |
||||||
|
<h3 class="x-govuk-summary-card__title"><%= subsection.label %></h3> |
||||||
|
</div> |
||||||
|
<div class="x-govuk-summary-card__body"> |
||||||
|
<dl class="govuk-summary-list"> |
||||||
|
<% subsection.applicable_questions(@case_log).each do |question| %> |
||||||
|
<%= render partial: 'form/check_answers_table', locals: { question: question, case_log: @case_log } %> |
||||||
|
<% end %> |
||||||
|
</dl> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<% end %> |
||||||
|
<% end %> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<% end %> |
@ -0,0 +1,34 @@ |
|||||||
|
require "rails_helper" |
||||||
|
require_relative "helpers" |
||||||
|
|
||||||
|
RSpec.describe "Form Review Page" do |
||||||
|
include Helpers |
||||||
|
let(:user) { FactoryBot.create(:user) } |
||||||
|
let(:completed_unsubmitted_case_log) do |
||||||
|
FactoryBot.create( |
||||||
|
:case_log, |
||||||
|
:completed, |
||||||
|
status: 1, |
||||||
|
owning_organisation: user.organisation, |
||||||
|
managing_organisation: user.organisation, |
||||||
|
) |
||||||
|
end |
||||||
|
|
||||||
|
before do |
||||||
|
sign_in user |
||||||
|
end |
||||||
|
|
||||||
|
context "when the user wishes to review their case log" do |
||||||
|
it "the review page can be visited by URL" do |
||||||
|
visit("/logs/#{completed_unsubmitted_case_log.id}/review") |
||||||
|
expect(page).to have_content("Review lettings log") |
||||||
|
end |
||||||
|
|
||||||
|
it "the review page allows the user to submit a completed case log" do |
||||||
|
visit("/logs/#{completed_unsubmitted_case_log.id}/review") |
||||||
|
click_button("Submit lettings log") |
||||||
|
expect(page).to have_content("Success") |
||||||
|
expect(page).to have_content("Log #{completed_unsubmitted_case_log.id} has been submitted") |
||||||
|
end |
||||||
|
end |
||||||
|
end |
Loading…
Reference in new issue