2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
RSpec.shared_context 'IssuesFinder context' do
|
2020-04-22 19:07:51 +05:30
|
|
|
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) }
|
2021-03-08 18:12:59 +05:30
|
|
|
let_it_be(:release) { create(:release, project: project1, tag: 'v1.0.0') }
|
|
|
|
let_it_be(:milestone) { create(:milestone, project: project1, releases: [release]) }
|
2020-04-22 19:07:51 +05:30
|
|
|
let_it_be(:label) { create(:label, project: project2) }
|
|
|
|
let_it_be(:label2) { create(:label, project: project2) }
|
2021-03-08 18:12:59 +05:30
|
|
|
let_it_be(:issue1, reload: true) do
|
|
|
|
create(:issue,
|
|
|
|
author: user,
|
|
|
|
assignees: [user],
|
|
|
|
project: project1,
|
|
|
|
milestone: milestone,
|
|
|
|
title: 'gitlab',
|
|
|
|
created_at: 1.week.ago,
|
|
|
|
updated_at: 1.week.ago)
|
|
|
|
end
|
|
|
|
|
|
|
|
let_it_be(:issue2, reload: true) do
|
|
|
|
create(:issue,
|
|
|
|
author: user,
|
|
|
|
assignees: [user],
|
|
|
|
project: project2,
|
|
|
|
description: 'gitlab',
|
|
|
|
created_at: 1.week.from_now,
|
|
|
|
updated_at: 1.week.from_now)
|
|
|
|
end
|
|
|
|
|
|
|
|
let_it_be(:issue3, reload: true) do
|
|
|
|
create(:issue,
|
|
|
|
author: user2,
|
|
|
|
assignees: [user2],
|
|
|
|
project: project2,
|
|
|
|
title: 'tanuki',
|
|
|
|
description: 'tanuki',
|
|
|
|
created_at: 2.weeks.from_now,
|
|
|
|
updated_at: 2.weeks.from_now)
|
|
|
|
end
|
|
|
|
|
2020-04-22 19:07:51 +05:30
|
|
|
let_it_be(:issue4, reload: true) { create(:issue, project: project3) }
|
2021-03-08 18:12:59 +05:30
|
|
|
let_it_be(:issue5, reload: true) do
|
|
|
|
create(:issue,
|
|
|
|
author: user,
|
|
|
|
assignees: [user],
|
|
|
|
project: project1,
|
|
|
|
title: 'wotnot',
|
|
|
|
created_at: 3.days.ago,
|
|
|
|
updated_at: 3.days.ago)
|
|
|
|
end
|
|
|
|
|
2020-04-22 19:07:51 +05:30
|
|
|
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) }
|
2019-07-07 11:18:12 +05:30
|
|
|
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) }
|
2019-12-04 20:38:33 +05:30
|
|
|
let!(:label_link2) { create(:label_link, label: label2, target: issue3) }
|
2019-07-07 11:18:12 +05:30
|
|
|
let(:search_user) { user }
|
|
|
|
let(:params) { {} }
|
|
|
|
let(:issues) { described_class.new(search_user, params.reverse_merge(scope: scope, state: 'opened')).execute }
|
|
|
|
|
2020-04-22 19:07:51 +05:30
|
|
|
before_all do
|
2019-07-07 11:18:12 +05:30
|
|
|
project1.add_maintainer(user)
|
|
|
|
project2.add_developer(user)
|
|
|
|
project2.add_developer(user2)
|
|
|
|
project3.add_developer(user)
|
|
|
|
end
|
|
|
|
end
|