|
|
|
@ -48,7 +48,7 @@ RSpec.describe OrganisationsController, type: :request do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
fdescribe "#delete-confirmation" do |
|
|
|
describe "#delete-confirmation" do |
|
|
|
let(:organisation) { create(:organisation) } |
|
|
|
let(:organisation) { create(:organisation) } |
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
before do |
|
|
|
@ -61,6 +61,20 @@ RSpec.describe OrganisationsController, type: :request do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe "#delete" do |
|
|
|
|
|
|
|
let(:organisation) { create(:organisation) } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
delete "/organisations/#{organisation.id}/delete" |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when not signed in" do |
|
|
|
|
|
|
|
it "redirects to the sign in page" do |
|
|
|
|
|
|
|
expect(response).to redirect_to("/account/sign-in") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when user is signed in" do |
|
|
|
context "when user is signed in" do |
|
|
|
@ -762,7 +776,7 @@ RSpec.describe OrganisationsController, type: :request do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
fdescribe "#delete-confirmation" do |
|
|
|
describe "#delete-confirmation" do |
|
|
|
let(:organisation) { user.organisation } |
|
|
|
let(:organisation) { user.organisation } |
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
before do |
|
|
|
@ -777,6 +791,22 @@ RSpec.describe OrganisationsController, type: :request do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe "#delete" do |
|
|
|
|
|
|
|
let(:organisation) { user.organisation } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
delete "/organisations/#{organisation.id}/delete" |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "with a data provider user" do |
|
|
|
|
|
|
|
let(:user) { create(:user) } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "returns 401 unauthorized" do |
|
|
|
|
|
|
|
expect(response).to have_http_status(:unauthorized) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "with a data provider user" do |
|
|
|
context "with a data provider user" do |
|
|
|
@ -907,7 +937,7 @@ RSpec.describe OrganisationsController, type: :request do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
fdescribe "#delete-confirmation" do |
|
|
|
describe "#delete-confirmation" do |
|
|
|
let(:organisation) { user.organisation } |
|
|
|
let(:organisation) { user.organisation } |
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
before do |
|
|
|
@ -922,6 +952,22 @@ RSpec.describe OrganisationsController, type: :request do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe "#delete" do |
|
|
|
|
|
|
|
let(:organisation) { user.organisation } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
delete "/organisations/#{organisation.id}/delete" |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "with a data provider user" do |
|
|
|
|
|
|
|
let(:user) { create(:user) } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "returns 401 unauthorized" do |
|
|
|
|
|
|
|
expect(response).to have_http_status(:unauthorized) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "with a support user" do |
|
|
|
context "with a support user" do |
|
|
|
@ -1627,7 +1673,7 @@ RSpec.describe OrganisationsController, type: :request do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
fdescribe "#delete-confirmation" do |
|
|
|
describe "#delete-confirmation" do |
|
|
|
let(:organisation) { create(:organisation) } |
|
|
|
let(:organisation) { create(:organisation) } |
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
before do |
|
|
|
@ -1662,6 +1708,33 @@ RSpec.describe OrganisationsController, type: :request do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe "#delete" do |
|
|
|
|
|
|
|
let(:organisation) { create(:organisation) } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
delete "/organisations/#{organisation.id}/delete" |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "deletes the organisation" do |
|
|
|
|
|
|
|
organisation.reload |
|
|
|
|
|
|
|
expect(organisation.status).to eq(:deleted) |
|
|
|
|
|
|
|
expect(organisation.discarded_at).not_to be nil |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "redirects to the organisations list and displays a notice that the organisation has been deleted" do |
|
|
|
|
|
|
|
expect(response).to redirect_to organisations_path |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
|
|
|
|
expect(page).to have_selector(".govuk-notification-banner--success") |
|
|
|
|
|
|
|
expect(page).to have_selector(".govuk-notification-banner--success", text: "#{organisation.name} has been deleted.") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "does not display the deleted organisation" do |
|
|
|
|
|
|
|
expect(response).to redirect_to organisations_path |
|
|
|
|
|
|
|
follow_redirect! |
|
|
|
|
|
|
|
expect(page).not_to have_content("Organisation to delete") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when they view the lettings logs tab" do |
|
|
|
context "when they view the lettings logs tab" do |
|
|
|
let(:tenancycode) { "42" } |
|
|
|
let(:tenancycode) { "42" } |
|
|
|
|
|
|
|
|
|
|
|
|