0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 00:54:21 +08:00
discourse/spec/system/pm_user_removal_spec.rb
2025-11-26 16:10:02 -03:00

63 lines
1.6 KiB
Ruby
Vendored

# frozen_string_literal: true
describe "PM user removal", type: :system do
fab!(:current_user, :admin)
fab!(:other_user, :user)
let(:topic_page) { PageObjects::Pages::Topic.new }
let(:dialog) { PageObjects::Components::Dialog.new }
before { sign_in(current_user) }
it "removes a user from the PM list" do
pm =
create_post(
user: current_user,
target_usernames: [other_user.username],
archetype: Archetype.private_message,
).topic
topic_page.visit_topic(pm)
find(".user[data-id='#{other_user.id}'] .remove-invited").click
expect(page).to have_selector(
".small-action-contents",
text: "Removed @#{other_user.username} just now",
)
end
it "removes yourself from the PM list" do
pm =
create_post(
user: current_user,
target_usernames: [other_user.username],
archetype: Archetype.private_message,
).topic
topic_page.visit_topic(pm)
find(".user[data-id='#{current_user.id}'] .remove-invited").click
dialog.click_yes
expect(page).to have_current_path("/u/#{current_user.username}/messages")
end
it "removes a group from the PM list" do
group =
Fabricate(:group, messageable_level: Group::ALIAS_LEVELS[:everyone]).tap do |g|
g.add(other_user)
end
pm =
create_post(
user: current_user,
target_group_names: [group.name],
archetype: Archetype.private_message,
).topic
topic_page.visit_topic(pm)
find(".group[data-id='#{group.id}'] .remove-invited").click
expect(page).to have_selector(".small-action-contents", text: "Removed @#{group.name} just now")
end
end