Browse Source

CLDC-2672: WIP

CLDC-2672-duplicate-logs-question-page-button
Aaron Spencer 1 year ago
parent
commit
6205a2e006
  1. 5
      app/views/form/page.html.erb
  2. 4
      spec/features/lettings_log_spec.rb
  3. 6
      spec/features/sales_log_spec.rb
  4. 1
      spec/models/form/page_spec.rb

5
app/views/form/page.html.erb

@ -64,11 +64,16 @@
<div class="govuk-button-group">
<% if !@page.interruption_screen? && if request.query_parameters["referrer"] != "check_answers" %>
<% if request.query_parameters["referrer"] == "duplicate_logs" %>
<%= f.govuk_submit "Save changes" %>
<%= govuk_link_to("Cancel", lettings_log_duplicate_logs_path(request.query_parameters["original_log_id"], original_log_id: request.query_parameters["original_log_id"]))%>
<% else %>
<%= f.govuk_submit "Save and continue" %>
<%= govuk_link_to(
(@page.skip_text || "Skip for now"),
(@page.skip_href(@log) || send(@log.form.next_page_redirect_path(@page, @log, current_user), @log)),
) %>
<% end %>
<% else %>
<%= f.govuk_submit "Save changes" %>
<%= govuk_link_to "Cancel", send(@log.form.cancel_path(@page, @log), @log) %>

4
spec/features/lettings_log_spec.rb

@ -510,7 +510,7 @@ RSpec.describe "Lettings Log Features" do
expect(page).to have_current_path("/lettings-logs/#{lettings_log.id}/duplicate-logs?original_log_id=#{lettings_log.id}")
click_link("Change", href: "/lettings-logs/#{duplicate_log.id}/tenant-code?first_remaining_duplicate_id=#{lettings_log.id}&original_log_id=#{lettings_log.id}&referrer=duplicate_logs")
fill_in("lettings-log-tenancycode-field", with: "something else")
click_button("Save and continue")
click_button("Save changes")
expect(page).to have_current_path("/lettings-logs/#{lettings_log.id}/duplicate-logs?original_log_id=#{lettings_log.id}")
expect(page).to have_link("Back to Log #{lettings_log.id}", href: "/lettings-logs/#{lettings_log.id}")
expect(page).to have_css(".govuk-notification-banner.govuk-notification-banner--success")
@ -521,7 +521,7 @@ RSpec.describe "Lettings Log Features" do
it "allows deduplicating logs by changing the answers on the original log" do
click_link("Change", href: "/lettings-logs/#{lettings_log.id}/tenant-code?first_remaining_duplicate_id=#{duplicate_log.id}&original_log_id=#{lettings_log.id}&referrer=duplicate_logs")
fill_in("lettings-log-tenancycode-field", with: "something else")
click_button("Save and continue")
click_button("Save changes")
expect(page).to have_current_path("/lettings-logs/#{duplicate_log.id}/duplicate-logs?original_log_id=#{lettings_log.id}")
expect(page).to have_link("Back to Log #{lettings_log.id}", href: "/lettings-logs/#{lettings_log.id}")
expect(page).to have_css(".govuk-notification-banner.govuk-notification-banner--success")

6
spec/features/sales_log_spec.rb

@ -34,7 +34,7 @@ RSpec.describe "Sales Log Features" do
it "includes the purchaser code and sale completion date questions" do
click_button "Create a new sales log"
click_link "Set up this sales log"
fill_in("sales_log[saledate(1i)]", with: Time.zone.today.year)
fill_in("sales_log[saledate(i)]", with: Time.zone.today.year)
fill_in("sales_log[saledate(2i)]", with: Time.zone.today.month)
fill_in("sales_log[saledate(3i)]", with: Time.zone.today.day)
click_button "Save and continue"
@ -249,7 +249,7 @@ RSpec.describe "Sales Log Features" do
expect(page).to have_current_path("/sales-logs/#{sales_log.id}/duplicate-logs?original_log_id=#{sales_log.id}")
click_link("Change", href: "/sales-logs/#{duplicate_log.id}/purchaser-code?first_remaining_duplicate_id=#{sales_log.id}&original_log_id=#{sales_log.id}&referrer=duplicate_logs")
fill_in("sales-log-purchid-field", with: "something else")
click_button("Save and continue")
click_button("Save changes")
expect(page).to have_current_path("/sales-logs/#{sales_log.id}/duplicate-logs?original_log_id=#{sales_log.id}")
expect(page).to have_link("Back to Log #{sales_log.id}", href: "/sales-logs/#{sales_log.id}")
expect(page).to have_css(".govuk-notification-banner.govuk-notification-banner--success")
@ -260,7 +260,7 @@ RSpec.describe "Sales Log Features" do
it "allows deduplicating logs by changing the answers on the original log" do
click_link("Change", href: "/sales-logs/#{sales_log.id}/purchaser-code?first_remaining_duplicate_id=#{duplicate_log.id}&original_log_id=#{sales_log.id}&referrer=duplicate_logs")
fill_in("sales-log-purchid-field", with: "something else")
click_button("Save and continue")
click_button("Save changes")
expect(page).to have_current_path("/sales-logs/#{duplicate_log.id}/duplicate-logs?original_log_id=#{sales_log.id}")
expect(page).to have_link("Back to Log #{sales_log.id}", href: "/sales-logs/#{sales_log.id}")
expect(page).to have_css(".govuk-notification-banner.govuk-notification-banner--success")

1
spec/models/form/page_spec.rb

@ -1,3 +1,4 @@
require "rails_helper"
RSpec.describe Form::Page, type: :model do

Loading…
Cancel
Save