|
|
|
@ -126,6 +126,8 @@ RSpec.describe "Home Page Features" do
|
|
|
|
|
let(:user) { FactoryBot.create(:user, name: "Provider") } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
Timecop.freeze(Time.zone.local(2024, 1, 1)) |
|
|
|
|
Singleton.__init__(FormHandler) |
|
|
|
|
create_list(:lettings_log, 6, :in_progress, owning_organisation: user.organisation, created_by: user) |
|
|
|
|
create_list(:lettings_log, 2, :in_progress, owning_organisation: user.organisation) |
|
|
|
|
create_list(:lettings_log, 4, :completed, owning_organisation: user.organisation, created_by: user) |
|
|
|
@ -135,6 +137,11 @@ RSpec.describe "Home Page Features" do
|
|
|
|
|
visit(root_path) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
after do |
|
|
|
|
Timecop.return |
|
|
|
|
Singleton.__init__(FormHandler) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "displays the correct welcome text" do |
|
|
|
|
expect(page).to have_current_path("/") |
|
|
|
|
expect(page).to have_content("Welcome back, Provider") |
|
|
|
@ -151,19 +158,12 @@ RSpec.describe "Home Page Features" do
|
|
|
|
|
|
|
|
|
|
context "and it is not a crossover" do |
|
|
|
|
before do |
|
|
|
|
Timecop.freeze(Time.zone.local(2024, 1, 1)) |
|
|
|
|
Singleton.__init__(FormHandler) |
|
|
|
|
closed_period_in_progress_log = build(:lettings_log, :in_progress, owning_organisation: user.organisation, created_by: user, startdate: Time.zone.local(2022, 4, 1)) |
|
|
|
|
closed_period_in_progress_log.save!(validate: false) |
|
|
|
|
visit(root_path) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
after do |
|
|
|
|
Timecop.return |
|
|
|
|
Singleton.__init__(FormHandler) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
xit "displays correct data boxes, counts and links" do |
|
|
|
|
it "displays correct data boxes, counts and links" do |
|
|
|
|
data_boxes = page.find_all(class: "app-data-box-one-half") |
|
|
|
|
expect(data_boxes.count).to eq(2) |
|
|
|
|
expect(data_boxes[0].all("a").map(&:text)).to eq(["6", "Your lettings in progress", "View all lettings"]) |
|
|
|
@ -183,12 +183,7 @@ RSpec.describe "Home Page Features" do
|
|
|
|
|
visit(root_path) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
after do |
|
|
|
|
Timecop.return |
|
|
|
|
Singleton.__init__(FormHandler) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
xit "displays correct data boxes, counts and links" do |
|
|
|
|
it "displays correct data boxes, counts and links" do |
|
|
|
|
data_boxes = page.find_all(class: "app-data-box-one-half") |
|
|
|
|
|
|
|
|
|
expect(data_boxes.count).to eq(2) |
|
|
|
@ -205,7 +200,7 @@ RSpec.describe "Home Page Features" do
|
|
|
|
|
visit(root_path) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
xit "displays correct data boxes, counts and links" do |
|
|
|
|
it "displays correct data boxes, counts and links" do |
|
|
|
|
data_boxes = page.find_all(class: "app-data-box-one-half") |
|
|
|
|
expect(data_boxes.count).to eq(2) |
|
|
|
|
expect(data_boxes[0].all("a").map(&:text)).to eq(["6", "Your lettings in progress", "View all lettings"]) |
|
|
|
@ -218,6 +213,8 @@ RSpec.describe "Home Page Features" do
|
|
|
|
|
|
|
|
|
|
context "when the user is a data coordinator" do |
|
|
|
|
before do |
|
|
|
|
Timecop.freeze(Time.zone.local(2024, 3, 1)) |
|
|
|
|
Singleton.__init__(FormHandler) |
|
|
|
|
create_list(:lettings_log, 6, :in_progress, owning_organisation: user.organisation) |
|
|
|
|
create_list(:lettings_log, 2, :in_progress, owning_organisation: user.organisation, created_by: user) |
|
|
|
|
create_list(:lettings_log, 4, :completed, owning_organisation: user.organisation) |
|
|
|
@ -228,6 +225,11 @@ RSpec.describe "Home Page Features" do
|
|
|
|
|
visit(root_path) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
after do |
|
|
|
|
Timecop.return |
|
|
|
|
Singleton.__init__(FormHandler) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
let(:user) { FactoryBot.create(:user, :data_coordinator, name: "Coordinator") } |
|
|
|
|
|
|
|
|
|
it "displays the correct welcome text" do |
|
|
|
@ -244,7 +246,7 @@ RSpec.describe "Home Page Features" do
|
|
|
|
|
visit(root_path) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
xit "displays correct data boxes, counts and links" do |
|
|
|
|
it "displays correct data boxes, counts and links" do |
|
|
|
|
data_boxes = page.find_all(class: "app-data-box-one-third") |
|
|
|
|
expect(data_boxes.count).to eq(3) |
|
|
|
|
expect(data_boxes[0].all("a").map(&:text)).to eq(["8", "Lettings in progress", "View all lettings"]) |
|
|
|
@ -261,7 +263,7 @@ RSpec.describe "Home Page Features" do
|
|
|
|
|
visit(root_path) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
xit "displays correct data boxes, counts and links" do |
|
|
|
|
it "displays correct data boxes, counts and links" do |
|
|
|
|
data_boxes = page.find_all(class: "app-data-box-one-half") |
|
|
|
|
expect(data_boxes.count).to eq(2) |
|
|
|
|
expect(data_boxes[0].all("a").map(&:text)).to eq(["8", "Lettings in progress", "View all lettings"]) |
|
|
|
@ -280,6 +282,8 @@ RSpec.describe "Home Page Features" do
|
|
|
|
|
let(:otp) { "999111" } |
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
Timecop.freeze(Time.zone.local(2024, 3, 1)) |
|
|
|
|
Singleton.__init__(FormHandler) |
|
|
|
|
create_list(:lettings_log, 2, :in_progress) |
|
|
|
|
create_list(:lettings_log, 1, :completed) |
|
|
|
|
create_list(:lettings_log, 2, :not_started) |
|
|
|
@ -303,13 +307,18 @@ RSpec.describe "Home Page Features" do
|
|
|
|
|
visit(root_path) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
after do |
|
|
|
|
Timecop.return |
|
|
|
|
Singleton.__init__(FormHandler) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "displays the correct welcome text" do |
|
|
|
|
expect(page).to have_current_path("/") |
|
|
|
|
expect(page).to have_content("Welcome back, Support") |
|
|
|
|
expect(page).to have_content("Manage all data") |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
xit "displays correct data boxes, counts and links" do |
|
|
|
|
it "displays correct data boxes, counts and links" do |
|
|
|
|
data_boxes = page.find_all(class: "app-data-box-one-third") |
|
|
|
|
expect(data_boxes.count).to eq(3) |
|
|
|
|
expect(data_boxes[0].all("a").map(&:text)).to eq(["2", "Lettings in progress", "View all lettings"]) |
|
|
|
|