diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-08 15:12:37 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-08 15:12:37 +0300 |
commit | 5f89187f0433fc84d8387de25220185235d61ed1 (patch) | |
tree | 4907c29350e094eea257a20f67b3427fdcdfaa2f /spec | |
parent | a130bdc4dd6f78e1605b79b77929c9315b322be3 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
94 files changed, 883 insertions, 342 deletions
diff --git a/spec/factories/users.rb b/spec/factories/users.rb index de2b5159fe7..8b42631040e 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -135,10 +135,6 @@ FactoryBot.define do end end - trait :no_super_sidebar do - use_new_navigation { false } - end - trait :two_factor_via_webauthn do transient { registrations_count { 5 } } diff --git a/spec/features/commit_spec.rb b/spec/features/commit_spec.rb index 61792ea5a58..739a070f423 100644 --- a/spec/features/commit_spec.rb +++ b/spec/features/commit_spec.rb @@ -66,12 +66,4 @@ RSpec.describe 'Commit', feature_category: :source_code_management do end it_behaves_like "single commit view" - - context "when super sidebar is enabled" do - before do - user.update!(use_new_navigation: true) - end - - it_behaves_like "single commit view" - end end diff --git a/spec/features/nav/new_nav_invite_members_spec.rb b/spec/features/nav/new_nav_invite_members_spec.rb index 4c37d6b4760..7501745ec55 100644 --- a/spec/features/nav/new_nav_invite_members_spec.rb +++ b/spec/features/nav/new_nav_invite_members_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe 'new navigation toggle', :js, feature_category: :navigation do include Features::InviteMembersModalHelpers - let_it_be(:user) { create(:user, use_new_navigation: true) } + let_it_be(:user) { create(:user) } before do sign_in(user) diff --git a/spec/features/nav/pinned_nav_items_spec.rb b/spec/features/nav/pinned_nav_items_spec.rb index b4d6464ec50..a2428048a1a 100644 --- a/spec/features/nav/pinned_nav_items_spec.rb +++ b/spec/features/nav/pinned_nav_items_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Navigation menu item pinning', :js, feature_category: :navigation do - let_it_be(:user) { create(:user, use_new_navigation: true) } + let_it_be(:user) { create(:user) } before do sign_in(user) diff --git a/spec/features/projects/compare_spec.rb b/spec/features/projects/compare_spec.rb index eff538513c1..ccf5c6996f1 100644 --- a/spec/features/projects/compare_spec.rb +++ b/spec/features/projects/compare_spec.rb @@ -185,13 +185,4 @@ RSpec.describe "Compare", :js, feature_category: :groups_and_projects do it_behaves_like "compare view of branches" it_behaves_like "compare view of tags" - - context "when super sidebar is enabled" do - before do - user.update!(use_new_navigation: true) - end - - it_behaves_like "compare view of branches" - it_behaves_like "compare view of tags" - end end diff --git a/spec/features/projects/new_project_spec.rb b/spec/features/projects/new_project_spec.rb index 753c3475e69..a3cbb86da2c 100644 --- a/spec/features/projects/new_project_spec.rb +++ b/spec/features/projects/new_project_spec.rb @@ -9,6 +9,28 @@ RSpec.describe 'New project', :js, feature_category: :groups_and_projects do stub_application_setting(import_sources: Gitlab::ImportSources.values) end + shared_examples 'shows correct navigation' do + context 'for a new top-level project' do + it 'shows the "Your work" navigation' do + visit new_project_path + expect(page).to have_selector(".super-sidebar", text: "Your work") + end + end + + context 'for a new group project' do + let_it_be(:parent_group) { create(:group) } + + before do + parent_group.add_owner(user) + end + + it 'shows the group sidebar of the parent group' do + visit new_project_path(namespace_id: parent_group.id) + expect(page).to have_selector(".super-sidebar", text: parent_group.name) + end + end + end + context 'as a user' do let_it_be(:user) { create(:user) } @@ -16,6 +38,8 @@ RSpec.describe 'New project', :js, feature_category: :groups_and_projects do sign_in(user) end + it_behaves_like 'shows correct navigation' + it 'shows the project description field when it should' do description_label = 'Project description (optional)' @@ -78,6 +102,8 @@ RSpec.describe 'New project', :js, feature_category: :groups_and_projects do context 'as an admin' do let(:user) { create(:admin) } + it_behaves_like 'shows correct navigation' + shared_examples '"New project" page' do before do sign_in(user) @@ -571,29 +597,4 @@ RSpec.describe 'New project', :js, feature_category: :groups_and_projects do it_behaves_like 'has instructions to enable OAuth' end end - - describe 'super-sidebar' do - let_it_be(:user) { create(:user) } - let_it_be(:parent_group) { create(:group) } - - before do - parent_group.add_owner(user) - user.update!(use_new_navigation: true) - sign_in(user) - end - - context 'for a new top-level project' do - it 'shows the "Your work" navigation' do - visit new_project_path - expect(page).to have_selector(".super-sidebar", text: "Your work") - end - end - - context 'for a new group project' do - it 'shows the group sidebar of the parent group' do - visit new_project_path(namespace_id: parent_group.id) - expect(page).to have_selector(".super-sidebar", text: parent_group.name) - end - end - end end diff --git a/spec/frontend/admin/abuse_report/components/abuse_report_app_spec.js b/spec/frontend/admin/abuse_report/components/abuse_report_app_spec.js index 4340699a7ed..73e3f1eb49a 100644 --- a/spec/frontend/admin/abuse_report/components/abuse_report_app_spec.js +++ b/spec/frontend/admin/abuse_report/components/abuse_report_app_spec.js @@ -7,12 +7,14 @@ import ReportDetails from '~/admin/abuse_report/components/report_details.vue'; import ReportedContent from '~/admin/abuse_report/components/reported_content.vue'; import ActivityEventsList from '~/admin/abuse_report/components/activity_events_list.vue'; import ActivityHistoryItem from '~/admin/abuse_report/components/activity_history_item.vue'; +import AbuseReportNotes from '~/admin/abuse_report/components/abuse_report_notes.vue'; + import { SUCCESS_ALERT } from '~/admin/abuse_report/constants'; import { mockAbuseReport } from '../mock_data'; describe('AbuseReportApp', () => { let wrapper; - + const mockAbuseReportId = mockAbuseReport.report.globalId; const { similarOpenReports } = mockAbuseReport.user; const findAlert = () => wrapper.findComponent(GlAlert); @@ -27,6 +29,7 @@ describe('AbuseReportApp', () => { const findActivityList = () => wrapper.findComponent(ActivityEventsList); const findActivityItem = () => wrapper.findByTestId('activity'); + const findActivityForSimilarReports = () => wrapper.findAllByTestId('activity-similar-open-reports'); const firstActivityForSimilarReports = () => @@ -34,6 +37,8 @@ describe('AbuseReportApp', () => { const findReportDetails = () => wrapper.findComponent(ReportDetails); + const findAbuseReportNotes = () => wrapper.findComponent(AbuseReportNotes); + const createComponent = (props = {}, provide = {}) => { wrapper = shallowMountExtended(AbuseReportApp, { propsData: { @@ -135,7 +140,7 @@ describe('AbuseReportApp', () => { it('renders ReportDetails', () => { createComponent({}, { glFeatures: { abuseReportLabels: true } }); - expect(findReportDetails().props('reportId')).toBe(mockAbuseReport.report.globalId); + expect(findReportDetails().props('reportId')).toBe(mockAbuseReportId); }); }); @@ -162,4 +167,25 @@ describe('AbuseReportApp', () => { expect(firstActivityForSimilarReports().props('report')).toBe(similarOpenReports[0]); }); }); + + describe('Notes', () => { + describe('when abuseReportNotes feature flag is enabled', () => { + it('renders abuse report notes', () => { + createComponent({}, { glFeatures: { abuseReportNotes: true } }); + + expect(findAbuseReportNotes().exists()).toBe(true); + expect(findAbuseReportNotes().props()).toMatchObject({ + abuseReportId: mockAbuseReportId, + }); + }); + }); + + describe('when abuseReportNotes feature flag is disabled', () => { + it('does not render ReportDetails', () => { + createComponent({}, { glFeatures: { abuseReportNotes: false } }); + + expect(findAbuseReportNotes().exists()).toBe(false); + }); + }); + }); }); diff --git a/spec/frontend/admin/abuse_report/components/abuse_report_notes_spec.js b/spec/frontend/admin/abuse_report/components/abuse_report_notes_spec.js new file mode 100644 index 00000000000..166c735ffbd --- /dev/null +++ b/spec/frontend/admin/abuse_report/components/abuse_report_notes_spec.js @@ -0,0 +1,98 @@ +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; +import VueApollo from 'vue-apollo'; +import createMockApollo from 'helpers/mock_apollo_helper'; +import waitForPromises from 'helpers/wait_for_promises'; +import { createAlert } from '~/alert'; +import SkeletonLoadingContainer from '~/vue_shared/components/notes/skeleton_note.vue'; +import abuseReportNotesQuery from '~/admin/abuse_report/graphql/notes/abuse_report_notes.query.graphql'; +import AbuseReportNotes from '~/admin/abuse_report/components/abuse_report_notes.vue'; +import AbuseReportDiscussion from '~/admin/abuse_report/components/notes/abuse_report_discussion.vue'; + +import { mockAbuseReport, mockNotesByIdResponse } from '../mock_data'; + +jest.mock('~/alert'); + +describe('Abuse Report Notes', () => { + let wrapper; + + Vue.use(VueApollo); + + const mockAbuseReportId = mockAbuseReport.report.globalId; + + const notesQueryHandler = jest.fn().mockResolvedValue(mockNotesByIdResponse); + + const findSkeletonLoaders = () => wrapper.findAllComponents(SkeletonLoadingContainer); + const findAbuseReportDiscussions = () => wrapper.findAllComponents(AbuseReportDiscussion); + + const createComponent = ({ + queryHandler = notesQueryHandler, + abuseReportId = mockAbuseReportId, + } = {}) => { + wrapper = shallowMount(AbuseReportNotes, { + apolloProvider: createMockApollo([[abuseReportNotesQuery, queryHandler]]), + propsData: { + abuseReportId, + }, + }); + }; + + describe('when notes are loading', () => { + beforeEach(() => { + createComponent(); + }); + + it('should show the skeleton loaders', () => { + expect(findSkeletonLoaders()).toHaveLength(5); + }); + }); + + describe('when notes have been loaded', () => { + beforeEach(() => { + createComponent(); + return waitForPromises(); + }); + + it('should not render skeleton loader', () => { + expect(findSkeletonLoaders()).toHaveLength(0); + }); + + it('should call the abuse report notes query', () => { + expect(notesQueryHandler).toHaveBeenCalledWith({ + id: mockAbuseReportId, + }); + }); + + it('should show notes to the length of the response', () => { + expect(findAbuseReportDiscussions()).toHaveLength(2); + + const discussions = mockNotesByIdResponse.data.abuseReport.discussions.nodes; + + expect(findAbuseReportDiscussions().at(0).props()).toMatchObject({ + abuseReportId: mockAbuseReportId, + discussion: discussions[0].notes.nodes, + }); + + expect(findAbuseReportDiscussions().at(1).props()).toMatchObject({ + abuseReportId: mockAbuseReportId, + discussion: discussions[1].notes.nodes, + }); + }); + }); + + describe('When there is an error fetching the notes', () => { + beforeEach(() => { + createComponent({ + queryHandler: jest.fn().mockRejectedValue(new Error()), + }); + + return waitForPromises(); + }); + + it('should show an error when query fails', () => { + expect(createAlert).toHaveBeenCalledWith({ + message: 'An error occurred while fetching comments, please try again.', + }); + }); + }); +}); diff --git a/spec/frontend/admin/abuse_report/components/notes/__snapshots__/abuse_report_note_body_spec.js.snap b/spec/frontend/admin/abuse_report/components/notes/__snapshots__/abuse_report_note_body_spec.js.snap new file mode 100644 index 00000000000..5651a2a3eab --- /dev/null +++ b/spec/frontend/admin/abuse_report/components/notes/__snapshots__/abuse_report_note_body_spec.js.snap @@ -0,0 +1,15 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Abuse Report Note Body should show the note body 1`] = ` +<div + class="md note-text" + data-testid="abuse-report-note-body" +> + <p + data-sourcepos="1:1-1:9" + dir="auto" + > + Comment 1 + </p> +</div> +`; diff --git a/spec/frontend/admin/abuse_report/components/notes/abuse_report_discussion_spec.js b/spec/frontend/admin/abuse_report/components/notes/abuse_report_discussion_spec.js new file mode 100644 index 00000000000..86f0939a938 --- /dev/null +++ b/spec/frontend/admin/abuse_report/components/notes/abuse_report_discussion_spec.js @@ -0,0 +1,79 @@ +import { shallowMount } from '@vue/test-utils'; +import { nextTick } from 'vue'; +import ToggleRepliesWidget from '~/notes/components/toggle_replies_widget.vue'; +import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item.vue'; +import AbuseReportDiscussion from '~/admin/abuse_report/components/notes/abuse_report_discussion.vue'; +import AbuseReportNote from '~/admin/abuse_report/components/notes/abuse_report_note.vue'; + +import { + mockAbuseReport, + mockDiscussionWithNoReplies, + mockDiscussionWithReplies, +} from '../../mock_data'; + +describe('Abuse Report Discussion', () => { + let wrapper; + const mockAbuseReportId = mockAbuseReport.report.globalId; + + const findAbuseReportNote = () => wrapper.findComponent(AbuseReportNote); + const findAbuseReportNotes = () => wrapper.findAllComponents(AbuseReportNote); + const findTimelineEntryItem = () => wrapper.findComponent(TimelineEntryItem); + const findToggleRepliesWidget = () => wrapper.findComponent(ToggleRepliesWidget); + + const createComponent = ({ + discussion = mockDiscussionWithNoReplies, + abuseReportId = mockAbuseReportId, + } = {}) => { + wrapper = shallowMount(AbuseReportDiscussion, { + propsData: { + discussion, + abuseReportId, + }, + }); + }; + + describe('Default', () => { + beforeEach(() => { + createComponent(); + }); + + it('should show the abuse report note', () => { + expect(findAbuseReportNote().exists()).toBe(true); + + expect(findAbuseReportNote().props()).toMatchObject({ + abuseReportId: mockAbuseReportId, + note: mockDiscussionWithNoReplies[0], + }); + }); + + it('should not show timeline entry item component', () => { + expect(findTimelineEntryItem().exists()).toBe(false); + }); + + it('should not show the the toggle replies widget wrapper when no replies', () => { + expect(findToggleRepliesWidget().exists()).toBe(false); + }); + }); + + describe('When the main comments has replies', () => { + beforeEach(() => { + createComponent({ + discussion: mockDiscussionWithReplies, + }); + }); + + it('should show the toggle replies widget', () => { + expect(findToggleRepliesWidget().exists()).toBe(true); + }); + + it('the number of replies should be equal to the response length', () => { + expect(findAbuseReportNotes()).toHaveLength(3); + }); + + it('should collapse when we click on toggle replies widget', async () => { + findToggleRepliesWidget().vm.$emit('toggle'); + await nextTick(); + expect(findAbuseReportNotes()).toHaveLength(1); + }); + }); +}); diff --git a/spec/frontend/admin/abuse_report/components/notes/abuse_report_note_body_spec.js b/spec/frontend/admin/abuse_report/components/notes/abuse_report_note_body_spec.js new file mode 100644 index 00000000000..25f675b4562 --- /dev/null +++ b/spec/frontend/admin/abuse_report/components/notes/abuse_report_note_body_spec.js @@ -0,0 +1,27 @@ +import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; +import AbuseReportNoteBody from '~/admin/abuse_report/components/notes/abuse_report_note_body.vue'; +import { mockDiscussionWithNoReplies } from '../../mock_data'; + +describe('Abuse Report Note Body', () => { + let wrapper; + const mockNote = mockDiscussionWithNoReplies[0]; + + const findNoteBody = () => wrapper.findByTestId('abuse-report-note-body'); + + const createComponent = ({ note = mockNote } = {}) => { + wrapper = shallowMountExtended(AbuseReportNoteBody, { + propsData: { + note, + }, + }); + }; + + beforeEach(() => { + createComponent(); + }); + + it('should show the note body', () => { + expect(findNoteBody().exists()).toBe(true); + expect(findNoteBody().html()).toMatchSnapshot(); + }); +}); diff --git a/spec/frontend/admin/abuse_report/components/notes/abuse_report_note_spec.js b/spec/frontend/admin/abuse_report/components/notes/abuse_report_note_spec.js new file mode 100644 index 00000000000..b6908853e46 --- /dev/null +++ b/spec/frontend/admin/abuse_report/components/notes/abuse_report_note_spec.js @@ -0,0 +1,80 @@ +import { shallowMount } from '@vue/test-utils'; +import { GlAvatarLink, GlAvatar } from '@gitlab/ui'; +import AbuseReportNote from '~/admin/abuse_report/components/notes/abuse_report_note.vue'; +import NoteHeader from '~/notes/components/note_header.vue'; +import NoteBody from '~/admin/abuse_report/components/notes/abuse_report_note_body.vue'; + +import { mockAbuseReport, mockDiscussionWithNoReplies } from '../../mock_data'; + +describe('Abuse Report Note', () => { + let wrapper; + const mockAbuseReportId = mockAbuseReport.report.globalId; + const mockNote = mockDiscussionWithNoReplies[0]; + + const findAvatar = () => wrapper.findComponent(GlAvatar); + const findAvatarLink = () => wrapper.findComponent(GlAvatarLink); + + const findNoteHeader = () => wrapper.findComponent(NoteHeader); + const findNoteBody = () => wrapper.findComponent(NoteBody); + + const createComponent = ({ note = mockNote, abuseReportId = mockAbuseReportId } = {}) => { + wrapper = shallowMount(AbuseReportNote, { + propsData: { + note, + abuseReportId, + }, + }); + }; + + beforeEach(() => { + createComponent(); + }); + + describe('Author', () => { + const { author } = mockNote; + + it('should show avatar', () => { + const avatar = findAvatar(); + + expect(avatar.exists()).toBe(true); + expect(avatar.props()).toMatchObject({ + src: author.avatarUrl, + entityName: author.username, + alt: author.name, + }); + }); + + it('should show avatar link with popover support', () => { + const avatarLink = findAvatarLink(); + + expect(avatarLink.exists()).toBe(true); + expect(avatarLink.classes()).toContain('js-user-link'); + expect(avatarLink.attributes()).toMatchObject({ + href: author.webUrl, + 'data-user-id': '1', + 'data-username': `${author.username}`, + }); + }); + }); + + describe('Header', () => { + it('should show note header', () => { + expect(findNoteHeader().exists()).toBe(true); + expect(findNoteHeader().props()).toMatchObject({ + author: mockNote.author, + createdAt: mockNote.createdAt, + noteId: mockNote.id, + noteUrl: mockNote.url, + }); + }); + }); + + describe('Body', () => { + it('should show note body', () => { + expect(findNoteBody().exists()).toBe(true); + expect(findNoteBody().props()).toMatchObject({ + note: mockNote, + }); + }); + }); +}); diff --git a/spec/frontend/admin/abuse_report/mock_data.js b/spec/frontend/admin/abuse_report/mock_data.js index c7faddf1d13..44c8cbdad7f 100644 --- a/spec/frontend/admin/abuse_report/mock_data.js +++ b/spec/frontend/admin/abuse_report/mock_data.js @@ -132,3 +132,211 @@ export const mockCreateLabelResponse = { }, }, }; + +export const mockDiscussionWithNoReplies = [ + { + id: 'gid://gitlab/Note/1', + body: 'Comment 1', + bodyHtml: '\u003cp data-sourcepos="1:1-1:9" dir="auto"\u003eComment 1\u003c/p\u003e', + createdAt: '2023-10-19T06:11:13Z', + lastEditedAt: '2023-10-20T02:46:50Z', + url: 'http://127.0.0.1:3000/admin/abuse_reports/1#note_1', + resolved: false, + author: { + id: 'gid://gitlab/User/1', + avatarUrl: + 'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon', + name: 'Administrator', + username: 'root', + webUrl: 'http://127.0.0.1:3000/root', + __typename: 'UserCore', + }, + lastEditedBy: null, + userPermissions: { + adminNote: true, + __typename: 'NotePermissions', + }, + discussion: { + id: 'gid://gitlab/Discussion/055af96ab917175219aec8739c911277b18ea41d', + notes: { + nodes: [ + { + id: 'gid://gitlab/Note/1', + __typename: 'Note', + }, + ], + __typename: 'NoteConnection', + }, + __typename: 'Discussion', + }, + __typename: 'Note', + }, +]; +export const mockDiscussionWithReplies = [ + { + id: 'gid://gitlab/DiscussionNote/2', + body: 'Comment 2', + bodyHtml: '\u003cp data-sourcepos="1:1-1:9" dir="auto"\u003eComment 2\u003c/p\u003e', + createdAt: '2023-10-20T07:47:21Z', + lastEditedAt: '2023-10-20T07:47:42Z', + url: 'http://127.0.0.1:3000/admin/abuse_reports/1#note_2', + resolved: false, + author: { + id: 'gid://gitlab/User/1', + avatarUrl: + 'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon', + name: 'Administrator', + username: 'root', + webUrl: 'http://127.0.0.1:3000/root', + __typename: 'UserCore', + }, + lastEditedBy: null, + userPermissions: { + adminNote: true, + __typename: 'NotePermissions', + }, + discussion: { + id: 'gid://gitlab/Discussion/9c7228e06fb0339a3d1440fcda960acfd8baa43a', + notes: { + nodes: [ + { + id: 'gid://gitlab/DiscussionNote/2', + __typename: 'Note', + }, + { + id: 'gid://gitlab/DiscussionNote/3', + __typename: 'Note', + }, + { + id: 'gid://gitlab/DiscussionNote/4', + __typename: 'Note', + }, + ], + __typename: 'NoteConnection', + }, + __typename: 'Discussion', + }, + __typename: 'Note', + }, + { + id: 'gid://gitlab/DiscussionNote/3', + body: 'Reply comment 1', + bodyHtml: '\u003cp data-sourcepos="1:1-1:15" dir="auto"\u003eReply comment 1\u003c/p\u003e', + createdAt: '2023-10-20T07:47:42Z', + lastEditedAt: '2023-10-20T07:47:42Z', + url: 'http://127.0.0.1:3000/admin/abuse_reports/1#note_3', + resolved: false, + author: { + id: 'gid://gitlab/User/1', + avatarUrl: + 'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon', + name: 'Administrator', + username: 'root', + webUrl: 'http://127.0.0.1:3000/root', + __typename: 'UserCore', + }, + lastEditedBy: null, + userPermissions: { + adminNote: true, + __typename: 'NotePermissions', + }, + discussion: { + id: 'gid://gitlab/Discussion/9c7228e06fb0339a3d1440fcda960acfd8baa43a', + notes: { + nodes: [ + { + id: 'gid://gitlab/DiscussionNote/2', + __typename: 'Note', + }, + { + id: 'gid://gitlab/DiscussionNote/3', + __typename: 'Note', + }, + { + id: 'gid://gitlab/DiscussionNote/4', + __typename: 'Note', + }, + ], + __typename: 'NoteConnection', + }, + __typename: 'Discussion', + }, + __typename: 'Note', + }, + { + id: 'gid://gitlab/DiscussionNote/4', + body: 'Reply comment 2', + bodyHtml: '\u003cp data-sourcepos="1:1-1:15" dir="auto"\u003eReply comment 2\u003c/p\u003e', + createdAt: '2023-10-20T08:26:51Z', + lastEditedAt: '2023-10-20T08:26:51Z', + url: 'http://127.0.0.1:3000/admin/abuse_reports/1#note_4', + resolved: false, + author: { + id: 'gid://gitlab/User/1', + avatarUrl: + 'https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon', + name: 'Administrator', + username: 'root', + webUrl: 'http://127.0.0.1:3000/root', + __typename: 'UserCore', + }, + lastEditedBy: null, + userPermissions: { + adminNote: true, + __typename: 'NotePermissions', + }, + discussion: { + id: 'gid://gitlab/Discussion/9c7228e06fb0339a3d1440fcda960acfd8baa43a', + notes: { + nodes: [ + { + id: 'gid://gitlab/DiscussionNote/2', + __typename: 'Note', + }, + { + id: 'gid://gitlab/DiscussionNote/3', + __typename: 'Note', + }, + { + id: 'gid://gitlab/DiscussionNote/4', + __typename: 'Note', + }, + ], + __typename: 'NoteConnection', + }, + __typename: 'Discussion', + }, + __typename: 'Note', + }, +]; + +export const mockNotesByIdResponse = { + data: { + abuseReport: { + id: 'gid://gitlab/AbuseReport/1', + discussions: { + nodes: [ + { + id: 'gid://gitlab/Discussion/055af96ab917175219aec8739c911277b18ea41d', + replyId: + 'gid://gitlab/IndividualNoteDiscussion/055af96ab917175219aec8739c911277b18ea41d', + notes: { + nodes: mockDiscussionWithNoReplies, + __typename: 'NoteConnection', + }, + }, + { + id: 'gid://gitlab/Discussion/9c7228e06fb0339a3d1440fcda960acfd8baa43a', + replyId: 'gid://gitlab/Discussion/9c7228e06fb0339a3d1440fcda960acfd8baa43a', + notes: { + nodes: mockDiscussionWithReplies, + __typename: 'NoteConnection', + }, + }, + ], + __typename: 'DiscussionConnection', + }, + __typename: 'AbuseReport', + }, + }, +}; diff --git a/spec/frontend/observability/client_spec.js b/spec/frontend/observability/client_spec.js index e33cfc5b4a4..66fbc0cdb77 100644 --- a/spec/frontend/observability/client_spec.js +++ b/spec/frontend/observability/client_spec.js @@ -3,6 +3,7 @@ import * as Sentry from '~/sentry/sentry_browser_wrapper'; import { buildClient } from '~/observability/client'; import axios from '~/lib/utils/axios_utils'; import { logError } from '~/lib/logger'; +import { DEFAULT_SORTING_OPTION, SORTING_OPTIONS } from '~/observability/constants'; jest.mock('~/lib/utils/axios_utils'); jest.mock('~/sentry/sentry_browser_wrapper'); @@ -27,6 +28,8 @@ describe('buildClient', () => { metricsUrl, }; + const getQueryParam = () => decodeURIComponent(axios.get.mock.calls[0][1].params.toString()); + beforeEach(() => { axiosMock = new MockAdapter(axios); jest.spyOn(axios, 'get'); @@ -173,7 +176,7 @@ describe('buildClient', () => { expect(axios.get).toHaveBeenCalledTimes(1); expect(axios.get).toHaveBeenCalledWith(tracingUrl, { withCredentials: true, - params: new URLSearchParams(), + params: expect.any(URLSearchParams), }); expect(result).toEqual(mockResponse); }); @@ -192,31 +195,54 @@ describe('buildClient', () => { expectErrorToBeReported(new Error(FETCHING_TRACES_ERROR)); }); - describe('query filter', () => { + describe('sort order', () => { beforeEach(() => { axiosMock.onGet(tracingUrl).reply(200, { traces: [], }); }); + it('appends sort param if specified', async () => { + await client.fetchTraces({ sortBy: SORTING_OPTIONS.DURATION_DESC }); + + expect(getQueryParam()).toBe(`sort=${SORTING_OPTIONS.DURATION_DESC}`); + }); + + it('defaults to DEFAULT_SORTING_OPTION if no sortBy param is specified', async () => { + await client.fetchTraces(); + + expect(getQueryParam()).toBe(`sort=${DEFAULT_SORTING_OPTION}`); + }); + + it('defaults to created_desc if sortBy param is not an accepted value', async () => { + await client.fetchTraces({ sortBy: 'foo-bar' }); + + expect(getQueryParam()).toBe(`sort=${SORTING_OPTIONS.CREATED_DESC}`); + }); + }); - const getQueryParam = () => decodeURIComponent(axios.get.mock.calls[0][1].params.toString()); + describe('query filter', () => { + beforeEach(() => { + axiosMock.onGet(tracingUrl).reply(200, { + traces: [], + }); + }); it('does not set any query param without filters', async () => { await client.fetchTraces(); - expect(getQueryParam()).toBe(''); + expect(getQueryParam()).toBe(`sort=${SORTING_OPTIONS.CREATED_DESC}`); }); it('appends page_token if specified', async () => { await client.fetchTraces({ pageToken: 'page-token' }); - expect(getQueryParam()).toBe('page_token=page-token'); + expect(getQueryParam()).toContain('page_token=page-token'); }); it('appends page_size if specified', async () => { await client.fetchTraces({ pageSize: 10 }); - expect(getQueryParam()).toBe('page_size=10'); + expect(getQueryParam()).toContain('page_size=10'); }); it('converts filter to proper query params', async () => { @@ -242,7 +268,7 @@ describe('buildClient', () => { attribute: [{ operator: '=', value: 'name1=value1' }], }, }); - expect(getQueryParam()).toBe( + expect(getQueryParam()).toContain( 'gt[duration_nano]=100000000<[duration_nano]=1000000000' + '&operation=op¬[operation]=not-op' + '&service_name=service¬[service_name]=not-service' + @@ -261,7 +287,7 @@ describe('buildClient', () => { ], }, }); - expect(getQueryParam()).toBe('operation=op&operation=op2'); + expect(getQueryParam()).toContain('operation=op&operation=op2'); }); it('ignores unsupported filters', async () => { @@ -271,7 +297,7 @@ describe('buildClient', () => { }, }); - expect(getQueryParam()).toBe(''); + expect(getQueryParam()).toBe(`sort=${SORTING_OPTIONS.CREATED_DESC}`); }); it('ignores empty filters', async () => { @@ -282,7 +308,7 @@ describe('buildClient', () => { }, }); - expect(getQueryParam()).toBe(''); + expect(getQueryParam()).toBe(`sort=${SORTING_OPTIONS.CREATED_DESC}`); }); it('ignores unsupported operators', async () => { @@ -309,7 +335,7 @@ describe('buildClient', () => { }, }); - expect(getQueryParam()).toBe(''); + expect(getQueryParam()).toBe(`sort=${SORTING_OPTIONS.CREATED_DESC}`); }); }); }); diff --git a/spec/frontend/observability/provisioned_observability_container_spec.js b/spec/frontend/observability/provisioned_observability_container_spec.js index b2aef36dbc9..a2e8b60dc9f 100644 --- a/spec/frontend/observability/provisioned_observability_container_spec.js +++ b/spec/frontend/observability/provisioned_observability_container_spec.js @@ -134,7 +134,9 @@ describe('ProvisionedObservabilityContainer', () => { expect(findLoadingIcon().exists()).toBe(false); expect(findEmptyState().exists()).toBe(false); expect(findSlotComponent().exists()).toBe(false); - expect(createAlert).toHaveBeenLastCalledWith({ message: 'Failed to load page.' }); + expect(createAlert).toHaveBeenLastCalledWith({ + message: 'Error: Failed to load page. Try reloading the page.', + }); }); it('shows an alert when checking if observability is enabled fails', async () => { @@ -147,7 +149,7 @@ describe('ProvisionedObservabilityContainer', () => { await waitForPromises(); expect(createAlert).toHaveBeenLastCalledWith({ - message: 'Failed to enable GitLab Observability.', + message: 'Error: Failed to enable GitLab Observability. Please retry later.', }); }); }); diff --git a/spec/services/award_emojis/copy_service_spec.rb b/spec/services/award_emojis/copy_service_spec.rb index 6c1d7fb21e2..81ec49d7741 100644 --- a/spec/services/award_emojis/copy_service_spec.rb +++ b/spec/services/award_emojis/copy_service_spec.rb @@ -25,7 +25,7 @@ RSpec.describe AwardEmojis::CopyService, feature_category: :team_planning do it 'copies AwardEmojis', :aggregate_failures do expect { execute_service }.to change { AwardEmoji.count }.by(2) - expect(to_awardable.award_emoji.map(&:name)).to match_array(%w(thumbsup thumbsdown)) + expect(to_awardable.award_emoji.map(&:name)).to match_array(%w[thumbsup thumbsdown]) end it 'returns success', :aggregate_failures do diff --git a/spec/services/bulk_imports/file_download_service_spec.rb b/spec/services/bulk_imports/file_download_service_spec.rb index 8b9304065de..b2971c75bce 100644 --- a/spec/services/bulk_imports/file_download_service_spec.rb +++ b/spec/services/bulk_imports/file_download_service_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' RSpec.describe BulkImports::FileDownloadService, feature_category: :importers do describe '#execute' do - let_it_be(:allowed_content_types) { %w(application/gzip application/octet-stream) } + let_it_be(:allowed_content_types) { %w[application/gzip application/octet-stream] } let_it_be(:file_size_limit) { 5.gigabytes } let_it_be(:config) { build(:bulk_import_configuration) } let_it_be(:content_type) { 'application/octet-stream' } diff --git a/spec/services/bulk_imports/lfs_objects_export_service_spec.rb b/spec/services/bulk_imports/lfs_objects_export_service_spec.rb index 587c99d9897..b65862b30d2 100644 --- a/spec/services/bulk_imports/lfs_objects_export_service_spec.rb +++ b/spec/services/bulk_imports/lfs_objects_export_service_spec.rb @@ -15,7 +15,7 @@ RSpec.describe BulkImports::LfsObjectsExportService, feature_category: :importer before do stub_lfs_object_storage - %w(wiki design).each do |repository_type| + %w[wiki design].each do |repository_type| create( :lfs_objects_project, project: project, diff --git a/spec/services/ci/create_pipeline_service/pre_post_stages_spec.rb b/spec/services/ci/create_pipeline_service/pre_post_stages_spec.rb index d935824e6cc..c0efb7cb639 100644 --- a/spec/services/ci/create_pipeline_service/pre_post_stages_spec.rb +++ b/spec/services/ci/create_pipeline_service/pre_post_stages_spec.rb @@ -39,9 +39,9 @@ RSpec.describe Ci::CreatePipelineService, :yaml_processor_feature_flag_corectnes it 'creates a pipeline' do expect(pipeline).to be_persisted expect(pipeline.stages.map(&:name)).to contain_exactly( - *%w(.pre build .post)) + *%w[.pre build .post]) expect(pipeline.builds.map(&:name)).to contain_exactly( - *%w(validate build notify)) + *%w[validate build notify]) end end @@ -54,7 +54,7 @@ RSpec.describe Ci::CreatePipelineService, :yaml_processor_feature_flag_corectnes # we can validate a list of stages, as they are assigned # but not persisted expect(pipeline.stages.map(&:name)).to contain_exactly( - *%w(.pre .post)) + *%w[.pre .post]) end end end diff --git a/spec/services/ci/create_pipeline_service/rules_spec.rb b/spec/services/ci/create_pipeline_service/rules_spec.rb index 05fa3cfeba3..fb448ab13dc 100644 --- a/spec/services/ci/create_pipeline_service/rules_spec.rb +++ b/spec/services/ci/create_pipeline_service/rules_spec.rb @@ -219,7 +219,7 @@ RSpec.describe Ci::CreatePipelineService, :yaml_processor_feature_flag_corectnes let(:job1) { pipeline.builds.find_by(name: 'job1') } let(:job2) { pipeline.builds.find_by(name: 'job2') } - let(:variable_keys) { %w(VAR1 VAR2 VAR3 VAR4 VAR5 VAR6 VAR7) } + let(:variable_keys) { %w[VAR1 VAR2 VAR3 VAR4 VAR5 VAR6 VAR7] } context 'when no match' do let(:ref) { 'refs/heads/wip' } diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb index 11f9708f9f3..19e55c22df8 100644 --- a/spec/services/ci/create_pipeline_service_spec.rb +++ b/spec/services/ci/create_pipeline_service_spec.rb @@ -1549,7 +1549,7 @@ RSpec.describe Ci::CreatePipelineService, :yaml_processor_feature_flag_corectnes stage: 'build', script: 'echo', only: { - variables: %w($CI) + variables: %w[$CI] } } } diff --git a/spec/services/ci/pipeline_processing/atomic_processing_service_spec.rb b/spec/services/ci/pipeline_processing/atomic_processing_service_spec.rb index 88ccda90df0..6e263e82432 100644 --- a/spec/services/ci/pipeline_processing/atomic_processing_service_spec.rb +++ b/spec/services/ci/pipeline_processing/atomic_processing_service_spec.rb @@ -139,7 +139,7 @@ RSpec.describe Ci::PipelineProcessing::AtomicProcessingService, feature_category fail_running_or_pending - expect(builds_statuses).to eq %w(failed pending) + expect(builds_statuses).to eq %w[failed pending] fail_running_or_pending @@ -166,22 +166,22 @@ RSpec.describe Ci::PipelineProcessing::AtomicProcessingService, feature_category succeed_running_or_pending - expect(builds_names).to eq %w(build test) - expect(builds_statuses).to eq %w(success pending) + expect(builds_names).to eq %w[build test] + expect(builds_statuses).to eq %w[success pending] succeed_running_or_pending - expect(builds_names).to eq %w(build test deploy production) - expect(builds_statuses).to eq %w(success success pending manual) + expect(builds_names).to eq %w[build test deploy production] + expect(builds_statuses).to eq %w[success success pending manual] succeed_running_or_pending - expect(builds_names).to eq %w(build test deploy production cleanup clear:cache) - expect(builds_statuses).to eq %w(success success success manual pending manual) + expect(builds_names).to eq %w[build test deploy production cleanup clear:cache] + expect(builds_statuses).to eq %w[success success success manual pending manual] succeed_running_or_pending - expect(builds_statuses).to eq %w(success success success manual success manual) + expect(builds_statuses).to eq %w[success success success manual success manual] expect(pipeline.reload.status).to eq 'success' end end @@ -194,22 +194,22 @@ RSpec.describe Ci::PipelineProcessing::AtomicProcessingService, feature_category succeed_running_or_pending - expect(builds_names).to eq %w(build test) - expect(builds_statuses).to eq %w(success pending) + expect(builds_names).to eq %w[build test] + expect(builds_statuses).to eq %w[success pending] fail_running_or_pending - expect(builds_names).to eq %w(build test test_failure) - expect(builds_statuses).to eq %w(success failed pending) + expect(builds_names).to eq %w[build test test_failure] + expect(builds_statuses).to eq %w[success failed pending] succeed_running_or_pending - expect(builds_names).to eq %w(build test test_failure cleanup) - expect(builds_statuses).to eq %w(success failed success pending) + expect(builds_names).to eq %w[build test test_failure cleanup] + expect(builds_statuses).to eq %w[success failed success pending] succeed_running_or_pending - expect(builds_statuses).to eq %w(success failed success success) + expect(builds_statuses).to eq %w[success failed success success] expect(pipeline.reload.status).to eq 'failed' end end @@ -222,23 +222,23 @@ RSpec.describe Ci::PipelineProcessing::AtomicProcessingService, feature_category succeed_running_or_pending - expect(builds_names).to eq %w(build test) - expect(builds_statuses).to eq %w(success pending) + expect(builds_names).to eq %w[build test] + expect(builds_statuses).to eq %w[success pending] fail_running_or_pending - expect(builds_names).to eq %w(build test test_failure) - expect(builds_statuses).to eq %w(success failed pending) + expect(builds_names).to eq %w[build test test_failure] + expect(builds_statuses).to eq %w[success failed pending] fail_running_or_pending - expect(builds_names).to eq %w(build test test_failure cleanup) - expect(builds_statuses).to eq %w(success failed failed pending) + expect(builds_names).to eq %w[build test test_failure cleanup] + expect(builds_statuses).to eq %w[success failed failed pending] succeed_running_or_pending - expect(builds_names).to eq %w(build test test_failure cleanup) - expect(builds_statuses).to eq %w(success failed failed success) + expect(builds_names).to eq %w[build test test_failure cleanup] + expect(builds_statuses).to eq %w[success failed failed success] expect(pipeline.reload.status).to eq('failed') end end @@ -251,22 +251,22 @@ RSpec.describe Ci::PipelineProcessing::AtomicProcessingService, feature_category succeed_running_or_pending - expect(builds_names).to eq %w(build test) - expect(builds_statuses).to eq %w(success pending) + expect(builds_names).to eq %w[build test] + expect(builds_statuses).to eq %w[success pending] succeed_running_or_pending - expect(builds_names).to eq %w(build test deploy production) - expect(builds_statuses).to eq %w(success success pending manual) + expect(builds_names).to eq %w[build test deploy production] + expect(builds_statuses).to eq %w[success success pending manual] fail_running_or_pending - expect(builds_names).to eq %w(build test deploy production cleanup) - expect(builds_statuses).to eq %w(success success failed manual pending) + expect(builds_names).to eq %w[build test deploy production cleanup] + expect(builds_statuses).to eq %w[success success failed manual pending] succeed_running_or_pending - expect(builds_statuses).to eq %w(success success failed manual success) + expect(builds_statuses).to eq %w[success success failed manual success] expect(pipeline.reload).to be_failed end end @@ -280,8 +280,8 @@ RSpec.describe Ci::PipelineProcessing::AtomicProcessingService, feature_category succeed_running_or_pending expect(builds.running_or_pending).not_to be_empty - expect(builds_names).to eq %w(build test) - expect(builds_statuses).to eq %w(success pending) + expect(builds_names).to eq %w[build test] + expect(builds_statuses).to eq %w[success pending] cancel_running_or_pending @@ -801,25 +801,25 @@ RSpec.describe Ci::PipelineProcessing::AtomicProcessingService, feature_category it 'when linux:* finishes first it runs it out of order' do expect(process_pipeline).to be_truthy - expect(stages).to eq(%w(pending created created)) + expect(stages).to eq(%w[pending created created]) expect(builds.pending).to contain_exactly(linux_build, mac_build) # we follow the single path of linux linux_build.reset.success! - expect(stages).to eq(%w(running pending created)) + expect(stages).to eq(%w[running pending created]) expect(builds.success).to contain_exactly(linux_build) expect(builds.pending).to contain_exactly(mac_build, linux_rspec, linux_rubocop) linux_rspec.reset.success! - expect(stages).to eq(%w(running running created)) + expect(stages).to eq(%w[running running created]) expect(builds.success).to contain_exactly(linux_build, linux_rspec) expect(builds.pending).to contain_exactly(mac_build, linux_rubocop) linux_rubocop.reset.success! - expect(stages).to eq(%w(running running created)) + expect(stages).to eq(%w[running running created]) expect(builds.success).to contain_exactly(linux_build, linux_rspec, linux_rubocop) expect(builds.pending).to contain_exactly(mac_build) @@ -827,7 +827,7 @@ RSpec.describe Ci::PipelineProcessing::AtomicProcessingService, feature_category mac_rspec.reset.success! mac_rubocop.reset.success! - expect(stages).to eq(%w(success success pending)) + expect(stages).to eq(%w[success success pending]) expect(builds.success).to contain_exactly( linux_build, linux_rspec, linux_rubocop, mac_build, mac_rspec, mac_rubocop) expect(builds.pending).to contain_exactly(deploy) @@ -866,13 +866,13 @@ RSpec.describe Ci::PipelineProcessing::AtomicProcessingService, feature_category it 'runs deploy_pages without waiting prior stages' do expect(process_pipeline).to be_truthy - expect(stages).to eq(%w(pending created pending)) + expect(stages).to eq(%w[pending created pending]) expect(builds.pending).to contain_exactly(linux_build, mac_build, deploy_pages) linux_build.reset.success! deploy_pages.reset.success! - expect(stages).to eq(%w(running pending running)) + expect(stages).to eq(%w[running pending running]) expect(builds.success).to contain_exactly(linux_build, deploy_pages) expect(builds.pending).to contain_exactly(mac_build, linux_rspec, linux_rubocop) @@ -882,7 +882,7 @@ RSpec.describe Ci::PipelineProcessing::AtomicProcessingService, feature_category mac_rspec.reset.success! mac_rubocop.reset.success! - expect(stages).to eq(%w(success success running)) + expect(stages).to eq(%w[success success running]) expect(builds.pending).to contain_exactly(deploy) end end @@ -900,12 +900,12 @@ RSpec.describe Ci::PipelineProcessing::AtomicProcessingService, feature_category it 'skips the jobs depending on it' do expect(process_pipeline).to be_truthy - expect(stages).to eq(%w(pending created created)) + expect(stages).to eq(%w[pending created created]) expect(all_builds.pending).to contain_exactly(linux_build) linux_build.reset.drop! - expect(stages).to eq(%w(failed skipped skipped)) + expect(stages).to eq(%w[failed skipped skipped]) expect(all_builds.failed).to contain_exactly(linux_build) expect(all_builds.skipped).to contain_exactly(linux_rspec, deploy) end @@ -922,7 +922,7 @@ RSpec.describe Ci::PipelineProcessing::AtomicProcessingService, feature_category it 'makes deploy DAG to be skipped' do expect(process_pipeline).to be_truthy - expect(stages).to eq(%w(skipped skipped)) + expect(stages).to eq(%w[skipped skipped]) expect(all_builds.manual).to contain_exactly(linux_build) expect(all_builds.skipped).to contain_exactly(deploy) end @@ -1460,7 +1460,7 @@ RSpec.describe Ci::PipelineProcessing::AtomicProcessingService, feature_category end def delayed_options - { when: 'delayed', options: { script: %w(echo), start_in: '1 minute' } } + { when: 'delayed', options: { script: %w[echo], start_in: '1 minute' } } end def unschedule diff --git a/spec/services/ci/register_job_service_spec.rb b/spec/services/ci/register_job_service_spec.rb index 83bae16a30e..e38984281b0 100644 --- a/spec/services/ci/register_job_service_spec.rb +++ b/spec/services/ci/register_job_service_spec.rb @@ -948,7 +948,7 @@ module Ci pending_job.create_queuing_entry! end - let(:runner) { create(:ci_runner, :instance, tag_list: %w(tag1 tag2)) } + let(:runner) { create(:ci_runner, :instance, tag_list: %w[tag1 tag2]) } let(:expected_shared_runner) { true } let(:expected_shard) { ::Gitlab::Ci::Queue::Metrics::DEFAULT_METRICS_SHARD } let(:expected_jobs_running_for_project_first_job) { '0' } @@ -957,14 +957,14 @@ module Ci it_behaves_like 'metrics collector' context 'when metrics_shard tag is defined' do - let(:runner) { create(:ci_runner, :instance, tag_list: %w(tag1 metrics_shard::shard_tag tag2)) } + let(:runner) { create(:ci_runner, :instance, tag_list: %w[tag1 metrics_shard::shard_tag tag2]) } let(:expected_shard) { 'shard_tag' } it_behaves_like 'metrics collector' end context 'when multiple metrics_shard tag is defined' do - let(:runner) { create(:ci_runner, :instance, tag_list: %w(tag1 metrics_shard::shard_tag metrics_shard::shard_tag_2 tag2)) } + let(:runner) { create(:ci_runner, :instance, tag_list: %w[tag1 metrics_shard::shard_tag metrics_shard::shard_tag_2 tag2]) } let(:expected_shard) { 'shard_tag' } it_behaves_like 'metrics collector' @@ -997,7 +997,7 @@ module Ci end context 'when project runner is used' do - let(:runner) { create(:ci_runner, :project, projects: [project], tag_list: %w(tag1 metrics_shard::shard_tag tag2)) } + let(:runner) { create(:ci_runner, :project, projects: [project], tag_list: %w[tag1 metrics_shard::shard_tag tag2]) } let(:expected_shared_runner) { false } let(:expected_shard) { ::Gitlab::Ci::Queue::Metrics::DEFAULT_METRICS_SHARD } let(:expected_jobs_running_for_project_first_job) { '+Inf' } diff --git a/spec/services/ci/retry_pipeline_service_spec.rb b/spec/services/ci/retry_pipeline_service_spec.rb index 6d991baafd0..125dbc5083c 100644 --- a/spec/services/ci/retry_pipeline_service_spec.rb +++ b/spec/services/ci/retry_pipeline_service_spec.rb @@ -122,7 +122,7 @@ RSpec.describe Ci::RetryPipelineService, '#execute', feature_category: :continuo expect(build('build')).to be_success expect(build('build2')).to be_success expect(build('test')).to be_pending - expect(build('test').needs.map(&:name)).to match_array(%w(build build2)) + expect(build('test').needs.map(&:name)).to match_array(%w[build build2]) end context 'when there is a failed DAG test without needs' do diff --git a/spec/services/ci/runners/register_runner_service_spec.rb b/spec/services/ci/runners/register_runner_service_spec.rb index b5921773364..4b997855657 100644 --- a/spec/services/ci/runners/register_runner_service_spec.rb +++ b/spec/services/ci/runners/register_runner_service_spec.rb @@ -74,7 +74,7 @@ RSpec.describe ::Ci::Runners::RegisterRunnerService, '#execute', feature_categor active: false, locked: true, run_untagged: false, - tag_list: %w(tag1 tag2), + tag_list: %w[tag1 tag2], access_level: 'ref_protected', maximum_timeout: 600, name: 'some name', @@ -290,7 +290,7 @@ RSpec.describe ::Ci::Runners::RegisterRunnerService, '#execute', feature_categor let(:token) { registration_token } let(:args) do - { tag_list: %w(tag1 tag2) } + { tag_list: %w[tag1 tag2] } end it 'creates runner with tags' do diff --git a/spec/services/ci/stuck_builds/drop_pending_service_spec.rb b/spec/services/ci/stuck_builds/drop_pending_service_spec.rb index 6d91f5098eb..9da63930057 100644 --- a/spec/services/ci/stuck_builds/drop_pending_service_spec.rb +++ b/spec/services/ci/stuck_builds/drop_pending_service_spec.rb @@ -139,7 +139,7 @@ RSpec.describe Ci::StuckBuilds::DropPendingService, feature_category: :runner_fl end end - %w(success skipped failed canceled).each do |status| + %w[success skipped failed canceled].each do |status| context "when job is #{status}" do let(:status) { status } let(:updated_at) { 2.days.ago } diff --git a/spec/services/ci/stuck_builds/drop_running_service_spec.rb b/spec/services/ci/stuck_builds/drop_running_service_spec.rb index deb807753c2..c2f8a643f24 100644 --- a/spec/services/ci/stuck_builds/drop_running_service_spec.rb +++ b/spec/services/ci/stuck_builds/drop_running_service_spec.rb @@ -51,7 +51,7 @@ RSpec.describe Ci::StuckBuilds::DropRunningService, feature_category: :runner_fl include_examples 'running builds' end - %w(success skipped failed canceled scheduled pending).each do |status| + %w[success skipped failed canceled scheduled pending].each do |status| context "when job is #{status}" do let(:status) { status } let(:updated_at) { 2.days.ago } diff --git a/spec/services/ci/stuck_builds/drop_scheduled_service_spec.rb b/spec/services/ci/stuck_builds/drop_scheduled_service_spec.rb index f2e658c3ae3..5560eaf9b40 100644 --- a/spec/services/ci/stuck_builds/drop_scheduled_service_spec.rb +++ b/spec/services/ci/stuck_builds/drop_scheduled_service_spec.rb @@ -23,7 +23,7 @@ RSpec.describe Ci::StuckBuilds::DropScheduledService, feature_category: :runner_ end end - %w(success skipped failed canceled running pending).each do |status| + %w[success skipped failed canceled running pending].each do |status| context "when job is #{status}" do before do job.update!(status: status) diff --git a/spec/services/clusters/kubernetes/create_or_update_service_account_service_spec.rb b/spec/services/clusters/kubernetes/create_or_update_service_account_service_spec.rb index e8e0174fe40..b5cf45e7b36 100644 --- a/spec/services/clusters/kubernetes/create_or_update_service_account_service_spec.rb +++ b/spec/services/clusters/kubernetes/create_or_update_service_account_service_spec.rb @@ -221,9 +221,9 @@ RSpec.describe Clusters::Kubernetes::CreateOrUpdateServiceAccountService, featur namespace: namespace }, rules: [{ - apiGroups: %w(serving.knative.dev), - resources: %w(configurations configurationgenerations routes revisions revisionuids autoscalers services), - verbs: %w(get list create update delete patch watch) + apiGroups: %w[serving.knative.dev], + resources: %w[configurations configurationgenerations routes revisions revisionuids autoscalers services], + verbs: %w[get list create update delete patch watch] }] ) ) @@ -239,9 +239,9 @@ RSpec.describe Clusters::Kubernetes::CreateOrUpdateServiceAccountService, featur namespace: namespace }, rules: [{ - apiGroups: %w(database.crossplane.io), - resources: %w(postgresqlinstances), - verbs: %w(get list create watch) + apiGroups: %w[database.crossplane.io], + resources: %w[postgresqlinstances], + verbs: %w[get list create watch] }] ) ) diff --git a/spec/services/deployments/update_environment_service_spec.rb b/spec/services/deployments/update_environment_service_spec.rb index 79bf0d972d4..bc6e244dc2f 100644 --- a/spec/services/deployments/update_environment_service_spec.rb +++ b/spec/services/deployments/update_environment_service_spec.rb @@ -145,7 +145,7 @@ RSpec.describe Deployments::UpdateEnvironmentService, feature_category: :continu an_instance_of(described_class::EnvironmentUpdateFailure), project_id: project.id, environment_id: environment.id, - reason: %q{External url javascript scheme is not allowed} + reason: %q(External url javascript scheme is not allowed) ) .once diff --git a/spec/services/design_management/copy_design_collection/copy_service_spec.rb b/spec/services/design_management/copy_design_collection/copy_service_spec.rb index 048327792e0..2f858e86cf1 100644 --- a/spec/services/design_management/copy_design_collection/copy_service_spec.rb +++ b/spec/services/design_management/copy_design_collection/copy_service_spec.rb @@ -267,7 +267,7 @@ RSpec.describe DesignManagement::CopyDesignCollection::CopyService, :clean_gitla let_it_be(:config_file) { Rails.root.join('lib/gitlab/design_management/copy_design_collection_model_attributes.yml') } let_it_be(:config) { YAML.load_file(config_file).symbolize_keys } - %w(Design Action Version).each do |model| + %w[Design Action Version].each do |model| specify do attributes = config["#{model.downcase}_attributes".to_sym] || [] ignored_attributes = config["ignore_#{model.downcase}_attributes".to_sym] diff --git a/spec/services/git/branch_push_service_spec.rb b/spec/services/git/branch_push_service_spec.rb index fe54663b983..db4f3ace64b 100644 --- a/spec/services/git/branch_push_service_spec.rb +++ b/spec/services/git/branch_push_service_spec.rb @@ -125,7 +125,7 @@ RSpec.describe Git::BranchPushService, :use_clean_rails_redis_caching, services: allow(Gitlab::Runtime).to receive(:sidekiq?).and_return(true) expect(Sidekiq.logger).to receive(:warn) do |args| pipeline_params = args[:pipeline_params] - expect(pipeline_params.keys).to match_array(%i(before after ref variables_attributes checkout_sha)) + expect(pipeline_params.keys).to match_array(%i[before after ref variables_attributes checkout_sha]) end expect { subject }.not_to change { Ci::Pipeline.count } diff --git a/spec/services/git/process_ref_changes_service_spec.rb b/spec/services/git/process_ref_changes_service_spec.rb index 9ec13bc957b..93d65b0b344 100644 --- a/spec/services/git/process_ref_changes_service_spec.rb +++ b/spec/services/git/process_ref_changes_service_spec.rb @@ -236,7 +236,7 @@ RSpec.describe Git::ProcessRefChangesService, feature_category: :source_code_man before do allow(MergeRequests::PushedBranchesService).to receive(:new).and_return( - double(execute: %w(create1 create2)), double(execute: %w(changed1)), double(execute: %w(removed2)) + double(execute: %w[create1 create2]), double(execute: %w[changed1]), double(execute: %w[removed2]) ) allow(Gitlab::Git::Commit).to receive(:between).and_return([]) diff --git a/spec/services/groups/update_statistics_service_spec.rb b/spec/services/groups/update_statistics_service_spec.rb index 6bab36eca89..39b9c1c234d 100644 --- a/spec/services/groups/update_statistics_service_spec.rb +++ b/spec/services/groups/update_statistics_service_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' RSpec.describe Groups::UpdateStatisticsService, feature_category: :groups_and_projects do let_it_be(:group, reload: true) { create(:group) } - let(:statistics) { %w(wiki_size) } + let(:statistics) { %w[wiki_size] } subject(:service) { described_class.new(group, statistics: statistics) } diff --git a/spec/services/import/gitlab_projects/create_project_service_spec.rb b/spec/services/import/gitlab_projects/create_project_service_spec.rb index a77e9bdfce1..3f5dc7a928f 100644 --- a/spec/services/import/gitlab_projects/create_project_service_spec.rb +++ b/spec/services/import/gitlab_projects/create_project_service_spec.rb @@ -144,9 +144,9 @@ RSpec.describe ::Import::GitlabProjects::CreateProjectService, :aggregate_failur ) expect(response.payload).to eq( other_errors: [ - %{Project namespace path can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'}, - %{Path can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'}, - %{Path must not start or end with a special character and must not contain consecutive special characters.} + %(Project namespace path can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'), + %(Path can contain only letters, digits, '_', '-' and '.'. Cannot start with '-', end in '.git' or end in '.atom'), + %(Path must not start or end with a special character and must not contain consecutive special characters.) ]) end end diff --git a/spec/services/issuable/process_assignees_spec.rb b/spec/services/issuable/process_assignees_spec.rb index fac7ef9ce77..5484f46e955 100644 --- a/spec/services/issuable/process_assignees_spec.rb +++ b/spec/services/issuable/process_assignees_spec.rb @@ -6,11 +6,11 @@ RSpec.describe Issuable::ProcessAssignees, feature_category: :team_planning do describe '#execute' do it 'returns assignee_ids when add_assignee_ids and remove_assignee_ids are not specified' do process = described_class.new( - assignee_ids: %w(5 7 9), + assignee_ids: %w[5 7 9], add_assignee_ids: nil, remove_assignee_ids: nil, - existing_assignee_ids: %w(1 3 9), - extra_assignee_ids: %w(2 5 12) + existing_assignee_ids: %w[1 3 9], + extra_assignee_ids: %w[2 5 12] ) result = process.execute @@ -22,8 +22,8 @@ RSpec.describe Issuable::ProcessAssignees, feature_category: :team_planning do assignee_ids: nil, add_assignee_ids: nil, remove_assignee_ids: nil, - existing_assignee_ids: %w(1 3 11), - extra_assignee_ids: %w(2 5 12) + existing_assignee_ids: %w[1 3 11], + extra_assignee_ids: %w[2 5 12] ) result = process.execute @@ -32,11 +32,11 @@ RSpec.describe Issuable::ProcessAssignees, feature_category: :team_planning do it 'combines other ids when both add_assignee_ids and remove_assignee_ids are not empty' do process = described_class.new( - assignee_ids: %w(5 7 9), - add_assignee_ids: %w(2 4 6), - remove_assignee_ids: %w(4 7 11), - existing_assignee_ids: %w(1 3 11), - extra_assignee_ids: %w(2 5 12) + assignee_ids: %w[5 7 9], + add_assignee_ids: %w[2 4 6], + remove_assignee_ids: %w[4 7 11], + existing_assignee_ids: %w[1 3 11], + extra_assignee_ids: %w[2 5 12] ) result = process.execute @@ -45,11 +45,11 @@ RSpec.describe Issuable::ProcessAssignees, feature_category: :team_planning do it 'combines other ids when remove_assignee_ids is not empty' do process = described_class.new( - assignee_ids: %w(5 7 9), + assignee_ids: %w[5 7 9], add_assignee_ids: nil, - remove_assignee_ids: %w(4 7 11), - existing_assignee_ids: %w(1 3 11), - extra_assignee_ids: %w(2 5 12) + remove_assignee_ids: %w[4 7 11], + existing_assignee_ids: %w[1 3 11], + extra_assignee_ids: %w[2 5 12] ) result = process.execute @@ -58,11 +58,11 @@ RSpec.describe Issuable::ProcessAssignees, feature_category: :team_planning do it 'combines other ids when add_assignee_ids is not empty' do process = described_class.new( - assignee_ids: %w(5 7 9), - add_assignee_ids: %w(2 4 6), + assignee_ids: %w[5 7 9], + add_assignee_ids: %w[2 4 6], remove_assignee_ids: nil, - existing_assignee_ids: %w(1 3 11), - extra_assignee_ids: %w(2 5 12) + existing_assignee_ids: %w[1 3 11], + extra_assignee_ids: %w[2 5 12] ) result = process.execute @@ -71,9 +71,9 @@ RSpec.describe Issuable::ProcessAssignees, feature_category: :team_planning do it 'combines ids when existing_assignee_ids and extra_assignee_ids are omitted' do process = described_class.new( - assignee_ids: %w(5 7 9), - add_assignee_ids: %w(2 4 6), - remove_assignee_ids: %w(4 7 11) + assignee_ids: %w[5 7 9], + add_assignee_ids: %w[2 4 6], + remove_assignee_ids: %w[4 7 11] ) result = process.execute @@ -82,11 +82,11 @@ RSpec.describe Issuable::ProcessAssignees, feature_category: :team_planning do it 'handles mixed string and integer arrays' do process = described_class.new( - assignee_ids: %w(5 7 9), + assignee_ids: %w[5 7 9], add_assignee_ids: [2, 4, 6], - remove_assignee_ids: %w(4 7 11), + remove_assignee_ids: %w[4 7 11], existing_assignee_ids: [1, 3, 11], - extra_assignee_ids: %w(2 5 12) + extra_assignee_ids: %w[2 5 12] ) result = process.execute diff --git a/spec/services/issues/export_csv_service_spec.rb b/spec/services/issues/export_csv_service_spec.rb index 31eaa72255d..83dfca923fb 100644 --- a/spec/services/issues/export_csv_service_spec.rb +++ b/spec/services/issues/export_csv_service_spec.rb @@ -160,7 +160,7 @@ 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, + IssuesFinder.new(user, project_id: project.id, label_name: %w[Idea Feature]).execute, project ) end diff --git a/spec/services/jira/requests/projects/list_service_spec.rb b/spec/services/jira/requests/projects/list_service_spec.rb index f9e3a3e8510..d8e6eda2dd4 100644 --- a/spec/services/jira/requests/projects/list_service_spec.rb +++ b/spec/services/jira/requests/projects/list_service_spec.rb @@ -73,7 +73,7 @@ RSpec.describe Jira::Requests::Projects::ListService, feature_category: :groups_ payload = subject.payload expect(subject.success?).to be_truthy - expect(payload[:projects].map(&:key)).to eq(%w(pr1 pr2)) + expect(payload[:projects].map(&:key)).to eq(%w[pr1 pr2]) expect(payload[:is_last]).to be_truthy end @@ -84,7 +84,7 @@ RSpec.describe Jira::Requests::Projects::ListService, feature_category: :groups_ payload = subject.payload expect(subject.success?).to be_truthy - expect(payload[:projects].map(&:key)).to eq(%w(pr1)) + expect(payload[:projects].map(&:key)).to eq(%w[pr1]) expect(payload[:is_last]).to be_truthy end end diff --git a/spec/services/lfs/file_transformer_spec.rb b/spec/services/lfs/file_transformer_spec.rb index c90d7af022f..398beabbeeb 100644 --- a/spec/services/lfs/file_transformer_spec.rb +++ b/spec/services/lfs/file_transformer_spec.rb @@ -218,7 +218,7 @@ RSpec.describe Lfs::FileTransformer, feature_category: :source_code_management d repository_types = project.lfs_objects_projects.order(:id).pluck(:repository_type) - expect(repository_types).to eq(%w(project wiki)) + expect(repository_types).to eq(%w[project wiki]) end end end diff --git a/spec/services/merge_requests/conflicts/resolve_service_spec.rb b/spec/services/merge_requests/conflicts/resolve_service_spec.rb index 002a07ff14e..a4245456367 100644 --- a/spec/services/merge_requests/conflicts/resolve_service_spec.rb +++ b/spec/services/merge_requests/conflicts/resolve_service_spec.rb @@ -72,8 +72,8 @@ RSpec.describe MergeRequests::Conflicts::ResolveService, feature_category: :code it 'creates a commit with the correct parents' do expect(merge_request.source_branch_head.parents.map(&:id)) - .to eq(%w(1450cd639e0bc6721eb02800169e464f212cde06 - 824be604a34828eb682305f0d963056cfac87b2d)) + .to eq(%w[1450cd639e0bc6721eb02800169e464f212cde06 + 824be604a34828eb682305f0d963056cfac87b2d]) end end @@ -169,8 +169,8 @@ RSpec.describe MergeRequests::Conflicts::ResolveService, feature_category: :code it 'creates a commit with the correct parents' do expect(merge_request.source_branch_head.parents.map(&:id)) - .to eq(%w(1450cd639e0bc6721eb02800169e464f212cde06 - 824be604a34828eb682305f0d963056cfac87b2d)) + .to eq(%w[1450cd639e0bc6721eb02800169e464f212cde06 + 824be604a34828eb682305f0d963056cfac87b2d]) end it 'sets the content to the content given' do diff --git a/spec/services/merge_requests/merge_service_spec.rb b/spec/services/merge_requests/merge_service_spec.rb index c108efb1a29..2e8f0049f28 100644 --- a/spec/services/merge_requests/merge_service_spec.rb +++ b/spec/services/merge_requests/merge_service_spec.rb @@ -569,7 +569,7 @@ RSpec.describe MergeRequests::MergeService, feature_category: :code_review_workf allow_any_instance_of(Repository).to receive(:ancestor?).and_return(nil) end - %w(semi-linear ff).each do |merge_method| + %w[semi-linear ff].each do |merge_method| it "logs and saves error if merge is #{merge_method} only" do merge_method = 'rebase_merge' if merge_method == 'semi-linear' merge_request.project.update!(merge_method: merge_method) diff --git a/spec/services/merge_requests/pushed_branches_service_spec.rb b/spec/services/merge_requests/pushed_branches_service_spec.rb index cb5d0a6bd25..de99fb244d3 100644 --- a/spec/services/merge_requests/pushed_branches_service_spec.rb +++ b/spec/services/merge_requests/pushed_branches_service_spec.rb @@ -8,7 +8,7 @@ RSpec.describe MergeRequests::PushedBranchesService, feature_category: :source_c context 'when branches pushed' do let(:pushed_branches) do - %w(branch1 branch2 closed-branch1 closed-branch2 extra1 extra2).map do |branch| + %w[branch1 branch2 closed-branch1 closed-branch2 extra1 extra2].map do |branch| { ref: "refs/heads/#{branch}" } end end @@ -31,7 +31,7 @@ RSpec.describe MergeRequests::PushedBranchesService, feature_category: :source_c context 'when tags pushed' do let(:pushed_branches) do - %w(v10.0.0 v11.0.2 v12.1.0).map do |branch| + %w[v10.0.0 v11.0.2 v12.1.0].map do |branch| { ref: "refs/tags/#{branch}" } end end diff --git a/spec/services/merge_requests/refresh_service_spec.rb b/spec/services/merge_requests/refresh_service_spec.rb index d5b7b56ccdd..dd50dfa49e0 100644 --- a/spec/services/merge_requests/refresh_service_spec.rb +++ b/spec/services/merge_requests/refresh_service_spec.rb @@ -915,7 +915,7 @@ RSpec.describe MergeRequests::RefreshService, feature_category: :code_review_wor context 'feature enabled' do it "updates merge requests' merge_commit and merged_commit values", :aggregate_failures do expect(Gitlab::BranchPushMergeCommitAnalyzer).to receive(:new).and_wrap_original do |original_method, commits| - expect(commits.map(&:id)).to eq(%w{646ece5cfed840eca0a4feb21bcd6a81bb19bda3 29284d9bcc350bcae005872d0be6edd016e2efb5 5f82584f0a907f3b30cfce5bb8df371454a90051 8a994512e8c8f0dfcf22bb16df6e876be7a61036 689600b91aabec706e657e38ea706ece1ee8268f db46a1c5a5e474aa169b6cdb7a522d891bc4c5f9}) + expect(commits.map(&:id)).to eq(%w[646ece5cfed840eca0a4feb21bcd6a81bb19bda3 29284d9bcc350bcae005872d0be6edd016e2efb5 5f82584f0a907f3b30cfce5bb8df371454a90051 8a994512e8c8f0dfcf22bb16df6e876be7a61036 689600b91aabec706e657e38ea706ece1ee8268f db46a1c5a5e474aa169b6cdb7a522d891bc4c5f9]) original_method.call(commits) end diff --git a/spec/services/packages/create_dependency_service_spec.rb b/spec/services/packages/create_dependency_service_spec.rb index 06a7a13bdd9..c50bf988899 100644 --- a/spec/services/packages/create_dependency_service_spec.rb +++ b/spec/services/packages/create_dependency_service_spec.rb @@ -33,8 +33,8 @@ RSpec.describe Packages::CreateDependencyService, feature_category: :package_reg expect { subject } .to change { Packages::Dependency.count }.by(1) .and change { Packages::DependencyLink.count }.by(1) - expect(dependency_names).to match_array(%w(express)) - expect(dependency_link_types).to match_array(%w(dependencies)) + expect(dependency_names).to match_array(%w[express]) + expect(dependency_link_types).to match_array(%w[dependencies]) end context 'with repeated packages' do @@ -49,8 +49,8 @@ RSpec.describe Packages::CreateDependencyService, feature_category: :package_reg expect { subject } .to change { Packages::Dependency.count }.by(4) .and change { Packages::DependencyLink.count }.by(6) - expect(dependency_names).to match_array(%w(d3 d3 d3 dagre-d3 dagre-d3 express)) - expect(dependency_link_types).to match_array(%w(bundleDependencies dependencies dependencies devDependencies devDependencies peerDependencies)) + expect(dependency_names).to match_array(%w[d3 d3 d3 dagre-d3 dagre-d3 express]) + expect(dependency_link_types).to match_array(%w[bundleDependencies dependencies dependencies devDependencies devDependencies peerDependencies]) end end @@ -72,8 +72,8 @@ RSpec.describe Packages::CreateDependencyService, feature_category: :package_reg expect { subject } .to change { Packages::Dependency.count }.by(1) .and change { Packages::DependencyLink.count }.by(1) - expect(dependency_names).to match_array(%w(express)) - expect(dependency_link_types).to match_array(%w(dependencies)) + expect(dependency_names).to match_array(%w[express]) + expect(dependency_link_types).to match_array(%w[dependencies]) end end @@ -105,8 +105,8 @@ RSpec.describe Packages::CreateDependencyService, feature_category: :package_reg expect { subject } .to change { Packages::Dependency.count }.by(1) .and change { Packages::DependencyLink.count }.by(1) - expect(dependency_names).to match_array(%w(express)) - expect(dependency_link_types).to match_array(%w(dependencies)) + expect(dependency_names).to match_array(%w[express]) + expect(dependency_link_types).to match_array(%w[dependencies]) end end end diff --git a/spec/services/packages/nuget/create_dependency_service_spec.rb b/spec/services/packages/nuget/create_dependency_service_spec.rb index 10daec8b871..7e14779cb92 100644 --- a/spec/services/packages/nuget/create_dependency_service_spec.rb +++ b/spec/services/packages/nuget/create_dependency_service_spec.rb @@ -41,12 +41,12 @@ RSpec.describe Packages::Nuget::CreateDependencyService, feature_category: :pack subject { service.execute } - it_behaves_like 'creating dependencies, links and nuget metadata for', %w(Castle.Core Moqi Newtonsoft.Json Test.Dependency), 4, 4 + it_behaves_like 'creating dependencies, links and nuget metadata for', %w[Castle.Core Moqi Newtonsoft.Json Test.Dependency], 4, 4 context 'with existing dependencies' do let_it_be(:exisiting_dependency) { create(:packages_dependency, name: 'Moqi', version_pattern: '2.5.6') } - it_behaves_like 'creating dependencies, links and nuget metadata for', %w(Castle.Core Moqi Newtonsoft.Json Test.Dependency), 3, 4 + it_behaves_like 'creating dependencies, links and nuget metadata for', %w[Castle.Core Moqi Newtonsoft.Json Test.Dependency], 3, 4 end context 'with dependencies with no target framework' do @@ -59,7 +59,7 @@ RSpec.describe Packages::Nuget::CreateDependencyService, feature_category: :pack ] end - it_behaves_like 'creating dependencies, links and nuget metadata for', %w(Castle.Core Moqi Newtonsoft.Json Test.Dependency), 4, 4 + it_behaves_like 'creating dependencies, links and nuget metadata for', %w[Castle.Core Moqi Newtonsoft.Json Test.Dependency], 4, 4 end context 'with empty dependencies' do diff --git a/spec/services/packages/nuget/update_package_from_metadata_service_spec.rb b/spec/services/packages/nuget/update_package_from_metadata_service_spec.rb index cb70176ee61..f80da0a9e61 100644 --- a/spec/services/packages/nuget/update_package_from_metadata_service_spec.rb +++ b/spec/services/packages/nuget/update_package_from_metadata_service_spec.rb @@ -127,7 +127,7 @@ RSpec.describe Packages::Nuget::UpdatePackageFromMetadataService, :clean_gitlab_ context 'with a nuspec file with metadata' do let(:nuspec_filepath) { 'packages/nuget/with_metadata.nuspec' } - let(:expected_tags) { %w(foo bar test tag1 tag2 tag3 tag4 tag5) } + let(:expected_tags) { %w[foo bar test tag1 tag2 tag3 tag4 tag5] } before do allow_next_instance_of(Packages::Nuget::MetadataExtractionService) do |service| diff --git a/spec/services/packages/update_tags_service_spec.rb b/spec/services/packages/update_tags_service_spec.rb index d8f572fff32..ec4d68ba5a0 100644 --- a/spec/services/packages/update_tags_service_spec.rb +++ b/spec/services/packages/update_tags_service_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' RSpec.describe Packages::UpdateTagsService, feature_category: :package_registry do let_it_be(:package, reload: true) { create(:nuget_package) } - let(:tags) { %w(test-tag tag1 tag2 tag3) } + let(:tags) { %w[test-tag tag1 tag2 tag3] } let(:service) { described_class.new(package, tags) } describe '#execute' do diff --git a/spec/services/pages_domains/obtain_lets_encrypt_certificate_service_spec.rb b/spec/services/pages_domains/obtain_lets_encrypt_certificate_service_spec.rb index 7f8992e8bbc..0e46391c0ad 100644 --- a/spec/services/pages_domains/obtain_lets_encrypt_certificate_service_spec.rb +++ b/spec/services/pages_domains/obtain_lets_encrypt_certificate_service_spec.rb @@ -65,7 +65,7 @@ RSpec.describe PagesDomains::ObtainLetsEncryptCertificateService, feature_catego end end - %w(pending processing).each do |status| + %w[pending processing].each do |status| context "there is an order in '#{status}' status" do let(:existing_order) do create(:pages_domain_acme_order, pages_domain: pages_domain) diff --git a/spec/services/product_analytics/build_graph_service_spec.rb b/spec/services/product_analytics/build_graph_service_spec.rb index 13c7206241c..a850d69e53c 100644 --- a/spec/services/product_analytics/build_graph_service_spec.rb +++ b/spec/services/product_analytics/build_graph_service_spec.rb @@ -21,7 +21,7 @@ RSpec.describe ProductAnalytics::BuildGraphService, feature_category: :product_a it 'returns a valid graph hash' do expect(subject[:id]).to eq(:platform) - expect(subject[:keys]).to eq(%w(app mobile web)) + expect(subject[:keys]).to eq(%w[app mobile web]) expect(subject[:values]).to eq([1, 1, 2]) end end diff --git a/spec/services/projects/branches_by_mode_service_spec.rb b/spec/services/projects/branches_by_mode_service_spec.rb index bfe76b34310..c87787346b9 100644 --- a/spec/services/projects/branches_by_mode_service_spec.rb +++ b/spec/services/projects/branches_by_mode_service_spec.rb @@ -50,7 +50,7 @@ RSpec.describe Projects::BranchesByModeService, feature_category: :source_code_m branches, prev_page, next_page = subject - expect(branches.map(&:name)).to match_array(%w(feature feature_conflict)) + expect(branches.map(&:name)).to match_array(%w[feature feature_conflict]) expect(next_page).to be_nil expect(prev_page).to be_nil end diff --git a/spec/services/projects/lfs_pointers/lfs_link_service_spec.rb b/spec/services/projects/lfs_pointers/lfs_link_service_spec.rb index fb3cc9bdac9..d3f053aaedc 100644 --- a/spec/services/projects/lfs_pointers/lfs_link_service_spec.rb +++ b/spec/services/projects/lfs_pointers/lfs_link_service_spec.rb @@ -73,10 +73,10 @@ RSpec.describe Projects::LfsPointers::LfsLinkService, feature_category: :source_ it 'only queries for the batch that will be processed', :aggregate_failures do stub_const("#{described_class}::BATCH_SIZE", 1) - oids = %w(one two) + oids = %w[one two] - expect(LfsObject).to receive(:for_oids).with(%w(one)).once.and_call_original - expect(LfsObject).to receive(:for_oids).with(%w(two)).once.and_call_original + expect(LfsObject).to receive(:for_oids).with(%w[one]).once.and_call_original + expect(LfsObject).to receive(:for_oids).with(%w[two]).once.and_call_original subject.execute(oids) end diff --git a/spec/services/projects/operations/update_service_spec.rb b/spec/services/projects/operations/update_service_spec.rb index 5f9b1a59bf9..03508a9732e 100644 --- a/spec/services/projects/operations/update_service_spec.rb +++ b/spec/services/projects/operations/update_service_spec.rb @@ -325,7 +325,7 @@ RSpec.describe Projects::Operations::UpdateService, feature_category: :groups_an expect(project_arg).to eq project expect(user_arg).to eq user expect(prometheus_attrs).to have_key('encrypted_properties') - expect(prometheus_attrs.keys).not_to include(*%w(id project_id created_at updated_at properties)) + expect(prometheus_attrs.keys).not_to include(*%w[id project_id created_at updated_at properties]) expect(prometheus_attrs['encrypted_properties']).not_to eq(prometheus_integration.encrypted_properties) end.and_call_original diff --git a/spec/services/projects/record_target_platforms_service_spec.rb b/spec/services/projects/record_target_platforms_service_spec.rb index bf87b763341..40ade386847 100644 --- a/spec/services/projects/record_target_platforms_service_spec.rb +++ b/spec/services/projects/record_target_platforms_service_spec.rb @@ -21,11 +21,11 @@ RSpec.describe Projects::RecordTargetPlatformsService, '#execute', feature_categ it 'creates a new setting record for the project', :aggregate_failures do expect { execute }.to change { ProjectSetting.count }.from(0).to(1) - expect(ProjectSetting.last.target_platforms).to match_array(%w(ios osx)) + expect(ProjectSetting.last.target_platforms).to match_array(%w[ios osx]) end it 'returns array of detected target platforms' do - expect(execute).to match_array %w(ios osx) + expect(execute).to match_array %w[ios osx] end context 'when a project has an existing setting record' do @@ -34,17 +34,17 @@ RSpec.describe Projects::RecordTargetPlatformsService, '#execute', feature_categ end context 'when target platforms changed' do - let(:saved_target_platforms) { %w(tvos) } + let(:saved_target_platforms) { %w[tvos] } it 'updates' do - expect { execute }.to change { project_setting.target_platforms }.from(%w(tvos)).to(%w(ios osx)) + expect { execute }.to change { project_setting.target_platforms }.from(%w[tvos]).to(%w[ios osx]) end - it { is_expected.to match_array %w(ios osx) } + it { is_expected.to match_array %w[ios osx] } end context 'when target platforms are the same' do - let(:saved_target_platforms) { %w(osx ios) } + let(:saved_target_platforms) { %w[osx ios] } it 'does not update' do expect { execute }.not_to change { project_setting.updated_at } diff --git a/spec/services/projects/update_statistics_service_spec.rb b/spec/services/projects/update_statistics_service_spec.rb index f6565853460..5311b8daeb1 100644 --- a/spec/services/projects/update_statistics_service_spec.rb +++ b/spec/services/projects/update_statistics_service_spec.rb @@ -6,7 +6,7 @@ RSpec.describe Projects::UpdateStatisticsService, feature_category: :groups_and_ using RSpec::Parameterized::TableSyntax let(:service) { described_class.new(project, nil, statistics: statistics) } - let(:statistics) { %w(repository_size) } + let(:statistics) { %w[repository_size] } describe '#execute' do context 'with a non-existing project' do @@ -23,13 +23,13 @@ RSpec.describe Projects::UpdateStatisticsService, feature_category: :groups_and_ let_it_be(:project) { create(:project) } where(:statistics, :method_caches) do - [] | %i(size recent_objects_size commit_count) - ['repository_size'] | %i(size recent_objects_size) - [:repository_size] | %i(size recent_objects_size) + [] | %i[size recent_objects_size commit_count] + ['repository_size'] | %i[size recent_objects_size] + [:repository_size] | %i[size recent_objects_size] [:lfs_objects_size] | nil [:commit_count] | [:commit_count] - [:repository_size, :commit_count] | %i(size recent_objects_size commit_count) - [:repository_size, :commit_count, :lfs_objects_size] | %i(size recent_objects_size commit_count) + [:repository_size, :commit_count] | %i[size recent_objects_size commit_count] + [:repository_size, :commit_count, :lfs_objects_size] | %i[size recent_objects_size commit_count] end with_them do @@ -59,7 +59,7 @@ RSpec.describe Projects::UpdateStatisticsService, feature_category: :groups_and_ it 'invalidates and refreshes Wiki size' do expect(project.statistics).to receive(:refresh!).with(only: statistics).and_call_original - expect(project.wiki.repository).to receive(:expire_method_caches).with(%i(size)).and_call_original + expect(project.wiki.repository).to receive(:expire_method_caches).with(%i[size]).and_call_original service.execute end diff --git a/spec/services/quick_actions/interpret_service_spec.rb b/spec/services/quick_actions/interpret_service_spec.rb index d5108bb3988..53d11673c79 100644 --- a/spec/services/quick_actions/interpret_service_spec.rb +++ b/spec/services/quick_actions/interpret_service_spec.rb @@ -80,7 +80,7 @@ RSpec.describe QuickActions::InterpretService, feature_category: :team_planning it 'returns the title message' do _, _, message = service.execute(content, issuable) - expect(message).to eq(%{Changed the title to "A brand new title".}) + expect(message).to eq(%(Changed the title to "A brand new title".)) end end @@ -695,7 +695,7 @@ RSpec.describe QuickActions::InterpretService, feature_category: :team_planning _, _, message = service.execute(content, issuable) if tag_message.present? - expect(message).to eq(%{Tagged this commit to #{tag_name} with "#{tag_message}".}) + expect(message).to eq(%(Tagged this commit to #{tag_name} with "#{tag_message}".)) else expect(message).to eq("Tagged this commit to #{tag_name}.") end @@ -1979,7 +1979,7 @@ RSpec.describe QuickActions::InterpretService, feature_category: :team_planning context '/board_move command' do let_it_be(:todo) { create(:label, project: project, title: 'To Do') } let_it_be(:inreview) { create(:label, project: project, title: 'In Review') } - let(:content) { %{/board_move ~"#{inreview.title}"} } + let(:content) { %(/board_move ~"#{inreview.title}") } let_it_be(:board) { create(:board, project: project) } let_it_be(:todo_list) { create(:list, board: board, label: todo) } @@ -2043,14 +2043,14 @@ RSpec.describe QuickActions::InterpretService, feature_category: :team_planning context 'if multiple labels are given' do let(:issuable) { issue } - let(:content) { %{/board_move ~"#{inreview.title}" ~"#{todo.title}"} } + let(:content) { %(/board_move ~"#{inreview.title}" ~"#{todo.title}") } it_behaves_like 'failed command', 'Failed to move this issue because only a single label can be provided.' end context 'if the given label is not a list on the board' do let(:issuable) { issue } - let(:content) { %{/board_move ~"#{bug.title}"} } + let(:content) { %(/board_move ~"#{bug.title}") } it_behaves_like 'failed command', 'Failed to move this issue because label was not found.' end diff --git a/spec/services/upload_service_spec.rb b/spec/services/upload_service_spec.rb index 518d12d5b41..4a8cd46172d 100644 --- a/spec/services/upload_service_spec.rb +++ b/spec/services/upload_service_spec.rb @@ -81,7 +81,7 @@ RSpec.describe UploadService, feature_category: :shared do it 'allows the upload' do service.override_max_attachment_size = 101.megabytes - expect(subject.keys).to eq(%i(alt url markdown)) + expect(subject.keys).to eq(%i[alt url markdown]) end it 'disallows the upload' do diff --git a/spec/sidekiq_cluster/sidekiq_cluster_spec.rb b/spec/sidekiq_cluster/sidekiq_cluster_spec.rb index 25a600405fe..ec5e5d85eeb 100644 --- a/spec/sidekiq_cluster/sidekiq_cluster_spec.rb +++ b/spec/sidekiq_cluster/sidekiq_cluster_spec.rb @@ -31,7 +31,7 @@ RSpec.describe Gitlab::SidekiqCluster do # rubocop:disable RSpec/FilePath ).and_return(2) expect(Process).to receive(:detach).ordered.with(2) - described_class.start([%w(foo), %w(bar baz)], env: :production, directory: 'foo/bar', max_concurrency: 20, min_concurrency: 10) + described_class.start([%w[foo], %w[bar baz]], env: :production, directory: 'foo/bar', max_concurrency: 20, min_concurrency: 10) end it 'starts Sidekiq with the given queues and sensible default options' do @@ -45,10 +45,10 @@ RSpec.describe Gitlab::SidekiqCluster do # rubocop:disable RSpec/FilePath dryrun: false } - expect(described_class).to receive(:start_sidekiq).ordered.with(%w(foo bar baz), expected_options) - expect(described_class).to receive(:start_sidekiq).ordered.with(%w(solo), expected_options) + expect(described_class).to receive(:start_sidekiq).ordered.with(%w[foo bar baz], expected_options) + expect(described_class).to receive(:start_sidekiq).ordered.with(%w[solo], expected_options) - described_class.start([%w(foo bar baz), %w(solo)]) + described_class.start([%w[foo bar baz], %w[solo]]) end end @@ -67,7 +67,7 @@ RSpec.describe Gitlab::SidekiqCluster do # rubocop:disable RSpec/FilePath allow(Process).to receive(:spawn).and_return(1) allow(Process).to receive(:detach).with(1).and_return(waiter_thread) - expect(described_class.start_sidekiq(%w(foo), **options)).to eq(waiter_thread) + expect(described_class.start_sidekiq(%w[foo], **options)).to eq(waiter_thread) end it 'handles duplicate queue names' do @@ -77,7 +77,7 @@ RSpec.describe Gitlab::SidekiqCluster do # rubocop:disable RSpec/FilePath .and_return(1) allow(Process).to receive(:detach).with(1).and_return(waiter_thread) - expect(described_class.start_sidekiq(%w(foo foo bar baz), **options)).to eq(waiter_thread) + expect(described_class.start_sidekiq(%w[foo foo bar baz], **options)).to eq(waiter_thread) end it 'runs the sidekiq process in a new process group' do @@ -87,15 +87,15 @@ RSpec.describe Gitlab::SidekiqCluster do # rubocop:disable RSpec/FilePath .and_return(1) allow(Process).to receive(:detach).with(1).and_return(waiter_thread) - expect(described_class.start_sidekiq(%w(foo bar baz), **options)).to eq(waiter_thread) + expect(described_class.start_sidekiq(%w[foo bar baz], **options)).to eq(waiter_thread) end end describe '.count_by_queue' do it 'tallies the queue counts' do - queues = [%w(foo), %w(bar baz), %w(foo)] + queues = [%w[foo], %w[bar baz], %w[foo]] - expect(described_class.count_by_queue(queues)).to eq(%w(foo) => 2, %w(bar baz) => 1) + expect(described_class.count_by_queue(queues)).to eq(%w[foo] => 2, %w[bar baz] => 1) end end diff --git a/spec/support/atlassian/jira_connect/schemata.rb b/spec/support/atlassian/jira_connect/schemata.rb index 73a6833b7cc..de1d6dbf691 100644 --- a/spec/support/atlassian/jira_connect/schemata.rb +++ b/spec/support/atlassian/jira_connect/schemata.rb @@ -7,11 +7,11 @@ module Atlassian { 'type' => 'object', 'additionalProperties' => false, - 'required' => %w( + 'required' => %w[ schemaVersion pipelineId buildNumber updateSequenceNumber displayName url state issueKeys testInfo references lastUpdated - ), + ], 'properties' => { 'schemaVersion' => schema_version_type, 'pipelineId' => { 'type' => 'string' }, @@ -24,7 +24,7 @@ module Atlassian 'issueKeys' => issue_keys_type, 'testInfo' => { 'type' => 'object', - 'required' => %w(totalNumber numberPassed numberFailed numberSkipped), + 'required' => %w[totalNumber numberPassed numberFailed numberSkipped], 'properties' => { 'totalNumber' => { 'type' => 'integer' }, 'numberFailed' => { 'type' => 'integer' }, @@ -36,11 +36,11 @@ module Atlassian 'type' => 'array', 'items' => { 'type' => 'object', - 'required' => %w(commit ref), + 'required' => %w[commit ref], 'properties' => { 'commit' => { 'type' => 'object', - 'required' => %w(id repositoryUri), + 'required' => %w[id repositoryUri], 'properties' => { 'id' => { 'type' => 'string' }, 'repositoryUri' => { 'type' => 'string' } @@ -48,7 +48,7 @@ module Atlassian }, 'ref' => { 'type' => 'object', - 'required' => %w(name uri), + 'required' => %w[name uri], 'properties' => { 'name' => { 'type' => 'string' }, 'uri' => { 'type' => 'string' } @@ -65,16 +65,16 @@ module Atlassian { 'type' => 'object', 'additionalProperties' => false, - 'required' => %w( + 'required' => %w[ deploymentSequenceNumber updateSequenceNumber associations displayName url description lastUpdated state pipeline environment - ), + ], 'properties' => { 'deploymentSequenceNumber' => { 'type' => 'integer' }, 'updateSequenceNumber' => { 'type' => 'integer' }, 'associations' => { - 'type' => %w(array), + 'type' => %w[array], 'items' => association_type, 'minItems' => 1 }, @@ -95,9 +95,9 @@ module Atlassian { 'type' => 'object', 'additionalProperties' => false, - 'required' => %w( + 'required' => %w[ updateSequenceId id key issueKeys summary details - ), + ], 'properties' => { 'id' => { 'type' => 'string' }, 'key' => { 'type' => 'string' }, @@ -120,7 +120,7 @@ module Atlassian 'environment' => { 'type' => 'object', 'additionalProperties' => false, - 'required' => %w(name), + 'required' => %w[name], 'properties' => { 'name' => { 'type' => 'string' }, 'type' => { @@ -144,7 +144,7 @@ module Atlassian { 'type' => 'object', 'additionalProperties' => false, - 'required' => %w(url status lastUpdated), + 'required' => %w[url status lastUpdated], 'properties' => { 'lastUpdated' => iso8601_type, 'url' => { 'type' => 'string' }, @@ -157,7 +157,7 @@ module Atlassian { 'type' => 'object', 'additionalProperties' => false, - 'required' => %w(enabled), + 'required' => %w[enabled], 'properties' => { 'enabled' => { 'type' => 'boolean' }, 'defaultValue' => { 'type' => 'string' }, @@ -182,7 +182,7 @@ module Atlassian { 'type' => 'object', 'additionalProperties' => false, - 'required' => %w(id displayName type), + 'required' => %w[id displayName type], 'properties' => { 'id' => { 'type' => 'string', 'maxLength' => 255 }, 'displayName' => { 'type' => 'string', 'maxLength' => 255 }, @@ -198,7 +198,7 @@ module Atlassian { 'type' => 'object', 'additionalProperties' => false, - 'required' => %w(id displayName url), + 'required' => %w[id displayName url], 'properties' => { 'id' => { 'type' => 'string', 'maxLength' => 255 }, 'displayName' => { 'type' => 'string', 'maxLength' => 255 }, @@ -222,7 +222,7 @@ module Atlassian { 'type' => 'object', 'additionalProperties' => false, - 'required' => %w(associationType values), + 'required' => %w[associationType values], 'properties' => { 'associationType' => { 'type' => 'string', @@ -276,7 +276,7 @@ module Atlassian def provider_metadata { 'type' => 'object', - 'required' => %w(product), + 'required' => %w[product], 'properties' => { 'product' => { 'type' => 'string' } } } end diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index 78d7e57c208..c8fa430c02c 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -191,7 +191,7 @@ RSpec.configure do |config| if example.metadata[:screenshot] screenshot = example.metadata[:screenshot][:image] || example.metadata[:screenshot][:html] screenshot&.delete_prefix!(ENV.fetch('CI_PROJECT_DIR', '')) - example.metadata[:stdout] = %{[[ATTACHMENT|#{screenshot}]]} + example.metadata[:stdout] = %([[ATTACHMENT|#{screenshot}]]) end end diff --git a/spec/support/helpers/gpg_helpers.rb b/spec/support/helpers/gpg_helpers.rb index cc8ee6c98e6..1f93b1bb698 100644 --- a/spec/support/helpers/gpg_helpers.rb +++ b/spec/support/helpers/gpg_helpers.rb @@ -700,7 +700,7 @@ module GpgHelpers end def subkey_fingerprints - %w(65A33805A5DDA7454190EE536F0E46B850B18E99 3AD06974F78DD1603D5E4617D0955D22F2C324E2) + %w[65A33805A5DDA7454190EE536F0E46B850B18E99 3AD06974F78DD1603D5E4617D0955D22F2C324E2] end def names diff --git a/spec/support/helpers/login_helpers.rb b/spec/support/helpers/login_helpers.rb index 873e4722c14..1a89cf4cc37 100644 --- a/spec/support/helpers/login_helpers.rb +++ b/spec/support/helpers/login_helpers.rb @@ -212,9 +212,9 @@ module LoginHelpers def mock_saml_config_with_upstream_two_factor_authn_contexts config = mock_saml_config - config.args[:upstream_two_factor_authn_contexts] = %w(urn:oasis:names:tc:SAML:2.0:ac:classes:CertificateProtectedTransport + config.args[:upstream_two_factor_authn_contexts] = %w[urn:oasis:names:tc:SAML:2.0:ac:classes:CertificateProtectedTransport urn:oasis:names:tc:SAML:2.0:ac:classes:SecondFactorOTPSMS - urn:oasis:names:tc:SAML:2.0:ac:classes:SecondFactorIGTOKEN) + urn:oasis:names:tc:SAML:2.0:ac:classes:SecondFactorIGTOKEN] config end diff --git a/spec/support/helpers/prometheus_helpers.rb b/spec/support/helpers/prometheus_helpers.rb index da80f6f08c2..065c653c62f 100644 --- a/spec/support/helpers/prometheus_helpers.rb +++ b/spec/support/helpers/prometheus_helpers.rb @@ -207,7 +207,7 @@ module PrometheusHelpers def prometheus_label_values { 'status': 'success', - 'data': %w(job_adds job_controller_rate_limiter_use job_depth job_queue_latency job_work_duration_sum up) + 'data': %w[job_adds job_controller_rate_limiter_use job_depth job_queue_latency job_work_duration_sum up] } end diff --git a/spec/support/helpers/repo_helpers.rb b/spec/support/helpers/repo_helpers.rb index d264356aa64..bac88da4885 100644 --- a/spec/support/helpers/repo_helpers.rb +++ b/spec/support/helpers/repo_helpers.rb @@ -112,13 +112,13 @@ eos } ] + extra_changes - commits = %w( + commits = %w[ 5937ac0a7beb003549fc5fd26fc247adbce4a52e 570e7b2abdd848b95f2f578043fc23bd6f6fd24d 6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9 d14d6c0abdd253381df51a723d58691b2ee1ab08 c1acaa58bbcbc3eafe538cb8274ba387047b69f8 - ).reverse # last commit is recent one + ].reverse # last commit is recent one reviewers = [ { diff --git a/spec/support/helpers/seed_repo.rb b/spec/support/helpers/seed_repo.rb index 74ac529a3de..b0bd0dfb60e 100644 --- a/spec/support/helpers/seed_repo.rb +++ b/spec/support/helpers/seed_repo.rb @@ -47,7 +47,7 @@ module SeedRepo FILES_COUNT = 2 C_FILE_PATH = "files/ruby" C_FILES = ["popen.rb", "regex.rb", "version_info.rb"].freeze - BLOB_FILE = %{%h3= @key.title\n%hr\n%pre= @key.key\n.actions\n = link_to 'Remove', @key, :confirm => 'Are you sure?', :method => :delete, :class => \"btn danger delete-key\"\n\n\n} + BLOB_FILE = %(%h3= @key.title\n%hr\n%pre= @key.key\n.actions\n = link_to 'Remove', @key, :confirm => 'Are you sure?', :method => :delete, :class => \"btn danger delete-key\"\n\n\n) BLOB_FILE_PATH = "app/views/keys/show.html.haml" end diff --git a/spec/support/helpers/test_env.rb b/spec/support/helpers/test_env.rb index 740abdb6cfa..e606a377ec7 100644 --- a/spec/support/helpers/test_env.rb +++ b/spec/support/helpers/test_env.rb @@ -305,7 +305,7 @@ module TestEnv unless File.directory?(repo_path) start = Time.now - system(*%W(#{Gitlab.config.git.bin_path} clone --quiet -- #{clone_url} #{repo_path})) + system(*%W[#{Gitlab.config.git.bin_path} clone --quiet -- #{clone_url} #{repo_path}]) puts "==> #{repo_path} set up in #{Time.now - start} seconds...\n" end @@ -316,7 +316,7 @@ module TestEnv # set all the required local branches. This would happen when a new # branch is added to BRANCH_SHA, in which case we want to update # everything. - unless system(*%W(#{Gitlab.config.git.bin_path} -C #{repo_path} fetch origin)) + unless system(*%W[#{Gitlab.config.git.bin_path} -C #{repo_path} fetch origin]) raise 'Could not fetch test seed repository.' end @@ -329,7 +329,7 @@ module TestEnv if create_bundle start = Time.now - system(git_env, *%W(#{Gitlab.config.git.bin_path} -C #{repo_path} bundle create #{repo_bundle_path} --exclude refs/remotes/* --all)) + system(git_env, *%W[#{Gitlab.config.git.bin_path} -C #{repo_path} bundle create #{repo_bundle_path} --exclude refs/remotes/* --all]) puts "==> #{repo_bundle_path} generated in #{Time.now - start} seconds...\n" end end @@ -530,7 +530,7 @@ module TestEnv return false unless Dir.exist?(component_folder) - sha, exit_status = Gitlab::Popen.popen(%W(#{Gitlab.config.git.bin_path} rev-parse HEAD), component_folder) + sha, exit_status = Gitlab::Popen.popen(%W[#{Gitlab.config.git.bin_path} rev-parse HEAD], component_folder) return false if exit_status != 0 expected_version == sha.chomp diff --git a/spec/support/helpers/usage_data_helpers.rb b/spec/support/helpers/usage_data_helpers.rb index 42e599c7510..3b8c0b42fe8 100644 --- a/spec/support/helpers/usage_data_helpers.rb +++ b/spec/support/helpers/usage_data_helpers.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module UsageDataHelpers - COUNTS_KEYS = %i( + COUNTS_KEYS = %i[ assignee_lists ci_builds ci_external_pipelines @@ -72,9 +72,9 @@ module UsageDataHelpers uploads web_hooks user_preferences_user_gitpod_enabled - ).freeze + ].freeze - USAGE_DATA_KEYS = %i( + USAGE_DATA_KEYS = %i[ counts recorded_at mattermost_enabled @@ -93,7 +93,7 @@ module UsageDataHelpers prometheus_metrics_enabled object_store topology - ).freeze + ].freeze def stub_usage_data_connections Gitlab::Database.database_base_models_with_gitlab_shared.each_value do |base_model| diff --git a/spec/support/import_export/configuration_helper.rb b/spec/support/import_export/configuration_helper.rb index 28797229661..f6917cdd89e 100644 --- a/spec/support/import_export/configuration_helper.rb +++ b/spec/support/import_export/configuration_helper.rb @@ -32,7 +32,7 @@ module ConfigurationHelper # - project is not part of the tree, so it has to be added manually. # - milestone, labels, merge_request have both singular and plural versions in the tree, so remove the duplicates. # - User, Author... Models we do not care about for checking models - names.flatten.uniq - %w(milestones labels user author merge_request design) + [key.to_s] + names.flatten.uniq - %w[milestones labels user author merge_request design] + [key.to_s] end def relation_class_for_name(relation_name) diff --git a/spec/support/import_export/export_file_helper.rb b/spec/support/import_export/export_file_helper.rb index 3be2d39906d..8068d3082d5 100644 --- a/spec/support/import_export/export_file_helper.rb +++ b/spec/support/import_export/export_file_helper.rb @@ -59,7 +59,7 @@ module ExportFileHelper def in_directory_with_expanded_export(project) Dir.mktmpdir do |tmpdir| export_file = project.export_file.path - _output, exit_status = Gitlab::Popen.popen(%W{tar -zxf #{export_file} -C #{tmpdir}}) + _output, exit_status = Gitlab::Popen.popen(%W[tar -zxf #{export_file} -C #{tmpdir}]) yield(exit_status, tmpdir) end diff --git a/spec/support/matchers/markdown_matchers.rb b/spec/support/matchers/markdown_matchers.rb index 7a82d7674d9..21fc1824bea 100644 --- a/spec/support/matchers/markdown_matchers.rb +++ b/spec/support/matchers/markdown_matchers.rb @@ -76,7 +76,7 @@ module MarkdownMatchers expect(actual).to have_autolink('irc://irc.freenode.net/git') expect(actual).to have_autolink('http://localhost:3000') - %w(code a kbd).each do |elem| + %w[code a kbd].each do |elem| expect(body).not_to have_selector("#{elem} a") end end diff --git a/spec/support/shared_contexts/graphql/resolvers/runners_resolver_shared_context.rb b/spec/support/shared_contexts/graphql/resolvers/runners_resolver_shared_context.rb index 1480b5f98e7..2dbb903a272 100644 --- a/spec/support/shared_contexts/graphql/resolvers/runners_resolver_shared_context.rb +++ b/spec/support/shared_contexts/graphql/resolvers/runners_resolver_shared_context.rb @@ -9,14 +9,14 @@ RSpec.shared_context 'runners resolver setup' do let_it_be(:project) { create(:project, :public, group: group) } let_it_be(:inactive_project_runner) do - create(:ci_runner, :project, projects: [project], description: 'inactive project runner', token: 'abcdef', active: false, contacted_at: 1.minute.ago, tag_list: %w(project_runner)) + create(:ci_runner, :project, projects: [project], description: 'inactive project runner', token: 'abcdef', active: false, contacted_at: 1.minute.ago, tag_list: %w[project_runner]) end let_it_be(:offline_project_runner) do - create(:ci_runner, :project, projects: [project], description: 'offline project runner', token: 'defghi', contacted_at: 1.day.ago, tag_list: %w(project_runner active_runner)) + create(:ci_runner, :project, projects: [project], description: 'offline project runner', token: 'defghi', contacted_at: 1.day.ago, tag_list: %w[project_runner active_runner]) end let_it_be(:group_runner) { create(:ci_runner, :group, groups: [group], token: 'mnopqr', description: 'group runner', contacted_at: 2.seconds.ago) } let_it_be(:subgroup_runner) { create(:ci_runner, :group, groups: [subgroup], token: '123456', description: 'subgroup runner', contacted_at: 1.second.ago) } - let_it_be(:instance_runner) { create(:ci_runner, :instance, description: 'shared runner', token: 'stuvxz', contacted_at: 2.minutes.ago, tag_list: %w(instance_runner active_runner)) } + let_it_be(:instance_runner) { create(:ci_runner, :instance, description: 'shared runner', token: 'stuvxz', contacted_at: 2.minutes.ago, tag_list: %w[instance_runner active_runner]) } end diff --git a/spec/support/shared_contexts/services/projects/container_repository/delete_tags_service_shared_context.rb b/spec/support/shared_contexts/services/projects/container_repository/delete_tags_service_shared_context.rb index b65c8b4bfe3..01b91cd5db4 100644 --- a/spec/support/shared_contexts/services/projects/container_repository/delete_tags_service_shared_context.rb +++ b/spec/support/shared_contexts/services/projects/container_repository/delete_tags_service_shared_context.rb @@ -16,7 +16,7 @@ RSpec.shared_context 'container repository delete tags service shared context' d stub_container_registry_tags( repository: repository.path, - tags: %w(latest A Ba Bb C D E)) + tags: %w[latest A Ba Bb C D E]) end def stub_delete_reference_request(tag, status = 200) diff --git a/spec/support/shared_examples/controllers/wiki_actions_shared_examples.rb b/spec/support/shared_examples/controllers/wiki_actions_shared_examples.rb index 32aa566c27e..8cec0cdfbf5 100644 --- a/spec/support/shared_examples/controllers/wiki_actions_shared_examples.rb +++ b/spec/support/shared_examples/controllers/wiki_actions_shared_examples.rb @@ -324,7 +324,7 @@ RSpec.shared_examples 'wiki controller actions' do post :preview_markdown, params: routing_params.merge(id: 'page/path', text: '*Markdown* text') expect(response).to have_gitlab_http_status(:ok) - expect(json_response.keys).to match_array(%w(body references)) + expect(json_response.keys).to match_array(%w[body references]) end end diff --git a/spec/support/shared_examples/features/page_description_shared_examples.rb b/spec/support/shared_examples/features/page_description_shared_examples.rb index e3ea36633d1..163c65915ba 100644 --- a/spec/support/shared_examples/features/page_description_shared_examples.rb +++ b/spec/support/shared_examples/features/page_description_shared_examples.rb @@ -2,7 +2,7 @@ RSpec.shared_examples 'page meta description' do |expected_description| it 'renders the page with description, og:description, and twitter:description meta tags that contains a plain-text version of the markdown', :aggregate_failures do - %w(name='description' property='og:description' property='twitter:description').each do |selector| + %w[name='description' property='og:description' property='twitter:description'].each do |selector| expect(page).to have_selector("meta[#{selector}][content='#{expected_description}']", visible: false) end end @@ -12,7 +12,7 @@ RSpec.shared_examples 'default brand title page meta description' do include AppearancesHelper it 'renders the page with description, og:description, and twitter:description meta tags with the default brand title', :aggregate_failures do - %w(name='description' property='og:description' property='twitter:description').each do |selector| + %w[name='description' property='og:description' property='twitter:description'].each do |selector| expect(page).to have_selector("meta[#{selector}][content='#{default_brand_title}']", visible: false) end end diff --git a/spec/support/shared_examples/features/wiki/user_creates_wiki_page_shared_examples.rb b/spec/support/shared_examples/features/wiki/user_creates_wiki_page_shared_examples.rb index ed885d7a226..dfad11f3170 100644 --- a/spec/support/shared_examples/features/wiki/user_creates_wiki_page_shared_examples.rb +++ b/spec/support/shared_examples/features/wiki/user_creates_wiki_page_shared_examples.rb @@ -56,7 +56,7 @@ RSpec.shared_examples 'User creates wiki page' do click_on("Create page") end - expect(page).to have_current_path(%r(one/two/three-test), ignore_query: true) + expect(page).to have_current_path(%r{one/two/three-test}, ignore_query: true) expect(page).to have_link(href: wiki_page_path(wiki, 'one/two/three-test')) end diff --git a/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb b/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb index 63438a9c379..a48ff8a5f77 100644 --- a/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb +++ b/spec/support/shared_examples/features/wiki/user_updates_wiki_page_shared_examples.rb @@ -40,7 +40,7 @@ RSpec.shared_examples 'User updates wiki page' do click_on('Create page') end - expect(page).to have_current_path(%r(one/two/three-test), ignore_query: true) + expect(page).to have_current_path(%r{one/two/three-test}, ignore_query: true) expect(find('.wiki-pages')).to have_content('three') first(:link, text: 'three').click @@ -49,7 +49,7 @@ RSpec.shared_examples 'User updates wiki page' do click_on('Edit') - expect(page).to have_current_path(%r(one/two/three-test), ignore_query: true) + expect(page).to have_current_path(%r{one/two/three-test}, ignore_query: true) expect(page).to have_content('Edit Page') fill_in('Content', with: 'Updated Wiki Content') diff --git a/spec/support/shared_examples/features/wiki/user_views_wiki_page_shared_examples.rb b/spec/support/shared_examples/features/wiki/user_views_wiki_page_shared_examples.rb index 1d056592816..3fac7e7093c 100644 --- a/spec/support/shared_examples/features/wiki/user_views_wiki_page_shared_examples.rb +++ b/spec/support/shared_examples/features/wiki/user_views_wiki_page_shared_examples.rb @@ -39,12 +39,12 @@ RSpec.shared_examples 'User views a wiki page' do end it 'shows the history of a page that has a path' do - expect(page).to have_current_path(%r(one/two/three-test)) + expect(page).to have_current_path(%r{one/two/three-test}) first(:link, text: 'three').click click_on('Page history') - expect(page).to have_current_path(%r(one/two/three-test)) + expect(page).to have_current_path(%r{one/two/three-test}) page.within(:css, '.wiki-page-header') do expect(page).to have_content('History') @@ -52,7 +52,7 @@ RSpec.shared_examples 'User views a wiki page' do end it 'shows an old version of a page', :js do - expect(page).to have_current_path(%r(one/two/three-test)) + expect(page).to have_current_path(%r{one/two/three-test}) expect(find('.wiki-pages')).to have_content('three') first(:link, text: 'three').click @@ -61,7 +61,7 @@ RSpec.shared_examples 'User views a wiki page' do click_on('Edit') - expect(page).to have_current_path(%r(one/two/three-test)) + expect(page).to have_current_path(%r{one/two/three-test}) expect(page).to have_content('Edit Page') fill_in('Content', with: 'Updated Wiki Content') @@ -100,7 +100,7 @@ RSpec.shared_examples 'User views a wiki page' do click_on('image') - expect(page).to have_current_path(%r(wikis/#{path})) + expect(page).to have_current_path(%r{wikis/#{path}}) end end @@ -109,7 +109,7 @@ RSpec.shared_examples 'User views a wiki page' do click_on('image') - expect(page).to have_current_path(%r(wikis/#{path})) + expect(page).to have_current_path(%r{wikis/#{path}}) expect(page).to have_content('Create New Page') end end diff --git a/spec/support/shared_examples/finders/issues_finder_shared_examples.rb b/spec/support/shared_examples/finders/issues_finder_shared_examples.rb index ed8feebf1f6..043d6db66d3 100644 --- a/spec/support/shared_examples/finders/issues_finder_shared_examples.rb +++ b/spec/support/shared_examples/finders/issues_finder_shared_examples.rb @@ -956,7 +956,7 @@ RSpec.shared_examples 'issues or work items finder' do |factory, execute_context end context 'multiple params' do - let(:params) { { issue_types: %w(issue incident) } } + let(:params) { { issue_types: %w[issue incident] } } it 'returns all items' do expect(items).to contain_exactly(incident_item, item1, item2, item3, item4, item5) diff --git a/spec/support/shared_examples/lib/banzai/filters/sanitization_filter_shared_examples.rb b/spec/support/shared_examples/lib/banzai/filters/sanitization_filter_shared_examples.rb index e6433f963f4..e335255e426 100644 --- a/spec/support/shared_examples/lib/banzai/filters/sanitization_filter_shared_examples.rb +++ b/spec/support/shared_examples/lib/banzai/filters/sanitization_filter_shared_examples.rb @@ -2,14 +2,14 @@ RSpec.shared_examples 'default allowlist' do it 'sanitizes tags that are not allowed' do - act = %q{<textarea>no inputs</textarea> and <blink>no blinks</blink>} + act = %q(<textarea>no inputs</textarea> and <blink>no blinks</blink>) exp = 'no inputs and no blinks' expect(filter(act).to_html).to eq exp end it 'sanitizes tag attributes' do - act = %q{<a href="http://example.com/bar.html" onclick="bar">Text</a>} - exp = %q{<a href="http://example.com/bar.html">Text</a>} + act = %q(<a href="http://example.com/bar.html" onclick="bar">Text</a>) + exp = %q(<a href="http://example.com/bar.html">Text</a>) expect(filter(act).to_html).to eq exp end @@ -31,13 +31,13 @@ RSpec.shared_examples 'default allowlist' do end it 'sanitizes `class` attribute on any element' do - act = %q{<strong class="foo">Strong</strong>} - expect(filter(act).to_html).to eq %q{<strong>Strong</strong>} + act = %q(<strong class="foo">Strong</strong>) + expect(filter(act).to_html).to eq %q(<strong>Strong</strong>) end it 'sanitizes `id` attribute on any element' do - act = %q{<em id="foo">Emphasis</em>} - expect(filter(act).to_html).to eq %q{<em>Emphasis</em>} + act = %q(<em id="foo">Emphasis</em>) + expect(filter(act).to_html).to eq %q(<em>Emphasis</em>) end end @@ -150,8 +150,8 @@ end RSpec.shared_examples 'sanitize link' do it 'removes `rel` attribute from `a` elements' do - act = %q{<a href="#" rel="nofollow">Link</a>} - exp = %q{<a href="#">Link</a>} + act = %q(<a href="#" rel="nofollow">Link</a>) + exp = %q(<a href="#">Link</a>) expect(filter(act).to_html).to eq exp end @@ -167,14 +167,14 @@ RSpec.shared_examples 'sanitize link' do end it 'allows non-standard anchor schemes' do - exp = %q{<a href="irc://irc.freenode.net/git">IRC</a>} + exp = %q(<a href="irc://irc.freenode.net/git">IRC</a>) act = filter(exp) expect(act.to_html).to eq exp end it 'allows relative links' do - exp = %q{<a href="foo/bar.md">foo/bar.md</a>} + exp = %q(<a href="foo/bar.md">foo/bar.md</a>) act = filter(exp) expect(act.to_html).to eq exp diff --git a/spec/support/shared_examples/lib/gitlab/middleware/multipart_shared_examples.rb b/spec/support/shared_examples/lib/gitlab/middleware/multipart_shared_examples.rb index 16b048ae325..c17d022293d 100644 --- a/spec/support/shared_examples/lib/gitlab/middleware/multipart_shared_examples.rb +++ b/spec/support/shared_examples/lib/gitlab/middleware/multipart_shared_examples.rb @@ -8,7 +8,7 @@ RSpec.shared_examples 'handling all upload parameters conditions' do let(:params) { upload_parameters_for(filepath: uploaded_filepath, key: 'file', mode: mode, filename: filename, remote_id: remote_id) } it 'builds an UploadedFile' do - expect_uploaded_files(filepath: uploaded_filepath, original_filename: filename, remote_id: remote_id, size: uploaded_file.size, params_path: %w(file)) + expect_uploaded_files(filepath: uploaded_filepath, original_filename: filename, remote_id: remote_id, size: uploaded_file.size, params_path: %w[file]) subject end @@ -27,8 +27,8 @@ RSpec.shared_examples 'handling all upload parameters conditions' do it 'builds UploadedFiles' do expect_uploaded_files( [ - { filepath: uploaded_filepath, original_filename: filename, remote_id: remote_id, size: uploaded_file.size, params_path: %w(file1) }, - { filepath: uploaded_filepath2, original_filename: filename2, remote_id: remote_id2, size: uploaded_file2.size, params_path: %w(file2) } + { filepath: uploaded_filepath, original_filename: filename, remote_id: remote_id, size: uploaded_file.size, params_path: %w[file1] }, + { filepath: uploaded_filepath2, original_filename: filename2, remote_id: remote_id2, size: uploaded_file2.size, params_path: %w[file2] } ] ) @@ -43,7 +43,7 @@ RSpec.shared_examples 'handling all upload parameters conditions' do let(:params) { { 'user' => { 'avatar' => upload_parameters_for(filepath: uploaded_filepath, mode: mode, filename: filename, remote_id: remote_id) } } } it 'builds an UploadedFile' do - expect_uploaded_files(filepath: uploaded_filepath, original_filename: filename, remote_id: remote_id, size: uploaded_file.size, params_path: %w(user avatar)) + expect_uploaded_files(filepath: uploaded_filepath, original_filename: filename, remote_id: remote_id, size: uploaded_file.size, params_path: %w[user avatar]) subject end @@ -65,8 +65,8 @@ RSpec.shared_examples 'handling all upload parameters conditions' do it 'builds UploadedFiles' do expect_uploaded_files( [ - { filepath: uploaded_filepath, original_filename: filename, remote_id: remote_id, size: uploaded_file.size, params_path: %w(user avatar) }, - { filepath: uploaded_filepath2, original_filename: filename2, remote_id: remote_id2, size: uploaded_file2.size, params_path: %w(user screenshot) } + { filepath: uploaded_filepath, original_filename: filename, remote_id: remote_id, size: uploaded_file.size, params_path: %w[user avatar] }, + { filepath: uploaded_filepath2, original_filename: filename2, remote_id: remote_id2, size: uploaded_file2.size, params_path: %w[user screenshot] } ] ) @@ -81,7 +81,7 @@ RSpec.shared_examples 'handling all upload parameters conditions' do let(:params) { { 'user' => { 'avatar' => { 'bananas' => upload_parameters_for(filepath: uploaded_filepath, mode: mode, filename: filename, remote_id: remote_id) } } } } it 'builds an UploadedFile' do - expect_uploaded_files(filepath: uploaded_file, original_filename: filename, remote_id: remote_id, size: uploaded_file.size, params_path: %w(user avatar bananas)) + expect_uploaded_files(filepath: uploaded_file, original_filename: filename, remote_id: remote_id, size: uploaded_file.size, params_path: %w[user avatar bananas]) subject end @@ -107,8 +107,8 @@ RSpec.shared_examples 'handling all upload parameters conditions' do it 'builds UploadedFiles' do expect_uploaded_files( [ - { filepath: uploaded_file, original_filename: filename, remote_id: remote_id, size: uploaded_file.size, params_path: %w(user avatar bananas) }, - { filepath: uploaded_file2, original_filename: filename2, remote_id: remote_id2, size: uploaded_file2.size, params_path: %w(user friend ananas) } + { filepath: uploaded_file, original_filename: filename, remote_id: remote_id, size: uploaded_file.size, params_path: %w[user avatar bananas] }, + { filepath: uploaded_file2, original_filename: filename2, remote_id: remote_id2, size: uploaded_file2.size, params_path: %w[user friend ananas] } ] ) @@ -141,9 +141,9 @@ RSpec.shared_examples 'handling all upload parameters conditions' do it 'builds UploadedFiles' do expect_uploaded_files( [ - { filepath: uploaded_filepath, original_filename: filename, remote_id: remote_id, size: uploaded_file.size, params_path: %w(file) }, - { filepath: uploaded_filepath2, original_filename: filename2, remote_id: remote_id2, size: uploaded_file2.size, params_path: %w(user avatar) }, - { filepath: uploaded_filepath3, original_filename: filename3, remote_id: remote_id3, size: uploaded_file3.size, params_path: %w(user friend avatar) } + { filepath: uploaded_filepath, original_filename: filename, remote_id: remote_id, size: uploaded_file.size, params_path: %w[file] }, + { filepath: uploaded_filepath2, original_filename: filename2, remote_id: remote_id2, size: uploaded_file2.size, params_path: %w[user avatar] }, + { filepath: uploaded_filepath3, original_filename: filename3, remote_id: remote_id3, size: uploaded_file3.size, params_path: %w[user friend avatar] } ] ) diff --git a/spec/support/shared_examples/metrics/transaction_metrics_with_labels_shared_examples.rb b/spec/support/shared_examples/metrics/transaction_metrics_with_labels_shared_examples.rb index 286c60f1f4f..3fc52cdd86e 100644 --- a/spec/support/shared_examples/metrics/transaction_metrics_with_labels_shared_examples.rb +++ b/spec/support/shared_examples/metrics/transaction_metrics_with_labels_shared_examples.rb @@ -95,7 +95,7 @@ RSpec.shared_examples 'transaction metrics with labels' do expect(prometheus_metric).to receive(:increment).with(labels.merge(sane: 'yes'), 1) transaction_obj.increment(:block_labels, 1, sane: 'yes') do - label_keys %i(sane) + label_keys %i[sane] end end @@ -145,7 +145,7 @@ RSpec.shared_examples 'transaction metrics with labels' do expect(prometheus_metric).to receive(:set).with(labels.merge(sane: 'yes'), 99) transaction_obj.set(:block_labels_set, 99, sane: 'yes') do - label_keys %i(sane) + label_keys %i[sane] end end @@ -195,7 +195,7 @@ RSpec.shared_examples 'transaction metrics with labels' do expect(prometheus_metric).to receive(:observe).with(labels.merge(sane: 'yes'), 2.0) transaction_obj.observe(:block_labels_observe, 2.0, sane: 'yes') do - label_keys %i(sane) + label_keys %i[sane] end end diff --git a/spec/support/shared_examples/models/application_setting_shared_examples.rb b/spec/support/shared_examples/models/application_setting_shared_examples.rb index 6e7d04d3cba..70179dd7fc7 100644 --- a/spec/support/shared_examples/models/application_setting_shared_examples.rb +++ b/spec/support/shared_examples/models/application_setting_shared_examples.rb @@ -246,7 +246,7 @@ RSpec.shared_examples 'application settings examples' do context 'in FIPS mode', :fips_mode do it 'excludes DSA from supported key types' do - expect(setting.allowed_key_types).to contain_exactly(*Gitlab::SSHPublicKey.supported_types - %i(dsa)) + expect(setting.allowed_key_types).to contain_exactly(*Gitlab::SSHPublicKey.supported_types - %i[dsa]) end end @@ -297,7 +297,7 @@ RSpec.shared_examples 'application settings examples' do describe '#pick_repository_storage' do before do - allow(Gitlab.config.repositories.storages).to receive(:keys).and_return(%w(default backup)) + allow(Gitlab.config.repositories.storages).to receive(:keys).and_return(%w[default backup]) allow(setting).to receive(:repository_storages_weighted).and_return({ 'default' => 20, 'backup' => 80 }) end @@ -314,13 +314,13 @@ RSpec.shared_examples 'application settings examples' do using RSpec::Parameterized::TableSyntax where(:config_storages, :storages, :normalized) do - %w(default backup) | { 'default' => 0, 'backup' => 100 } | { 'default' => 0.0, 'backup' => 1.0 } - %w(default backup) | { 'default' => 100, 'backup' => 100 } | { 'default' => 0.5, 'backup' => 0.5 } - %w(default backup) | { 'default' => 20, 'backup' => 80 } | { 'default' => 0.2, 'backup' => 0.8 } - %w(default backup) | { 'default' => 0, 'backup' => 0 } | { 'default' => 0.0, 'backup' => 0.0 } - %w(default) | { 'default' => 0, 'backup' => 100 } | { 'default' => 0.0 } - %w(default) | { 'default' => 100, 'backup' => 100 } | { 'default' => 1.0 } - %w(default) | { 'default' => 20, 'backup' => 80 } | { 'default' => 1.0 } + %w[default backup] | { 'default' => 0, 'backup' => 100 } | { 'default' => 0.0, 'backup' => 1.0 } + %w[default backup] | { 'default' => 100, 'backup' => 100 } | { 'default' => 0.5, 'backup' => 0.5 } + %w[default backup] | { 'default' => 20, 'backup' => 80 } | { 'default' => 0.2, 'backup' => 0.8 } + %w[default backup] | { 'default' => 0, 'backup' => 0 } | { 'default' => 0.0, 'backup' => 0.0 } + %w[default] | { 'default' => 0, 'backup' => 100 } | { 'default' => 0.0 } + %w[default] | { 'default' => 100, 'backup' => 100 } | { 'default' => 1.0 } + %w[default] | { 'default' => 20, 'backup' => 80 } | { 'default' => 1.0 } end with_them do diff --git a/spec/support/shared_examples/models/diff_positionable_note_shared_examples.rb b/spec/support/shared_examples/models/diff_positionable_note_shared_examples.rb index eafa589a1d3..a6fcea62aba 100644 --- a/spec/support/shared_examples/models/diff_positionable_note_shared_examples.rb +++ b/spec/support/shared_examples/models/diff_positionable_note_shared_examples.rb @@ -48,7 +48,7 @@ RSpec.shared_examples 'a valid diff positionable note' do |factory_on_commit| end end - %i(original_position position change_position).each do |method| + %i[original_position position change_position].each do |method| describe "#{method}=" do it "doesn't accept non-hash JSON passed as a string" do subject.send(:"#{method}=", "true") diff --git a/spec/support/shared_examples/models/project_ci_cd_settings_shared_examples.rb b/spec/support/shared_examples/models/project_ci_cd_settings_shared_examples.rb index f1af1760e8d..3ecf58168b3 100644 --- a/spec/support/shared_examples/models/project_ci_cd_settings_shared_examples.rb +++ b/spec/support/shared_examples/models/project_ci_cd_settings_shared_examples.rb @@ -5,7 +5,7 @@ RSpec.shared_examples 'ci_cd_settings delegation' do context 'when ci_cd_settings is destroyed but project is not' do it 'allows methods delegated to ci_cd_settings to be nil', :aggregate_failures do - attributes = project.ci_cd_settings.attributes.keys - %w(id project_id) - exclude_attributes + attributes = project.ci_cd_settings.attributes.keys - %w[id project_id] - exclude_attributes expect(attributes).to match_array(attributes_with_prefix.keys) diff --git a/spec/support/shared_examples/models/wiki_shared_examples.rb b/spec/support/shared_examples/models/wiki_shared_examples.rb index a0187252108..d731eec5680 100644 --- a/spec/support/shared_examples/models/wiki_shared_examples.rb +++ b/spec/support/shared_examples/models/wiki_shared_examples.rb @@ -14,7 +14,7 @@ RSpec.shared_examples 'wiki model' do subject { wiki } it 'VALID_USER_MARKUPS contains all valid markups' do - expect(described_class::VALID_USER_MARKUPS.keys).to match_array(%i(markdown rdoc asciidoc org)) + expect(described_class::VALID_USER_MARKUPS.keys).to match_array(%i[markdown rdoc asciidoc org]) end it 'container class includes HasWiki' do diff --git a/spec/support/shared_examples/path_extraction_shared_examples.rb b/spec/support/shared_examples/path_extraction_shared_examples.rb index d76348aa26a..5ceaf182d03 100644 --- a/spec/support/shared_examples/path_extraction_shared_examples.rb +++ b/spec/support/shared_examples/path_extraction_shared_examples.rb @@ -114,12 +114,12 @@ RSpec.shared_examples 'extracts refs' do it 'extracts a valid commit SHA' do expect(extract_ref('f4b14494ef6abf3d144c28e4af0c20143383e062/CHANGELOG')).to eq( - %w(f4b14494ef6abf3d144c28e4af0c20143383e062 CHANGELOG) + %w[f4b14494ef6abf3d144c28e4af0c20143383e062 CHANGELOG] ) end it 'falls back to a primitive split for an invalid ref' do - expect(extract_ref('stable/CHANGELOG')).to eq(%w(stable CHANGELOG)) + expect(extract_ref('stable/CHANGELOG')).to eq(%w[stable CHANGELOG]) end it 'extracts the longest matching ref' do diff --git a/spec/support/shared_examples/quick_actions/commit/tag_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/commit/tag_quick_action_shared_examples.rb index 14b384b149d..78b667cfe56 100644 --- a/spec/support/shared_examples/quick_actions/commit/tag_quick_action_shared_examples.rb +++ b/spec/support/shared_examples/quick_actions/commit/tag_quick_action_shared_examples.rb @@ -5,7 +5,7 @@ RSpec.shared_examples 'tag quick action' do it 'tags this commit' do add_note("/tag #{tag_name} #{tag_message}") - expect(page).to have_content %{Tagged this commit to #{tag_name} with "#{tag_message}".} + expect(page).to have_content %(Tagged this commit to #{tag_name} with "#{tag_message}".) expect(page).to have_content "tagged commit #{truncated_commit_sha}" expect(page).to have_content tag_name @@ -21,7 +21,7 @@ RSpec.shared_examples 'tag quick action' do preview_note("/tag #{tag_name} #{tag_message}") expect(page).not_to have_content '/tag' - expect(page).to have_content %{Tags this commit to #{tag_name} with "#{tag_message}"} + expect(page).to have_content %(Tags this commit to #{tag_name} with "#{tag_message}") expect(page).to have_content tag_name end end diff --git a/spec/support/shared_examples/quick_actions/issue/create_merge_request_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issue/create_merge_request_quick_action_shared_examples.rb index 9dc39c6cf73..27d850b8522 100644 --- a/spec/support/shared_examples/quick_actions/issue/create_merge_request_quick_action_shared_examples.rb +++ b/spec/support/shared_examples/quick_actions/issue/create_merge_request_quick_action_shared_examples.rb @@ -41,7 +41,7 @@ RSpec.shared_examples 'create_merge_request quick action' do expect(created_mr.source_branch).to eq(issue.to_branch_name) visit project_merge_request_path(project, created_mr) - expect(page).to have_content %{Draft: Resolve "#{issue.title}"} + expect(page).to have_content %(Draft: Resolve "#{issue.title}") end it 'creates a merge request using the given branch name' do @@ -54,7 +54,7 @@ RSpec.shared_examples 'create_merge_request quick action' do expect(created_mr.source_branch).to eq(branch_name) visit project_merge_request_path(project, created_mr) - expect(page).to have_content %{Draft: Resolve "#{issue.title}"} + expect(page).to have_content %(Draft: Resolve "#{issue.title}") end end end diff --git a/spec/support/shared_examples/requests/api/container_repositories_shared_examples.rb b/spec/support/shared_examples/requests/api/container_repositories_shared_examples.rb index 3ff52166990..e7fdf143887 100644 --- a/spec/support/shared_examples/requests/api/container_repositories_shared_examples.rb +++ b/spec/support/shared_examples/requests/api/container_repositories_shared_examples.rb @@ -39,8 +39,8 @@ RSpec.shared_examples 'returns tags for allowed users' do |user_type, scope| let(:url) { "/#{scope}s/#{object.id}/registry/repositories?tags=true" } before do - stub_container_registry_tags(repository: root_repository.path, tags: %w(rootA latest), with_manifest: true) - stub_container_registry_tags(repository: test_repository.path, tags: %w(rootA latest), with_manifest: true) + stub_container_registry_tags(repository: root_repository.path, tags: %w[rootA latest], with_manifest: true) + stub_container_registry_tags(repository: test_repository.path, tags: %w[rootA latest], with_manifest: true) end it 'returns a list of repositories and their tags' do @@ -64,8 +64,8 @@ RSpec.shared_examples 'returns tags for allowed users' do |user_type, scope| let(:url) { "/#{scope}s/#{object.id}/registry/repositories?tags_count=true" } before do - stub_container_registry_tags(repository: root_repository.path, tags: %w(rootA latest), with_manifest: true) - stub_container_registry_tags(repository: test_repository.path, tags: %w(rootA latest), with_manifest: true) + stub_container_registry_tags(repository: root_repository.path, tags: %w[rootA latest], with_manifest: true) + stub_container_registry_tags(repository: test_repository.path, tags: %w[rootA latest], with_manifest: true) end it 'returns a list of repositories and their tags_count' do diff --git a/spec/support/shared_examples/requests/api/rubygems_packages_shared_examples.rb b/spec/support/shared_examples/requests/api/rubygems_packages_shared_examples.rb index da09d70c777..d7077180b91 100644 --- a/spec/support/shared_examples/requests/api/rubygems_packages_shared_examples.rb +++ b/spec/support/shared_examples/requests/api/rubygems_packages_shared_examples.rb @@ -151,7 +151,7 @@ RSpec.shared_examples 'dependency endpoint success' do |user_type, status, add_m context 'with gems params' do let(:params) { { gems: 'foo,bar' } } - let(:expected_response) { Marshal.dump(%w(result result)) } + let(:expected_response) { Marshal.dump(%w[result result]) } it 'returns successfully', :aggregate_failures do service_result = double('DependencyResolverService', execute: ServiceResponse.success(payload: 'result')) diff --git a/spec/support/shared_examples/services/container_registry_auth_service_shared_examples.rb b/spec/support/shared_examples/services/container_registry_auth_service_shared_examples.rb index 6abf8b242f1..f6be45b0cf8 100644 --- a/spec/support/shared_examples/services/container_registry_auth_service_shared_examples.rb +++ b/spec/support/shared_examples/services/container_registry_auth_service_shared_examples.rb @@ -127,7 +127,7 @@ end RSpec.shared_examples 'a pullable and pushable' do it_behaves_like 'an accessible' do - let(:actions) { %w(pull push) } + let(:actions) { %w[pull push] } end end diff --git a/spec/support/shared_examples/validators/url_validator_shared_examples.rb b/spec/support/shared_examples/validators/url_validator_shared_examples.rb index c5a775fefb6..8547845d0c3 100644 --- a/spec/support/shared_examples/validators/url_validator_shared_examples.rb +++ b/spec/support/shared_examples/validators/url_validator_shared_examples.rb @@ -24,7 +24,7 @@ RSpec.shared_examples 'url validator examples' do |schemes| end context 'with schemes' do - let(:options) { { schemes: %w(http) } } + let(:options) { { schemes: %w[http] } } it 'allows urls with the defined schemes' do subject diff --git a/spec/support_specs/graphql/arguments_spec.rb b/spec/support_specs/graphql/arguments_spec.rb index 925f8c15d68..d96d6985687 100644 --- a/spec/support_specs/graphql/arguments_spec.rb +++ b/spec/support_specs/graphql/arguments_spec.rb @@ -50,7 +50,7 @@ RSpec.describe Graphql::Arguments do hash: { a: 1, b: 2, c: 3 }, int: 42, float: 2.7, - string: %q[he said "no"], + string: %q(he said "no"), enum: :OFF, null: nil, bool_true: true, diff --git a/spec/support_specs/helpers/active_record/query_recorder_spec.rb b/spec/support_specs/helpers/active_record/query_recorder_spec.rb index d6c52b22449..5df88ca8209 100644 --- a/spec/support_specs/helpers/active_record/query_recorder_spec.rb +++ b/spec/support_specs/helpers/active_record/query_recorder_spec.rb @@ -47,7 +47,7 @@ RSpec.describe ActiveRecord::QueryRecorder do query_a = start_with(%q[QueryRecorder SQL: --> SELECT COUNT(*) FROM "schema_migrations"]) - query_b = start_with(%q[QueryRecorder SQL: --> SELECT "schema_migrations".* FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC LIMIT 1]) + query_b = start_with(%q(QueryRecorder SQL: --> SELECT "schema_migrations".* FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC LIMIT 1)) query_c_a = eq(%q[QueryRecorder SQL: --> SELECT "schema_migrations".* FROM "schema_migrations" WHERE (version = 'foo']) query_c_b = eq(%q(QueryRecorder SQL: --> OR)) diff --git a/spec/support_specs/matchers/exceed_query_limit_helpers_spec.rb b/spec/support_specs/matchers/exceed_query_limit_helpers_spec.rb index 19581064626..7c957586b10 100644 --- a/spec/support_specs/matchers/exceed_query_limit_helpers_spec.rb +++ b/spec/support_specs/matchers/exceed_query_limit_helpers_spec.rb @@ -147,17 +147,17 @@ RSpec.describe ExceedQueryLimitHelpers do test_matcher = TestMatcher.new recorder = ActiveRecord::QueryRecorder.new do - TestQueries.find_by(version: %w(foo bar baz).join("\n")) - TestQueries.find_by(version: %w(foo biz baz).join("\n")) - TestQueries.find_by(version: %w(foo bar baz).join("\n")) + TestQueries.find_by(version: %w[foo bar baz].join("\n")) + TestQueries.find_by(version: %w[foo biz baz].join("\n")) + TestQueries.find_by(version: %w[foo bar baz].join("\n")) end recorder.count expect(test_matcher.count_queries(recorder)).to eq({ 'SELECT "schema_migrations".* FROM "schema_migrations"' => { - %[WHERE "schema_migrations"."version" = 'foo\nbar\nbaz' LIMIT 1] => 2, - %[WHERE "schema_migrations"."version" = 'foo\nbiz\nbaz' LIMIT 1] => 1 + %(WHERE "schema_migrations"."version" = 'foo\nbar\nbaz' LIMIT 1) => 2, + %(WHERE "schema_migrations"."version" = 'foo\nbiz\nbaz' LIMIT 1) => 1 } }) end @@ -183,13 +183,13 @@ RSpec.describe ExceedQueryLimitHelpers do expect(test_matcher.count_queries(recorder)).to eq({ 'SELECT "schema_migrations".* FROM "schema_migrations"' => { - %q[WHERE "schema_migrations"."version" = 'foobar'] => 2, - %q[WHERE "schema_migrations"."version" = 'also foobar and baz'] => 1, - %q[ORDER BY "schema_migrations"."version" ASC LIMIT 1] => 1 + %q(WHERE "schema_migrations"."version" = 'foobar') => 2, + %q(WHERE "schema_migrations"."version" = 'also foobar and baz') => 1, + %q(ORDER BY "schema_migrations"."version" ASC LIMIT 1) => 1 }, 'SELECT COUNT(*) FROM "schema_migrations"' => { "" => 2, - %q[WHERE "schema_migrations"."version" = 'foobar'] => 1 + %q(WHERE "schema_migrations"."version" = 'foobar') => 1 }, 'SAVEPOINT active_record_1' => { "" => 1 }, 'INSERT INTO "schema_migrations" ("version")' => { @@ -197,11 +197,11 @@ RSpec.describe ExceedQueryLimitHelpers do }, 'RELEASE SAVEPOINT active_record_1' => { "" => 1 }, 'UPDATE "schema_migrations"' => { - %q[SET "version" = 'y' WHERE "schema_migrations"."version" = 'x'] => 1, - %q[SET "version" = 'z' WHERE "schema_migrations"."version" = 'y'] => 1 + %q(SET "version" = 'y' WHERE "schema_migrations"."version" = 'x') => 1, + %q(SET "version" = 'z' WHERE "schema_migrations"."version" = 'y') => 1 }, 'DELETE FROM "schema_migrations"' => { - %q[WHERE "schema_migrations"."version" = 'z'] => 1 + %q(WHERE "schema_migrations"."version" = 'z') => 1 } }) end |