docbrown/spec/requests/admin/gdpr_delete_requests_spec.rb
Ridhwana 6f880ee5b6
Update the Sidebar to include the Member Manager (#17538)
* feat: update all the paths as a first order of business

* feat: update all the folders to no longer appear under users

* feat: update specs

* feat: update specs

* feat: remove User namespace

* feat: remove route namespace

* feat: path change

* feat: move the menu items to the sidebar

* feat: add a badge

* feat: remove tabs partial

* xs font

* feat: update describe blocks

* feat: update cypress tests

* chore: oops member_manager instead of member_management

* feat: c-indicator

* feat: update the tests

* feat: update the gdpr test

* feat: add the invitations

* chore: align

* feat: update the GDPR constant

* feat: rename to GDPR actions

* feat: add member manager route
2022-05-05 12:46:47 +02:00

47 lines
1.4 KiB
Ruby

require "rails_helper"
RSpec.describe "/admin/member_manager/gdpr_delete_requests", type: :request do
let(:admin) { create(:user, :super_admin) }
before do
sign_in(admin)
end
context "with gdpr request" do
let!(:gdr) { create(:gdpr_delete_request, email: "user@dev.to") }
it "renders successfully" do
get admin_gdpr_delete_requests_path
expect(response).to be_successful
end
it "displays the gdpr delete requests" do
get admin_gdpr_delete_requests_path
expect(response.body).to include("user@dev.to")
end
it "displays the number of existing requests" do
get admin_gdpr_delete_requests_path
expect(response.body).to include("<span class=\"c-indicator c-indicator--info fs-xs\">1</span>")
end
it "destroys the gdpr delete request on confirmation" do
expect do
delete admin_gdpr_delete_request_path(gdr.id)
end.to change(GDPRDeleteRequest, :count).by(-1)
end
it "creates a corresponding audit_log on confirmation" do
expect do
delete admin_gdpr_delete_request_path(gdr.id)
end.to change(AuditLog, :count).by(1)
end
end
context "without gdpr request" do
it "doesn't display the number of existing requests" do
get admin_gdpr_delete_requests_path
expect(response.body).not_to include("<span class=\"c-indicator c-indicator--info fs-xs\">0</span>")
end
end
end