Browse Source
# Context - https://digital.dclg.gov.uk/jira/browse/CLDC-2195 - to allow users to continue their journey after completing logs adding a CTA link on completed logs # Changes - when a completed bulk uploaded log shown link back to logs for that bulk upload - if all those logs are completed interstitial is shown which links back to all logs - when a completed lettings or sales log show, link back to lettings or sales logs index # Screenshots ![Screenshot 2023-05-10 at 13 34 32](https://github.com/communitiesuk/submit-social-housing-lettings-and-sales-data/assets/92580/0eecbe4a-1ffd-4de8-8493-9754fd7de0b5)pull/1630/head
Phil Lee
2 years ago
committed by
GitHub
6 changed files with 102 additions and 3 deletions
@ -0,0 +1,71 @@ |
|||||||
|
require "rails_helper" |
||||||
|
|
||||||
|
RSpec.describe "logs/edit.html.erb" do |
||||||
|
before do |
||||||
|
assign(:log, log) |
||||||
|
end |
||||||
|
|
||||||
|
context "when log is in progress" do |
||||||
|
let(:log) { create(:lettings_log, :in_progress) } |
||||||
|
|
||||||
|
it "there is no link back to log type root" do |
||||||
|
render |
||||||
|
|
||||||
|
fragment = Capybara::Node::Simple.new(rendered) |
||||||
|
|
||||||
|
expect(fragment).not_to have_link(text: "Back to lettings logs", href: "/lettings-logs") |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
context "when log is completed" do |
||||||
|
context "when showing a lettings log" do |
||||||
|
let(:log) { create(:lettings_log, :completed) } |
||||||
|
|
||||||
|
it "has link 'Back to lettings logs'" do |
||||||
|
render |
||||||
|
|
||||||
|
fragment = Capybara::Node::Simple.new(rendered) |
||||||
|
|
||||||
|
expect(fragment).to have_link(text: "Back to lettings logs", href: "/lettings-logs") |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
context "when showing a sales log" do |
||||||
|
let(:log) { create(:sales_log, :completed) } |
||||||
|
|
||||||
|
it "has link 'Back to sales logs'" do |
||||||
|
render |
||||||
|
|
||||||
|
fragment = Capybara::Node::Simple.new(rendered) |
||||||
|
|
||||||
|
expect(fragment).to have_link(text: "Back to sales logs", href: "/sales-logs") |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
context "when lettings log is bulk uploaded" do |
||||||
|
let(:bulk_upload) { create(:bulk_upload, :lettings) } |
||||||
|
let(:log) { create(:lettings_log, :completed, bulk_upload:) } |
||||||
|
|
||||||
|
it "has link 'Back to uploaded logs'" do |
||||||
|
render |
||||||
|
|
||||||
|
fragment = Capybara::Node::Simple.new(rendered) |
||||||
|
|
||||||
|
expect(fragment).to have_link(text: "Back to uploaded logs", href: "/lettings-logs/bulk-upload-results/#{bulk_upload.id}/resume") |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
context "when sales log is bulk uploaded" do |
||||||
|
let(:bulk_upload) { create(:bulk_upload, :sales) } |
||||||
|
let(:log) { create(:sales_log, :completed, bulk_upload:) } |
||||||
|
|
||||||
|
it "has link 'Back to uploaded logs'" do |
||||||
|
render |
||||||
|
|
||||||
|
fragment = Capybara::Node::Simple.new(rendered) |
||||||
|
|
||||||
|
expect(fragment).to have_link(text: "Back to uploaded logs", href: "/sales-logs/bulk-upload-results/#{bulk_upload.id}/resume") |
||||||
|
end |
||||||
|
end |
||||||
|
end |
||||||
|
end |
Loading…
Reference in new issue