|
|
|
@ -1221,26 +1221,43 @@ RSpec.describe OrganisationsController, type: :request do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when they view the lettings logs tab" do |
|
|
|
|
|
|
|
let(:tenancycode) { "42" } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
create(:lettings_log, owning_organisation: organisation, tenancycode:) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when there is at least one log visible" do |
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
get lettings_logs_organisation_path(organisation, search: tenancycode) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when the user is a support user" do |
|
|
|
it "shows the delete logs button with the correct path" do |
|
|
|
let(:user) { create(:user, :support) } |
|
|
|
expect(page).to have_link "Delete logs", href: delete_lettings_logs_organisation_path(search: tenancycode) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
it "has CSV download buttons with the correct paths" do |
|
|
|
allow(user).to receive(:need_two_factor_authentication?).and_return(false) |
|
|
|
expect(page).to have_link "Download (CSV)", href: lettings_logs_csv_download_organisation_path(organisation, codes_only: false, search: tenancycode) |
|
|
|
sign_in user |
|
|
|
expect(page).to have_link "Download (CSV, codes only)", href: lettings_logs_csv_download_organisation_path(organisation, codes_only: true, search: tenancycode) |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when they view the lettings logs tab" do |
|
|
|
context "when there are no visible logs" do |
|
|
|
before do |
|
|
|
before do |
|
|
|
create(:lettings_log, owning_organisation: organisation) |
|
|
|
LettingsLog.destroy_all |
|
|
|
|
|
|
|
get lettings_logs_organisation_path(organisation) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "has CSV download buttons with the correct paths if at least 1 log exists" do |
|
|
|
it "does not show the delete logs button " do |
|
|
|
get "/organisations/#{organisation.id}/lettings-logs" |
|
|
|
expect(page).not_to have_link "Delete logs" |
|
|
|
expect(page).to have_link("Download (CSV)", href: "/organisations/#{organisation.id}/lettings-logs/csv-download?codes_only=false") |
|
|
|
end |
|
|
|
expect(page).to have_link("Download (CSV, codes only)", href: "/organisations/#{organisation.id}/lettings-logs/csv-download?codes_only=true") |
|
|
|
|
|
|
|
|
|
|
|
it "does not show the csv download buttons" do |
|
|
|
|
|
|
|
expect(page).not_to have_link "Download (CSV)" |
|
|
|
|
|
|
|
expect(page).not_to have_link "Download (CSV, codes only)" |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when you download the CSV" do |
|
|
|
context "when you download the CSV" do |
|
|
|
@ -1429,6 +1446,7 @@ RSpec.describe OrganisationsController, type: :request do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe "GET #data_sharing_agreement" do |
|
|
|
describe "GET #data_sharing_agreement" do |
|
|
|
context "when not signed in" do |
|
|
|
context "when not signed in" do |
|
|
|
|