diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-20 14:18:08 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-20 14:18:08 +0300 |
commit | 5afcbe03ead9ada87621888a31a62652b10a7e4f (patch) | |
tree | 9918b67a0d0f0bafa6542e839a8be37adf73102d /spec/services/issues | |
parent | c97c0201564848c1f53226fe19d71fdcc472f7d0 (diff) |
Add latest changes from gitlab-org/gitlab@16-4-stable-eev16.4.0-rc42
Diffstat (limited to 'spec/services/issues')
-rw-r--r-- | spec/services/issues/close_service_spec.rb | 4 | ||||
-rw-r--r-- | spec/services/issues/create_service_spec.rb | 8 | ||||
-rw-r--r-- | spec/services/issues/export_csv_service_spec.rb | 32 | ||||
-rw-r--r-- | spec/services/issues/move_service_spec.rb | 3 | ||||
-rw-r--r-- | spec/services/issues/resolve_discussions_spec.rb | 26 | ||||
-rw-r--r-- | spec/services/issues/update_service_spec.rb | 13 |
6 files changed, 50 insertions, 36 deletions
diff --git a/spec/services/issues/close_service_spec.rb b/spec/services/issues/close_service_spec.rb index 47925236a74..dabbd4bfa84 100644 --- a/spec/services/issues/close_service_spec.rb +++ b/spec/services/issues/close_service_spec.rb @@ -321,7 +321,7 @@ RSpec.describe Issues::CloseService, feature_category: :team_planning do alert = create(:alert_management_alert, issue: issue, project: project) expect(SystemNoteService).to receive(:change_alert_status) - .with(alert, User.alert_bot, " because #{user.to_reference} closed incident #{issue.to_reference(project)}") + .with(alert, Users::Internal.alert_bot, " because #{user.to_reference} closed incident #{issue.to_reference(project)}") close_issue @@ -356,7 +356,7 @@ RSpec.describe Issues::CloseService, feature_category: :team_planning do alerts.each do |alert| expect(SystemNoteService).to receive(:change_alert_status) - .with(alert, User.alert_bot, " because #{user.to_reference} closed incident #{issue.to_reference(project)}") + .with(alert, Users::Internal.alert_bot, " because #{user.to_reference} closed incident #{issue.to_reference(project)}") end close_issue diff --git a/spec/services/issues/create_service_spec.rb b/spec/services/issues/create_service_spec.rb index 2daba8e359d..7cd2cd8f564 100644 --- a/spec/services/issues/create_service_spec.rb +++ b/spec/services/issues/create_service_spec.rb @@ -577,8 +577,10 @@ RSpec.describe Issues::CreateService, feature_category: :team_planning do context "when issuable feature is private" do before do - project.project_feature.update!(issues_access_level: ProjectFeature::PRIVATE, - merge_requests_access_level: ProjectFeature::PRIVATE) + project.project_feature.update!( + issues_access_level: ProjectFeature::PRIVATE, + merge_requests_access_level: ProjectFeature::PRIVATE + ) end levels = [Gitlab::VisibilityLevel::INTERNAL, Gitlab::VisibilityLevel::PUBLIC] @@ -680,7 +682,7 @@ RSpec.describe Issues::CreateService, feature_category: :team_planning do end context 'with alert bot author' do - let_it_be(:user) { User.alert_bot } + let_it_be(:user) { Users::Internal.alert_bot } let_it_be(:label) { create(:label, project: project) } let(:opts) do diff --git a/spec/services/issues/export_csv_service_spec.rb b/spec/services/issues/export_csv_service_spec.rb index 1ac64c0301d..31eaa72255d 100644 --- a/spec/services/issues/export_csv_service_spec.rb +++ b/spec/services/issues/export_csv_service_spec.rb @@ -43,18 +43,20 @@ RSpec.describe Issues::ExportCsvService, :with_license, feature_category: :team_ # so create these first. issue.timelogs.create!(time_spent: 360, user: user) issue.timelogs.create!(time_spent: 200, user: user) - issue.update!(milestone: milestone, - assignees: [user], - description: 'Issue with details', - state: :opened, - due_date: DateTime.new(2014, 3, 2), - created_at: DateTime.new(2015, 4, 3, 2, 1, 0), - updated_at: DateTime.new(2016, 5, 4, 3, 2, 1), - closed_at: DateTime.new(2017, 6, 5, 4, 3, 2), - weight: 4, - discussion_locked: true, - labels: [feature_label, idea_label], - time_estimate: 72000) + issue.update!( + milestone: milestone, + assignees: [user], + description: 'Issue with details', + state: :opened, + due_date: DateTime.new(2014, 3, 2), + created_at: DateTime.new(2015, 4, 3, 2, 1, 0), + updated_at: DateTime.new(2016, 5, 4, 3, 2, 1), + closed_at: DateTime.new(2017, 6, 5, 4, 3, 2), + weight: 4, + discussion_locked: true, + labels: [feature_label, idea_label], + time_estimate: 72000 + ) end shared_examples 'exports CSVs for issues' do @@ -158,9 +160,9 @@ RSpec.describe Issues::ExportCsvService, :with_license, feature_category: :team_ context 'with issues filtered by labels and project' do subject do described_class.new( - IssuesFinder.new(user, - project_id: project.id, - label_name: %w(Idea Feature)).execute, project) + IssuesFinder.new(user, project_id: project.id, label_name: %w(Idea Feature)).execute, + project + ) end it 'returns only filtered objects' do diff --git a/spec/services/issues/move_service_spec.rb b/spec/services/issues/move_service_spec.rb index 12924df3200..55f912fb703 100644 --- a/spec/services/issues/move_service_spec.rb +++ b/spec/services/issues/move_service_spec.rb @@ -390,8 +390,7 @@ RSpec.describe Issues::MoveService, feature_category: :team_planning do let(:moved_to_issue) { create(:issue) } let(:old_issue) do - create(:issue, project: old_project, author: author, - moved_to: moved_to_issue) + create(:issue, project: old_project, author: author, moved_to: moved_to_issue) end it { expect { move }.to raise_error(StandardError, /permissions/) } diff --git a/spec/services/issues/resolve_discussions_spec.rb b/spec/services/issues/resolve_discussions_spec.rb index c2111bffdda..ea4ad0440ec 100644 --- a/spec/services/issues/resolve_discussions_spec.rb +++ b/spec/services/issues/resolve_discussions_spec.rb @@ -60,10 +60,14 @@ RSpec.describe Issues::ResolveDiscussions, feature_category: :team_planning do end it "contains all discussions when only a merge request is passed" do - second_discussion = Discussion.new([create(:diff_note_on_merge_request, - noteable: merge_request, - project: merge_request.target_project, - line_number: 15)]) + second_discussion = Discussion.new([ + create( + :diff_note_on_merge_request, + noteable: merge_request, + project: merge_request.target_project, + line_number: 15 + ) + ]) service = DummyService.new( container: project, current_user: user, @@ -77,11 +81,15 @@ RSpec.describe Issues::ResolveDiscussions, feature_category: :team_planning do end it "contains only unresolved discussions" do - _second_discussion = Discussion.new([create(:diff_note_on_merge_request, :resolved, - noteable: merge_request, - project: merge_request.target_project, - line_number: 15 - )]) + _second_discussion = Discussion.new([ + create( + :diff_note_on_merge_request, + :resolved, + noteable: merge_request, + project: merge_request.target_project, + line_number: 15 + ) + ]) service = DummyService.new( container: project, current_user: user, diff --git a/spec/services/issues/update_service_spec.rb b/spec/services/issues/update_service_spec.rb index c677dc0315c..eb9fe2b4ed7 100644 --- a/spec/services/issues/update_service_spec.rb +++ b/spec/services/issues/update_service_spec.rb @@ -15,11 +15,14 @@ RSpec.describe Issues::UpdateService, :mailer, feature_category: :team_planning let_it_be(:milestone) { create(:milestone, project: project) } let(:issue) do - create(:issue, title: 'Old title', - description: "for #{user2.to_reference}", - assignee_ids: [user3.id], - project: project, - author: create(:user)) + create( + :issue, + title: 'Old title', + description: "for #{user2.to_reference}", + assignee_ids: [user3.id], + project: project, + author: create(:user) + ) end before_all do |