Submit social housing lettings and sales data (CORE)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.9 KiB

CLDC-3116 Create homepage (#2113) * feat: add blank homepage, update routing and tests * feat: add welcome message and thoroughly test routing * refactor: lint * feat: update tests * CLDC-3076: Make example dates consistent (#2107) * CLDC-3076: Make example dates consistent * Use example date even when some hint text provided already * Temp remove some date restrictions * Update to 2 line breaks * Revert "Temp remove some date restrictions" This reverts commit cd7f18f9f10957be0cbabee7665c0abe4239acb6. * Fix lettings log accessor in date question (#2117) * Fix lettings log accessor in date question * Remove hardcoded date example from mrcdate question (#2118) --------- Co-authored-by: Rachael Booth <Rachael.Booth@softwire.com> * CLDC-3061 Add guidance page (#2121) * Add guidance page * Link to guidance from start page * feat: test home/start paths explicitly * CLDC-2253 Add collection resources (#2120) * Update collection resources, add to homepage * Add guidance link to an empty page * Update headings * Rebase fix * Update title * Update file names * Add section break * CLDC-2593 Add upcoming deadlines section (#2119) * Add upcoming deadlines section * Update the content to use the correct dates * Update content * lint * typos * CLDC-2252 Add homepage task section (#2115) * feat: wip add lettings, sales and schemes sections with correct text, counts, links and colouring * feat: add flex styling to match designs * CLDC-3076: Make example dates consistent (#2107) * CLDC-3076: Make example dates consistent * Use example date even when some hint text provided already * Temp remove some date restrictions * Update to 2 line breaks * Revert "Temp remove some date restrictions" This reverts commit cd7f18f9f10957be0cbabee7665c0abe4239acb6. * Fix lettings log accessor in date question (#2117) * Fix lettings log accessor in date question * Remove hardcoded date example from mrcdate question (#2118) --------- Co-authored-by: Rachael Booth <Rachael.Booth@softwire.com> * feat: update breakpoints for responsive layout changes * lint: use hash lookup where possible * lint: erblinting * feat: improve formatting * Reuse govuk grid * Revert "Reuse govuk grid" This reverts commit 8c71f5d9edf261802a8a86e07c13552f51283668. * feat: test home page data boxes * refactor: lint * refactor: lint * feat: test link behaviour is correct in all user scenarios * refactor: lint * feat: update tests * feat: combine task, resources, deadlines sections --------- Co-authored-by: Rachael Booth <Rachael.Booth@softwire.com> Co-authored-by: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Co-authored-by: Kat <kosiak.katrina@gmail.com> * CLDC-2255 Add homepage notifications (#2131) * feat: add notification table * feat: add notification banner, use unread gem for notification management * feat: add notifications page and remove unread_notification.rb * feat: add blank homepage, update routing and tests * feat: add welcome message and thoroughly test routing * refactor: lint * feat: update tests * CLDC-3061 Add guidance page (#2121) * Add guidance page * Link to guidance from start page * feat: test home/start paths explicitly * feat: add notification table * feat: add notification banner, use unread gem for notification management * feat: add notifications page and remove unread_notification.rb * feat: default p tag around sanitized page content * feat: add active scope * feat: use newest active unread/unauthenticated notification and update start page * feat: add tests of notification behaviour and routing and refactor * refactor: lint * feat: update Gemfile.lock * feat: add timestamps to readmark table * feat: update gemfile.lock * refactor: lint * feat: test notifications page doesn't show notifications and code simplification * feat: move notification helper methods to notifications_helper.rb --------- Co-authored-by: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> * feat: clear all no-status filters on in progress links * CLDC-2590 Add about this service section (#2124) * Add about core section * Move about core to the correct spot on start page * Update content * Add some margins --------- Co-authored-by: Rachael Booth <Rachael.Booth@softwire.com> Co-authored-by: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Co-authored-by: Kat <kosiak.katrina@gmail.com>
10 months ago
require "rails_helper"
RSpec.describe StartController, type: :request do
let(:user) { create(:user) }
let(:headers) { { "Accept" => "text/html" } }
let(:page) { Capybara::Node::Simple.new(response.body) }
let(:notify_client) { instance_double(Notifications::Client) }
let(:devise_notify_mailer) { DeviseNotifyMailer.new }
before do
allow(DeviseNotifyMailer).to receive(:new).and_return(devise_notify_mailer)
allow(devise_notify_mailer).to receive(:notify_client).and_return(notify_client)
allow(notify_client).to receive(:send_email).and_return(true)
end
describe "GET" do
context "when the user is not signed in" do
it "routes user to the start page" do
get "/", headers: headers, params: {}
expect(path).to eq("/")
expect(page).to have_content("Start now")
end
end
context "when the user is signed in" do
before do
sign_in user
end
it "routes user to the home page" do
get "/", headers:, params: {}
expect(page).to have_content("Welcome back")
end
context "and 2023 collection window is open for editing" do
before do
allow(Time).to receive(:now).and_return(Time.zone.local(2024, 1, 1))
end
it "displays correct resources for 2022/23 and 2023/24 collection years" do
get "/", headers: headers, params: {}
expect(page).to have_content("Lettings 2023/24")
expect(page).to have_content("Sales 2023/24")
end
end
context "and 2023 collection window is closed for editing" do
before do
allow(Time).to receive(:now).and_return(Time.zone.local(2025, 1, 1))
end
it "displays correct resources for 2022/23 and 2023/24 collection years" do
get "/", headers: headers, params: {}
expect(page).not_to have_content("Lettings 2023/24")
expect(page).not_to have_content("Sales 2023/24")
end
end
it "shows guidance link" do
get "/", headers: headers, params: {}
expect(page).to have_content("Guidance for submitting social housing lettings and sales data (CORE)")
end
it "displays About this service section" do
get "/", headers:, params: {}
expect(page).to have_content("About this service")
end
end
end
describe "guidance page" do
context "when the user is not signed in" do
it "routes user to the guidance page" do
get "/guidance", headers:, params: {}
expect(page).to have_content("Guidance for submitting social housing lettings and sales data")
end
end
context "when the user is signed in" do
before do
sign_in user
end
it "routes user to the guidance page" do
get "/guidance", headers:, params: {}
expect(page).to have_content("Guidance for submitting social housing lettings and sales data")
end
end
end
end