DEV: group mentions related specs into context (#21434)

This commit is contained in:
Andrei Prigorshnev
2023-05-08 21:18:11 +04:00
committed by GitHub
parent 22521d3428
commit c45fff9405

View File

@ -136,6 +136,7 @@ describe Chat::MessageCreator do
expect(events.map { _1[:event_name] }).to include(:chat_message_created)
end
context "with mentions" do
it "creates mentions and mention notifications for public chat" do
message =
described_class.create(
@ -293,7 +294,9 @@ describe Chat::MessageCreator do
user: user1,
content: "hello there @#{user_group.name}",
)
}.to change { user2.chat_mentions.count }.by(1).and change { user3.chat_mentions.count }.by(1)
}.to change { user2.chat_mentions.count }.by(1).and change { user3.chat_mentions.count }.by(
1,
)
end
it "creates a mention notifications only for group users that are participating in private chat" do
@ -366,6 +369,7 @@ describe Chat::MessageCreator do
mention = user2.chat_mentions.where(chat_message: message).first
expect(mention.notification).to be_nil
end
end
context "when ignore_channel_wide_mention is enabled" do
before { user2.user_option.update(ignore_channel_wide_mention: true) }