diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 14:10:13 +0300 |
commit | 0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch) | |
tree | 7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /spec/support/shared_contexts/finders | |
parent | 72123183a20411a36d607d70b12d57c484394c8e (diff) |
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'spec/support/shared_contexts/finders')
-rw-r--r-- | spec/support/shared_contexts/finders/issues_finder_shared_contexts.rb | 26 | ||||
-rw-r--r-- | spec/support/shared_contexts/finders/work_items_finder_shared_contexts.rb | 79 |
2 files changed, 93 insertions, 12 deletions
diff --git a/spec/support/shared_contexts/finders/issues_finder_shared_contexts.rb b/spec/support/shared_contexts/finders/issues_finder_shared_contexts.rb index d9cbea58406..afb3976e3b8 100644 --- a/spec/support/shared_contexts/finders/issues_finder_shared_contexts.rb +++ b/spec/support/shared_contexts/finders/issues_finder_shared_contexts.rb @@ -12,7 +12,7 @@ RSpec.shared_context 'IssuesFinder context' do let_it_be(:milestone) { create(:milestone, project: project1, releases: [release]) } let_it_be(:label) { create(:label, project: project2) } let_it_be(:label2) { create(:label, project: project2) } - let_it_be(:issue1, reload: true) do + let_it_be(:item1, reload: true) do create(:issue, author: user, assignees: [user], @@ -23,7 +23,7 @@ RSpec.shared_context 'IssuesFinder context' do updated_at: 1.week.ago) end - let_it_be(:issue2, reload: true) do + let_it_be(:item2, reload: true) do create(:issue, author: user, assignees: [user], @@ -33,7 +33,7 @@ RSpec.shared_context 'IssuesFinder context' do updated_at: 1.week.from_now) end - let_it_be(:issue3, reload: true) do + let_it_be(:item3, reload: true) do create(:issue, author: user2, assignees: [user2], @@ -44,8 +44,8 @@ RSpec.shared_context 'IssuesFinder context' do updated_at: 2.weeks.from_now) end - let_it_be(:issue4, reload: true) { create(:issue, project: project3) } - let_it_be(:issue5, reload: true) do + let_it_be(:item4, reload: true) { create(:issue, project: project3) } + let_it_be(:item5, reload: true) do create(:issue, author: user, assignees: [user], @@ -55,18 +55,20 @@ RSpec.shared_context 'IssuesFinder context' do updated_at: 3.days.ago) end - let_it_be(:award_emoji1) { create(:award_emoji, name: 'thumbsup', user: user, awardable: issue1) } - let_it_be(:award_emoji2) { create(:award_emoji, name: 'thumbsup', user: user2, awardable: issue2) } - let_it_be(:award_emoji3) { create(:award_emoji, name: 'thumbsdown', user: user, awardable: issue3) } + let_it_be(:award_emoji1) { create(:award_emoji, name: 'thumbsup', user: user, awardable: item1) } + let_it_be(:award_emoji2) { create(:award_emoji, name: 'thumbsup', user: user2, awardable: item2) } + let_it_be(:award_emoji3) { create(:award_emoji, name: 'thumbsdown', user: user, awardable: item3) } + + let(:items_model) { Issue } end RSpec.shared_context 'IssuesFinder#execute context' do - let!(:closed_issue) { create(:issue, author: user2, assignees: [user2], project: project2, state: 'closed') } - let!(:label_link) { create(:label_link, label: label, target: issue2) } - let!(:label_link2) { create(:label_link, label: label2, target: issue3) } + let!(:closed_item) { create(:issue, author: user2, assignees: [user2], project: project2, state: 'closed') } + let!(:label_link) { create(:label_link, label: label, target: item2) } + let!(:label_link2) { create(:label_link, label: label2, target: item3) } let(:search_user) { user } let(:params) { {} } - let(:issues) { described_class.new(search_user, params.reverse_merge(scope: scope, state: 'opened')).execute } + let(:items) { described_class.new(search_user, params.reverse_merge(scope: scope, state: 'opened')).execute } before_all do project1.add_maintainer(user) diff --git a/spec/support/shared_contexts/finders/work_items_finder_shared_contexts.rb b/spec/support/shared_contexts/finders/work_items_finder_shared_contexts.rb new file mode 100644 index 00000000000..8c5bc339db5 --- /dev/null +++ b/spec/support/shared_contexts/finders/work_items_finder_shared_contexts.rb @@ -0,0 +1,79 @@ +# frozen_string_literal: true + +RSpec.shared_context 'WorkItemsFinder context' do + let_it_be(:user) { create(:user) } + let_it_be(:user2) { create(:user) } + let_it_be(:group) { create(:group) } + let_it_be(:subgroup) { create(:group, parent: group) } + let_it_be(:project1, reload: true) { create(:project, group: group) } + let_it_be(:project2, reload: true) { create(:project) } + let_it_be(:project3, reload: true) { create(:project, group: subgroup) } + let_it_be(:release) { create(:release, project: project1, tag: 'v1.0.0') } + let_it_be(:milestone) { create(:milestone, project: project1, releases: [release]) } + let_it_be(:label) { create(:label, project: project2) } + let_it_be(:label2) { create(:label, project: project2) } + let_it_be(:item1, reload: true) do + create(:work_item, + author: user, + assignees: [user], + project: project1, + milestone: milestone, + title: 'gitlab', + created_at: 1.week.ago, + updated_at: 1.week.ago) + end + + let_it_be(:item2, reload: true) do + create(:work_item, + author: user, + assignees: [user], + project: project2, + description: 'gitlab', + created_at: 1.week.from_now, + updated_at: 1.week.from_now) + end + + let_it_be(:item3, reload: true) do + create(:work_item, + author: user2, + assignees: [user2], + project: project2, + title: 'tanuki', + description: 'tanuki', + created_at: 2.weeks.from_now, + updated_at: 2.weeks.from_now) + end + + let_it_be(:item4, reload: true) { create(:work_item, project: project3) } + let_it_be(:item5, reload: true) do + create(:work_item, + author: user, + assignees: [user], + project: project1, + title: 'wotnot', + created_at: 3.days.ago, + updated_at: 3.days.ago) + end + + let_it_be(:award_emoji1) { create(:award_emoji, name: 'thumbsup', user: user, awardable: item1) } + let_it_be(:award_emoji2) { create(:award_emoji, name: 'thumbsup', user: user2, awardable: item2) } + let_it_be(:award_emoji3) { create(:award_emoji, name: 'thumbsdown', user: user, awardable: item3) } + + let(:items_model) { WorkItem } +end + +RSpec.shared_context 'WorkItemsFinder#execute context' do + let!(:closed_item) { create(:work_item, author: user2, assignees: [user2], project: project2, state: 'closed') } + let!(:label_link) { create(:label_link, label: label, target: item2) } + let!(:label_link2) { create(:label_link, label: label2, target: item3) } + let(:search_user) { user } + let(:params) { {} } + let(:items) { described_class.new(search_user, params.reverse_merge(scope: scope, state: 'opened')).execute } + + before_all do + project1.add_maintainer(user) + project2.add_developer(user) + project2.add_developer(user2) + project3.add_developer(user) + end +end |