Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/shared_examples/models/mentionable_shared_examples.rb')
-rw-r--r--spec/support/shared_examples/models/mentionable_shared_examples.rb40
1 files changed, 36 insertions, 4 deletions
diff --git a/spec/support/shared_examples/models/mentionable_shared_examples.rb b/spec/support/shared_examples/models/mentionable_shared_examples.rb
index 04630484964..07c5f730e95 100644
--- a/spec/support/shared_examples/models/mentionable_shared_examples.rb
+++ b/spec/support/shared_examples/models/mentionable_shared_examples.rb
@@ -207,7 +207,7 @@ RSpec.shared_examples 'an editable mentionable' do
end
RSpec.shared_examples 'mentions in description' do |mentionable_type|
- describe 'when storing user mentions' do
+ shared_examples 'when storing user mentions' do
before do
mentionable.store_mentions!
end
@@ -238,10 +238,26 @@ RSpec.shared_examples 'mentions in description' do |mentionable_type|
end
end
end
+
+ context 'when store_mentions_without_subtransaction is enabled' do
+ before do
+ stub_feature_flags(store_mentions_without_subtransaction: true)
+ end
+
+ it_behaves_like 'when storing user mentions'
+ end
+
+ context 'when store_mentions_without_subtransaction is disabled' do
+ before do
+ stub_feature_flags(store_mentions_without_subtransaction: false)
+ end
+
+ it_behaves_like 'when storing user mentions'
+ end
end
RSpec.shared_examples 'mentions in notes' do |mentionable_type|
- context 'when mentionable notes contain mentions' do
+ shared_examples 'when mentionable notes contain mentions' do
let(:user) { create(:user) }
let(:user2) { create(:user) }
let(:group) { create(:group) }
@@ -261,6 +277,22 @@ RSpec.shared_examples 'mentions in notes' do |mentionable_type|
expect(mentionable.referenced_groups(user)).to eq [group]
end
end
+
+ context 'when store_mentions_without_subtransaction is enabled' do
+ before do
+ stub_feature_flags(store_mentions_without_subtransaction: true)
+ end
+
+ it_behaves_like 'when mentionable notes contain mentions'
+ end
+
+ context 'when store_mentions_without_subtransaction is disabled' do
+ before do
+ stub_feature_flags(store_mentions_without_subtransaction: false)
+ end
+
+ it_behaves_like 'when mentionable notes contain mentions'
+ end
end
RSpec.shared_examples 'load mentions from DB' do |mentionable_type|
@@ -278,7 +310,7 @@ RSpec.shared_examples 'load mentions from DB' do |mentionable_type|
context 'when stored user mention contains ids of inexistent records' do
before do
- user_mention = note.send(:model_user_mention)
+ user_mention = note.user_mentions.first
mention_ids = {
mentioned_users_ids: user_mention.mentioned_users_ids.to_a << non_existing_record_id,
mentioned_projects_ids: user_mention.mentioned_projects_ids.to_a << non_existing_record_id,
@@ -302,7 +334,7 @@ RSpec.shared_examples 'load mentions from DB' do |mentionable_type|
let(:group_member) { create(:group_member, user: create(:user), group: private_group) }
before do
- user_mention = note.send(:model_user_mention)
+ user_mention = note.user_mentions.first
mention_ids = {
mentioned_projects_ids: user_mention.mentioned_projects_ids.to_a << private_project.id,
mentioned_groups_ids: user_mention.mentioned_groups_ids.to_a << private_group.id