Browse Source

Return skipped tests (#2363)

* Uncomment skipped tests

* Update tests
pull/2398/head
kosiakkatrina 8 months ago committed by GitHub
parent
commit
16824ae622
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 45
      spec/features/home_page_spec.rb
  2. 23
      spec/requests/lettings_logs_controller_spec.rb
  3. 12
      spec/requests/locations_controller_spec.rb

45
spec/features/home_page_spec.rb

@ -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"])

23
spec/requests/lettings_logs_controller_spec.rb

@ -812,7 +812,7 @@ RSpec.describe LettingsLogsController, type: :request do
expect(page).to have_title("Lettings logs (#{logs.count} logs matching ‘#{postcode}’) (page 1 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
end
xit "has title with pagination details for page 2" do
it "has title with pagination details for page 2" do
get "/lettings-logs?search=#{logs[0].postcode_full}&page=2", headers:, params: {}
expect(page).to have_title("Lettings logs (#{logs.count} logs matching ‘#{postcode}’) (page 2 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
end
@ -969,7 +969,7 @@ RSpec.describe LettingsLogsController, type: :request do
end
end
xcontext "when on the second page" do
context "when on the second page" do
before do
get "/lettings-logs?page=2", headers:, params: {}
end
@ -1622,18 +1622,24 @@ RSpec.describe LettingsLogsController, type: :request do
let(:headers) { { "Accept" => "text/html" } }
let(:page) { Capybara::Node::Simple.new(response.body) }
let(:user) { create(:user, :support) }
let!(:lettings_log) do
create(:lettings_log, :completed)
end
let(:id) { lettings_log.id }
let(:delete_request) { delete "/lettings-logs/#{id}", headers: }
before do
Timecop.freeze(2024, 3, 1)
Singleton.__init__(FormHandler)
allow(user).to receive(:need_two_factor_authentication?).and_return(false)
sign_in user
end
after do
Timecop.return
Singleton.__init__(FormHandler)
end
context "when delete permitted" do
let!(:lettings_log) { create(:lettings_log, :completed) }
it "redirects to lettings logs and shows message" do
delete_request
expect(response).to redirect_to(lettings_logs_path)
@ -1641,7 +1647,7 @@ RSpec.describe LettingsLogsController, type: :request do
expect(page).to have_content("Log #{id} has been deleted.")
end
xit "marks the log as deleted" do
it "marks the log as deleted" do
expect { delete_request }.to change { lettings_log.reload.status }.from("completed").to("deleted")
end
end
@ -1649,6 +1655,10 @@ RSpec.describe LettingsLogsController, type: :request do
context "when log does not exist" do
let(:id) { -1 }
before do
create(:lettings_log, :completed)
end
it "returns 404" do
delete_request
expect(response).to have_http_status(:not_found)
@ -1657,6 +1667,7 @@ RSpec.describe LettingsLogsController, type: :request do
context "when user not authorised" do
let(:user) { create(:user) }
let(:lettings_log) { create(:lettings_log, :completed) }
it "returns 401" do
delete_request

12
spec/requests/locations_controller_spec.rb

@ -249,16 +249,16 @@ RSpec.describe LocationsController, type: :request do
get "/schemes/#{scheme.id}/locations?page=2"
end
xit "shows which schemes are being shown on the current page" do
it "shows which schemes are being shown on the current page" do
expect(CGI.unescape_html(response.body)).to match("Showing <b>21</b> to <b>25</b> of <b>#{locations.count}</b> locations")
end
xit "has correct page 2 of 2 title" do
it "has correct page 2 of 2 title" do
expected_title = CGI.escapeHTML("#{scheme.service_name} (page 2 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
expect(page).to have_title(expected_title)
end
xit "has pagination links" do
it "has pagination links" do
expect(page).to have_content("Previous")
expect(page).to have_link("Previous")
expect(page).not_to have_content("Next")
@ -377,16 +377,16 @@ RSpec.describe LocationsController, type: :request do
get "/schemes/#{scheme.id}/locations?page=2"
end
xit "shows which schemes are being shown on the current page" do
it "shows which schemes are being shown on the current page" do
expect(CGI.unescape_html(response.body)).to match("Showing <b>21</b> to <b>25</b> of <b>#{locations.count}</b> locations")
end
xit "has correct page 1 of 2 title" do
it "has correct page 1 of 2 title" do
expected_title = CGI.escapeHTML("#{scheme.service_name} (page 2 of 2) - Submit social housing lettings and sales data (CORE) - GOV.UK")
expect(page).to have_title(expected_title)
end
xit "has pagination links" do
it "has pagination links" do
expect(page).to have_content("Previous")
expect(page).to have_link("Previous")
expect(page).not_to have_content("Next")

Loading…
Cancel
Save