diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-26 12:08:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-26 12:08:59 +0300 |
commit | 2f47b6d8e1cf97b3a0797fe9f249aa1ae38fc5a1 (patch) | |
tree | 7ed93e59215362d23b8f0827237a4b1e89fd2d1c /spec | |
parent | d15cc2684ce38f737bb46deff4eefe86a1f77cf6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
155 files changed, 590 insertions, 476 deletions
diff --git a/spec/controllers/groups/imports_controller_spec.rb b/spec/controllers/groups/imports_controller_spec.rb index eb43a62b75b..7372c2e9575 100644 --- a/spec/controllers/groups/imports_controller_spec.rb +++ b/spec/controllers/groups/imports_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Groups::ImportsController do +RSpec.describe Groups::ImportsController do describe 'GET #show' do let_it_be(:user) { create(:user) } let_it_be(:group) { create(:group, :private) } diff --git a/spec/controllers/projects/pipelines/tests_controller_spec.rb b/spec/controllers/projects/pipelines/tests_controller_spec.rb index 78d29e9825e..5be4e19f9f9 100644 --- a/spec/controllers/projects/pipelines/tests_controller_spec.rb +++ b/spec/controllers/projects/pipelines/tests_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Projects::Pipelines::TestsController do +RSpec.describe Projects::Pipelines::TestsController do let(:user) { create(:user) } let(:project) { create(:project, :public, :repository) } let(:pipeline) { create(:ci_pipeline, project: project) } diff --git a/spec/controllers/registrations/experience_levels_controller_spec.rb b/spec/controllers/registrations/experience_levels_controller_spec.rb index 8d5d594809b..5a217a3a684 100644 --- a/spec/controllers/registrations/experience_levels_controller_spec.rb +++ b/spec/controllers/registrations/experience_levels_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Registrations::ExperienceLevelsController do +RSpec.describe Registrations::ExperienceLevelsController do let_it_be(:namespace) { create(:group, path: 'group-path' ) } let_it_be(:user) { create(:user) } diff --git a/spec/features/groups/container_registry_spec.rb b/spec/features/groups/container_registry_spec.rb index 87ef2131211..acac8724edf 100644 --- a/spec/features/groups/container_registry_spec.rb +++ b/spec/features/groups/container_registry_spec.rb @@ -82,7 +82,7 @@ RSpec.describe 'Container Registry', :js do expect(service).to receive(:execute).with(container_repository) { { status: :success } } expect(Projects::ContainerRepository::DeleteTagsService).to receive(:new).with(container_repository.project, user, tags: ['latest']) { service } - first('[data-testid="singleDeleteButton"]').click + first('[data-testid="single-delete-button"]').click expect(find('.modal .modal-title')).to have_content _('Remove tag') find('.modal .modal-footer .btn-danger').click end diff --git a/spec/features/groups/import_export/import_file_spec.rb b/spec/features/groups/import_export/import_file_spec.rb index 577198ef3f1..ee4f2740f9f 100644 --- a/spec/features/groups/import_export/import_file_spec.rb +++ b/spec/features/groups/import_export/import_file_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'Import/Export - Group Import', :js do +RSpec.describe 'Import/Export - Group Import', :js do let_it_be(:user) { create(:user) } let_it_be(:import_path) { "#{Dir.tmpdir}/group_import_spec" } diff --git a/spec/features/projects/activity/user_sees_design_activity_spec.rb b/spec/features/projects/activity/user_sees_design_activity_spec.rb index 01b707b0ad7..27a52b87178 100644 --- a/spec/features/projects/activity/user_sees_design_activity_spec.rb +++ b/spec/features/projects/activity/user_sees_design_activity_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'Projects > Activity > User sees design Activity', :js do +RSpec.describe 'Projects > Activity > User sees design Activity', :js do include DesignManagementTestHelpers let_it_be(:uploader) { create(:user) } diff --git a/spec/features/projects/container_registry_spec.rb b/spec/features/projects/container_registry_spec.rb index f561149d2ad..7514a26f020 100644 --- a/spec/features/projects/container_registry_spec.rb +++ b/spec/features/projects/container_registry_spec.rb @@ -84,7 +84,7 @@ RSpec.describe 'Container Registry', :js do expect(service).to receive(:execute).with(container_repository) { { status: :success } } expect(Projects::ContainerRepository::DeleteTagsService).to receive(:new).with(container_repository.project, user, tags: ['1']) { service } - first('[data-testid="singleDeleteButton"]').click + first('[data-testid="single-delete-button"]').click expect(find('.modal .modal-title')).to have_content _('Remove tag') find('.modal .modal-footer .btn-danger').click end diff --git a/spec/frontend/registry/explorer/components/details_page/tags_list_row_spec.js b/spec/frontend/registry/explorer/components/details_page/tags_list_row_spec.js new file mode 100644 index 00000000000..833208c2a35 --- /dev/null +++ b/spec/frontend/registry/explorer/components/details_page/tags_list_row_spec.js @@ -0,0 +1,221 @@ +import { shallowMount } from '@vue/test-utils'; +import { GlFormCheckbox, GlSprintf } from '@gitlab/ui'; + +import component from '~/registry/explorer/components/details_page/tags_list_row.vue'; +import ListItem from '~/registry/explorer/components/list_item.vue'; +import DeleteButton from '~/registry/explorer/components/delete_button.vue'; +import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; +import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue'; +import { + REMOVE_TAG_BUTTON_TITLE, + REMOVE_TAG_BUTTON_DISABLE_TOOLTIP, +} from '~/registry/explorer/constants/index'; +import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; + +import { tagsListResponse } from '../../mock_data'; + +describe('tags list row', () => { + let wrapper; + const [tag] = [...tagsListResponse.data]; + + const defaultProps = { tag, isDesktop: true, index: 0 }; + + const findCheckbox = () => wrapper.find(GlFormCheckbox); + const findName = () => wrapper.find('[data-testid="name"]'); + const findSize = () => wrapper.find('[data-testid="size"]'); + const findTime = () => wrapper.find('[data-testid="time"]'); + const findShortRevision = () => wrapper.find('[data-testid="short-revision"]'); + const findClipboardButton = () => wrapper.find(ClipboardButton); + const findDeleteButton = () => wrapper.find(DeleteButton); + const findTimeAgoTooltip = () => wrapper.find(TimeAgoTooltip); + + const mountComponent = (propsData = defaultProps) => { + wrapper = shallowMount(component, { + stubs: { + GlSprintf, + ListItem, + }, + propsData, + directives: { + GlTooltip: createMockDirective(), + }, + }); + }; + + afterEach(() => { + wrapper.destroy(); + wrapper = null; + }); + + describe('checkbox', () => { + it('exists', () => { + mountComponent(); + + expect(findCheckbox().exists()).toBe(true); + }); + + it('is wired to the selected prop', () => { + mountComponent({ ...defaultProps, selected: true }); + + expect(findCheckbox().attributes('checked')).toBe('true'); + }); + + it('when changed emit a select event', () => { + mountComponent(); + + findCheckbox().vm.$emit('change'); + + expect(wrapper.emitted('select')).toEqual([[]]); + }); + }); + + describe('tag name', () => { + it('exists', () => { + mountComponent(); + + expect(findName().exists()).toBe(true); + }); + + it('has the correct text', () => { + mountComponent(); + + expect(findName().text()).toBe(tag.name); + }); + + it('has a tooltip', () => { + mountComponent(); + + const tooltip = getBinding(findName().element, 'gl-tooltip'); + + expect(tooltip.value.title).toBe(tag.name); + }); + + it('on mobile has mw-s class', () => { + mountComponent({ ...defaultProps, isDesktop: false }); + + expect(findName().classes('mw-s')).toBe(true); + }); + }); + + describe('clipboard button', () => { + it('exist if tag.location exist', () => { + mountComponent(); + + expect(findClipboardButton().exists()).toBe(true); + }); + + it('is hidden if tag does not have a location', () => { + mountComponent({ ...defaultProps, tag: { ...tag, location: null } }); + expect(findClipboardButton().exists()).toBe(false); + }); + + it('has the correct props/attributes', () => { + mountComponent(); + + expect(findClipboardButton().attributes()).toMatchObject({ + text: 'location', + title: 'location', + }); + }); + }); + + describe('size', () => { + it('exists', () => { + mountComponent(); + + expect(findSize().exists()).toBe(true); + }); + + it('contains the total_size and layers', () => { + mountComponent({ ...defaultProps, tag: { ...tag, total_size: 1024 } }); + expect(findSize().text()).toMatchInterpolatedText('1.00 KiB · 10 layers'); + }); + + it('when total_size is missing', () => { + mountComponent(); + expect(findSize().text()).toMatchInterpolatedText('10 layers'); + }); + + it('when layers are missing', () => { + mountComponent({ ...defaultProps, tag: { ...tag, total_size: 1024, layers: null } }); + expect(findSize().text()).toMatchInterpolatedText('1.00 KiB'); + }); + + it('when there is 1 layer', () => { + mountComponent({ ...defaultProps, tag: { ...tag, layers: 1 } }); + expect(findSize().text()).toMatchInterpolatedText('1 layer'); + }); + }); + + describe('time', () => { + it('exists', () => { + mountComponent(); + + expect(findTime().exists()).toBe(true); + }); + + it('has the correct text', () => { + mountComponent(); + + expect(findTime().text()).toBe('Published'); + }); + + it('contains time_ago_tooltip component', () => { + mountComponent(); + + expect(findTimeAgoTooltip().exists()).toBe(true); + }); + + it('pass the correct props to time ago tooltip', () => { + mountComponent(); + + expect(findTimeAgoTooltip().attributes()).toMatchObject({ time: tag.created_at }); + }); + }); + + describe('shortRevision', () => { + it('exists', () => { + mountComponent(); + + expect(findShortRevision().exists()).toBe(true); + }); + + it('has the correct text', () => { + mountComponent(); + + expect(findShortRevision().text()).toMatchInterpolatedText('Image ID: b118ab5b0'); + }); + }); + + describe('delete button', () => { + it('exists', () => { + mountComponent(); + + expect(findDeleteButton().exists()).toBe(true); + }); + + it('has the correct props/attributes', () => { + mountComponent(); + + expect(findDeleteButton().attributes()).toMatchObject({ + title: REMOVE_TAG_BUTTON_TITLE, + tooltiptitle: REMOVE_TAG_BUTTON_DISABLE_TOOLTIP, + tooltipdisabled: 'true', + }); + }); + + it('is disabled when tag has no destroy path', () => { + mountComponent({ ...defaultProps, tag: { ...tag, destroy_path: null } }); + + expect(findDeleteButton().attributes('disabled')).toBe('true'); + }); + + it('delete event emits delete', () => { + mountComponent(); + + findDeleteButton().vm.$emit('delete'); + + expect(wrapper.emitted('delete')).toEqual([[]]); + }); + }); +}); diff --git a/spec/frontend/registry/explorer/components/details_page/tags_list_spec.js b/spec/frontend/registry/explorer/components/details_page/tags_list_spec.js new file mode 100644 index 00000000000..182f64048fb --- /dev/null +++ b/spec/frontend/registry/explorer/components/details_page/tags_list_spec.js @@ -0,0 +1,138 @@ +import { shallowMount } from '@vue/test-utils'; +import { GlButton } from '@gitlab/ui'; +import component from '~/registry/explorer/components/details_page/tags_list.vue'; +import TagsListRow from '~/registry/explorer/components/details_page/tags_list_row.vue'; +import { TAGS_LIST_TITLE, REMOVE_TAGS_BUTTON_TITLE } from '~/registry/explorer/constants/index'; +import { tagsListResponse } from '../../mock_data'; + +describe('Tags List', () => { + let wrapper; + const tags = [...tagsListResponse.data]; + + const findTagsListRow = () => wrapper.findAll(TagsListRow); + const findDeleteButton = () => wrapper.find(GlButton); + const findListTitle = () => wrapper.find('[data-testid="list-title"]'); + + const mountComponent = (propsData = { tags, isDesktop: true }) => { + wrapper = shallowMount(component, { + propsData, + }); + }; + + afterEach(() => { + wrapper.destroy(); + wrapper = null; + }); + + describe('List title', () => { + it('exists', () => { + mountComponent(); + + expect(findListTitle().exists()).toBe(true); + }); + + it('has the correct text', () => { + mountComponent(); + + expect(findListTitle().text()).toBe(TAGS_LIST_TITLE); + }); + }); + + describe('delete button', () => { + it('is not shown on mobile view', () => { + mountComponent({ tags, isDesktop: false }); + + expect(findDeleteButton().exists()).toBe(false); + }); + + it('is shown on desktop view', () => { + mountComponent(); + + expect(findDeleteButton().exists()).toBe(true); + }); + + it('has the correct text', () => { + mountComponent(); + + expect(findDeleteButton().text()).toBe(REMOVE_TAGS_BUTTON_TITLE); + }); + + it('has the correct props', () => { + mountComponent(); + + expect(findDeleteButton().attributes()).toMatchObject({ + category: 'secondary', + variant: 'danger', + }); + }); + + it('is disabled when no item is selected', () => { + mountComponent(); + + expect(findDeleteButton().attributes('disabled')).toBe('true'); + }); + + it('is enabled when at least one item is selected', async () => { + mountComponent(); + findTagsListRow() + .at(0) + .vm.$emit('select'); + await wrapper.vm.$nextTick(); + expect(findDeleteButton().attributes('disabled')).toBe(undefined); + }); + + it('click event emits a deleted event with selected items', () => { + mountComponent(); + findTagsListRow() + .at(0) + .vm.$emit('select'); + + findDeleteButton().vm.$emit('click'); + expect(wrapper.emitted('delete')).toEqual([[{ centos6: true }]]); + }); + }); + + describe('list rows', () => { + it('one row exist for each tag', () => { + mountComponent(); + + expect(findTagsListRow()).toHaveLength(tags.length); + }); + + it('the correct props are bound to it', () => { + mountComponent(); + + expect( + findTagsListRow() + .at(0) + .attributes(), + ).toMatchObject({ + index: '0', + isdesktop: 'true', + }); + }); + + describe('events', () => { + it('select event update the selected items', async () => { + mountComponent(); + findTagsListRow() + .at(0) + .vm.$emit('select'); + await wrapper.vm.$nextTick(); + expect( + findTagsListRow() + .at(0) + .attributes('selected'), + ).toBe('true'); + }); + + it('delete event emit a delete event', () => { + mountComponent(); + findTagsListRow() + .at(0) + .vm.$emit('delete'); + expect(wrapper.emitted('delete')).toEqual([[{ centos6: true }]]); + }); + }); + }); +}); diff --git a/spec/frontend/registry/explorer/components/details_page/tags_table_spec.js b/spec/frontend/registry/explorer/components/details_page/tags_table_spec.js deleted file mode 100644 index a60a362dcfe..00000000000 --- a/spec/frontend/registry/explorer/components/details_page/tags_table_spec.js +++ /dev/null @@ -1,286 +0,0 @@ -import { mount } from '@vue/test-utils'; -import stubChildren from 'helpers/stub_children'; -import component from '~/registry/explorer/components/details_page/tags_table.vue'; -import { tagsListResponse } from '../../mock_data'; - -describe('tags_table', () => { - let wrapper; - const tags = [...tagsListResponse.data]; - - const findMainCheckbox = () => wrapper.find('[data-testid="mainCheckbox"]'); - const findFirstRowItem = testid => wrapper.find(`[data-testid="${testid}"]`); - const findBulkDeleteButton = () => wrapper.find('[data-testid="bulkDeleteButton"]'); - const findAllDeleteButtons = () => wrapper.findAll('[data-testid="singleDeleteButton"]'); - const findAllCheckboxes = () => wrapper.findAll('[data-testid="rowCheckbox"]'); - const findCheckedCheckboxes = () => findAllCheckboxes().filter(c => c.attributes('checked')); - const findFirsTagColumn = () => wrapper.find('.js-tag-column'); - const findFirstTagNameText = () => wrapper.find('[data-testid="rowNameText"]'); - - const findLoaderSlot = () => wrapper.find('[data-testid="loaderSlot"]'); - const findEmptySlot = () => wrapper.find('[data-testid="emptySlot"]'); - - const mountComponent = (propsData = { tags, isDesktop: true }) => { - wrapper = mount(component, { - stubs: { - ...stubChildren(component), - GlTable: false, - }, - propsData, - slots: { - loader: '<div data-testid="loaderSlot"></div>', - empty: '<div data-testid="emptySlot"></div>', - }, - }); - }; - - afterEach(() => { - wrapper.destroy(); - wrapper = null; - }); - - it.each([ - 'rowCheckbox', - 'rowName', - 'rowShortRevision', - 'rowSize', - 'rowTime', - 'singleDeleteButton', - ])('%s exist in the table', element => { - mountComponent(); - - expect(findFirstRowItem(element).exists()).toBe(true); - }); - - describe('header checkbox', () => { - it('exists', () => { - mountComponent(); - expect(findMainCheckbox().exists()).toBe(true); - }); - - it('if selected selects all the rows', () => { - mountComponent(); - findMainCheckbox().vm.$emit('change'); - return wrapper.vm.$nextTick().then(() => { - expect(findMainCheckbox().attributes('checked')).toBeTruthy(); - expect(findCheckedCheckboxes()).toHaveLength(tags.length); - }); - }); - - it('if deselect deselects all the row', () => { - mountComponent(); - findMainCheckbox().vm.$emit('change'); - return wrapper.vm - .$nextTick() - .then(() => { - expect(findMainCheckbox().attributes('checked')).toBeTruthy(); - findMainCheckbox().vm.$emit('change'); - return wrapper.vm.$nextTick(); - }) - .then(() => { - expect(findMainCheckbox().attributes('checked')).toBe(undefined); - expect(findCheckedCheckboxes()).toHaveLength(0); - }); - }); - }); - - describe('row checkbox', () => { - beforeEach(() => { - mountComponent(); - }); - - it('selecting and deselecting the checkbox works as intended', () => { - findFirstRowItem('rowCheckbox').vm.$emit('change'); - return wrapper.vm - .$nextTick() - .then(() => { - expect(wrapper.vm.selectedItems).toEqual([tags[0].name]); - expect(findFirstRowItem('rowCheckbox').attributes('checked')).toBeTruthy(); - findFirstRowItem('rowCheckbox').vm.$emit('change'); - return wrapper.vm.$nextTick(); - }) - .then(() => { - expect(wrapper.vm.selectedItems.length).toBe(0); - expect(findFirstRowItem('rowCheckbox').attributes('checked')).toBe(undefined); - }); - }); - }); - - describe('header delete button', () => { - beforeEach(() => { - mountComponent(); - }); - - it('exists', () => { - expect(findBulkDeleteButton().exists()).toBe(true); - }); - - it('is disabled if no item is selected', () => { - expect(findBulkDeleteButton().attributes('disabled')).toBe('true'); - }); - - it('is enabled if at least one item is selected', () => { - expect(findBulkDeleteButton().attributes('disabled')).toBe('true'); - findFirstRowItem('rowCheckbox').vm.$emit('change'); - return wrapper.vm.$nextTick().then(() => { - expect(findBulkDeleteButton().attributes('disabled')).toBeFalsy(); - }); - }); - - describe('on click', () => { - it('when one item is selected', () => { - findFirstRowItem('rowCheckbox').vm.$emit('change'); - findBulkDeleteButton().vm.$emit('click'); - expect(wrapper.emitted('delete')).toEqual([[['centos6']]]); - }); - - it('when multiple items are selected', () => { - findMainCheckbox().vm.$emit('change'); - findBulkDeleteButton().vm.$emit('click'); - - expect(wrapper.emitted('delete')).toEqual([[tags.map(t => t.name)]]); - }); - }); - }); - - describe('row delete button', () => { - beforeEach(() => { - mountComponent(); - }); - - it('exists', () => { - expect( - findAllDeleteButtons() - .at(0) - .exists(), - ).toBe(true); - }); - - it('is disabled if the item has no destroy_path', () => { - expect( - findAllDeleteButtons() - .at(1) - .attributes('disabled'), - ).toBe('true'); - }); - - it('on click', () => { - findAllDeleteButtons() - .at(0) - .vm.$emit('click'); - - expect(wrapper.emitted('delete')).toEqual([[['centos6']]]); - }); - }); - - describe('name cell', () => { - it('tag column has a tooltip with the tag name', () => { - mountComponent(); - expect(findFirstTagNameText().attributes('title')).toBe(tagsListResponse.data[0].name); - }); - - describe('on desktop viewport', () => { - beforeEach(() => { - mountComponent(); - }); - - it('table header has class w-25', () => { - expect(findFirsTagColumn().classes()).toContain('w-25'); - }); - - it('tag column has the mw-m class', () => { - expect(findFirstRowItem('rowName').classes()).toContain('mw-m'); - }); - }); - - describe('on mobile viewport', () => { - beforeEach(() => { - mountComponent({ tags, isDesktop: false }); - }); - - it('table header does not have class w-25', () => { - expect(findFirsTagColumn().classes()).not.toContain('w-25'); - }); - - it('tag column has the gl-justify-content-end class', () => { - expect(findFirstRowItem('rowName').classes()).toContain('gl-justify-content-end'); - }); - }); - }); - - describe('last updated cell', () => { - let timeCell; - - beforeEach(() => { - mountComponent(); - timeCell = findFirstRowItem('rowTime'); - }); - - it('displays the time in string format', () => { - expect(timeCell.text()).toBe('2 years ago'); - }); - - it('has a tooltip timestamp', () => { - expect(timeCell.attributes('title')).toBe('Sep 19, 2017 1:45pm GMT+0000'); - }); - }); - - describe('empty state slot', () => { - describe('when the table is empty', () => { - beforeEach(() => { - mountComponent({ tags: [], isDesktop: true }); - }); - - it('does not show table rows', () => { - expect(findFirstTagNameText().exists()).toBe(false); - }); - - it('has the empty state slot', () => { - expect(findEmptySlot().exists()).toBe(true); - }); - }); - - describe('when the table is not empty', () => { - beforeEach(() => { - mountComponent({ tags, isDesktop: true }); - }); - - it('does show table rows', () => { - expect(findFirstTagNameText().exists()).toBe(true); - }); - - it('does not show the empty state', () => { - expect(findEmptySlot().exists()).toBe(false); - }); - }); - }); - - describe('loader slot', () => { - describe('when the data is loading', () => { - beforeEach(() => { - mountComponent({ isLoading: true, tags }); - }); - - it('show the loader', () => { - expect(findLoaderSlot().exists()).toBe(true); - }); - - it('does not show the table rows', () => { - expect(findFirstTagNameText().exists()).toBe(false); - }); - }); - - describe('when the data is not loading', () => { - beforeEach(() => { - mountComponent({ isLoading: false, tags }); - }); - - it('does not show the loader', () => { - expect(findLoaderSlot().exists()).toBe(false); - }); - - it('shows the table rows', () => { - expect(findFirstTagNameText().exists()).toBe(true); - }); - }); - }); -}); diff --git a/spec/frontend/registry/explorer/components/list_item_spec.js b/spec/frontend/registry/explorer/components/list_item_spec.js index 99134ded3ed..9877bbe06bd 100644 --- a/spec/frontend/registry/explorer/components/list_item_spec.js +++ b/spec/frontend/registry/explorer/components/list_item_spec.js @@ -4,17 +4,23 @@ import component from '~/registry/explorer/components/list_item.vue'; describe('list item', () => { let wrapper; + const findLeftActionSlot = () => wrapper.find('[data-testid="left-action"]'); const findLeftPrimarySlot = () => wrapper.find('[data-testid="left-primary"]'); const findLeftSecondarySlot = () => wrapper.find('[data-testid="left-secondary"]'); - const findRightSlot = () => wrapper.find('[data-testid="right"]'); + const findRightPrimarySlot = () => wrapper.find('[data-testid="right-primary"]'); + const findRightSecondarySlot = () => wrapper.find('[data-testid="right-secondary"]'); + const findRightActionSlot = () => wrapper.find('[data-testid="right-action"]'); const mountComponent = propsData => { wrapper = shallowMount(component, { propsData, slots: { + 'left-action': '<div data-testid="left-action" />', 'left-primary': '<div data-testid="left-primary" />', 'left-secondary': '<div data-testid="left-secondary" />', - right: '<div data-testid="right" />', + 'right-primary': '<div data-testid="right-primary" />', + 'right-secondary': '<div data-testid="right-secondary" />', + 'right-action': '<div data-testid="right-action" />', }, }); }; @@ -24,29 +30,30 @@ describe('list item', () => { wrapper = null; }); - it('has a left primary slot', () => { + it.each` + slotName | finderFunction + ${'left-primary'} | ${findLeftPrimarySlot} + ${'left-secondary'} | ${findLeftSecondarySlot} + ${'right-primary'} | ${findRightPrimarySlot} + ${'right-secondary'} | ${findRightSecondarySlot} + ${'left-action'} | ${findLeftActionSlot} + ${'right-action'} | ${findRightActionSlot} + `('has a $slotName slot', ({ finderFunction }) => { mountComponent(); - expect(findLeftPrimarySlot().exists()).toBe(true); - }); - - it('has a left secondary slot', () => { - mountComponent(); - expect(findLeftSecondarySlot().exists()).toBe(true); - }); - it('has a right slot', () => { - mountComponent(); - expect(findRightSlot().exists()).toBe(true); + expect(finderFunction().exists()).toBe(true); }); describe('disabled prop', () => { it('when true applies disabled-content class', () => { mountComponent({ disabled: true }); + expect(wrapper.classes('disabled-content')).toBe(true); }); it('when false does not apply disabled-content class', () => { mountComponent({ disabled: false }); + expect(wrapper.classes('disabled-content')).toBe(false); }); }); @@ -54,15 +61,38 @@ describe('list item', () => { describe('index prop', () => { it('when index is 0 displays a top border', () => { mountComponent({ index: 0 }); + expect(wrapper.classes()).toEqual( expect.arrayContaining(['gl-border-t-solid', 'gl-border-t-1']), ); }); - it('when index is not 0 hides top border', () => { + it('when index is not 0 hides top border', () => { mountComponent({ index: 1 }); - expect(wrapper.classes('gl-border-t-solid')).toBe(false); - expect(wrapper.classes('gl-border-t-1')).toBe(false); + + expect(wrapper.classes()).toEqual( + expect.not.arrayContaining(['gl-border-t-solid', 'gl-border-t-1']), + ); + }); + }); + + describe('selected prop', () => { + it('when true applies the selected border and background', () => { + mountComponent({ selected: true }); + + expect(wrapper.classes()).toEqual( + expect.arrayContaining(['gl-bg-blue-50', 'gl-border-blue-200']), + ); + expect(wrapper.classes()).toEqual(expect.not.arrayContaining(['gl-border-gray-200'])); + }); + + it('when false applies the default border', () => { + mountComponent({ selected: false }); + + expect(wrapper.classes()).toEqual( + expect.not.arrayContaining(['gl-bg-blue-50', 'gl-border-blue-200']), + ); + expect(wrapper.classes()).toEqual(expect.arrayContaining(['gl-border-gray-200'])); }); }); }); diff --git a/spec/frontend/registry/explorer/mock_data.js b/spec/frontend/registry/explorer/mock_data.js index e2b33826503..e1b39f65961 100644 --- a/spec/frontend/registry/explorer/mock_data.js +++ b/spec/frontend/registry/explorer/mock_data.js @@ -71,7 +71,7 @@ export const tagsListResponse = { layers: 10, location: 'location', path: 'bar', - created_at: 1505828744434, + created_at: '1505828744434', destroy_path: 'path', }, { @@ -82,7 +82,7 @@ export const tagsListResponse = { layers: 10, path: 'foo', location: 'location-2', - created_at: 1505828744434, + created_at: '1505828744434', }, ], headers, diff --git a/spec/frontend/registry/explorer/pages/details_spec.js b/spec/frontend/registry/explorer/pages/details_spec.js index b7e01cad9bc..9bc0bae5c23 100644 --- a/spec/frontend/registry/explorer/pages/details_spec.js +++ b/spec/frontend/registry/explorer/pages/details_spec.js @@ -5,6 +5,7 @@ import component from '~/registry/explorer/pages/details.vue'; import DeleteAlert from '~/registry/explorer/components/details_page/delete_alert.vue'; import DetailsHeader from '~/registry/explorer/components/details_page/details_header.vue'; import TagsLoader from '~/registry/explorer/components/details_page/tags_loader.vue'; +import TagsList from '~/registry/explorer/components/details_page/tags_list.vue'; import EmptyTagsState from '~/registry/explorer/components/details_page/empty_tags_state.vue'; import { createStore } from '~/registry/explorer/stores/'; import { @@ -15,7 +16,7 @@ import { } from '~/registry/explorer/stores/mutation_types/'; import { tagsListResponse } from '../mock_data'; -import { TagsTable, DeleteModal } from '../stubs'; +import { DeleteModal } from '../stubs'; describe('Details Page', () => { let wrapper; @@ -25,18 +26,23 @@ describe('Details Page', () => { const findDeleteModal = () => wrapper.find(DeleteModal); const findPagination = () => wrapper.find(GlPagination); const findTagsLoader = () => wrapper.find(TagsLoader); - const findTagsTable = () => wrapper.find(TagsTable); + const findTagsList = () => wrapper.find(TagsList); const findDeleteAlert = () => wrapper.find(DeleteAlert); const findDetailsHeader = () => wrapper.find(DetailsHeader); const findEmptyTagsState = () => wrapper.find(EmptyTagsState); const routeId = window.btoa(JSON.stringify({ name: 'foo', tags_path: 'bar' })); + const tagsArrayToSelectedTags = tags => + tags.reduce((acc, c) => { + acc[c.name] = true; + return acc; + }, {}); + const mountComponent = options => { wrapper = shallowMount(component, { store, stubs: { - TagsTable, DeleteModal, }, mocks: { @@ -66,15 +72,18 @@ describe('Details Page', () => { describe('when isLoading is true', () => { beforeEach(() => { - mountComponent(); store.commit(SET_MAIN_LOADING, true); - return wrapper.vm.$nextTick(); + mountComponent(); }); afterEach(() => store.commit(SET_MAIN_LOADING, false)); - it('binds isLoading to tags-table', () => { - expect(findTagsTable().props('isLoading')).toBe(true); + it('shows the loader', () => { + expect(findTagsLoader().exists()).toBe(true); + }); + + it('does not show the list', () => { + expect(findTagsList().exists()).toBe(false); }); it('does not show pagination', () => { @@ -82,8 +91,9 @@ describe('Details Page', () => { }); }); - describe('table slots', () => { + describe('when the list of tags is empty', () => { beforeEach(() => { + store.commit(SET_TAGS_LIST_SUCCESS, []); mountComponent(); }); @@ -91,32 +101,37 @@ describe('Details Page', () => { expect(findEmptyTagsState().exists()).toBe(true); }); - it('has a skeleton loader', () => { - expect(findTagsLoader().exists()).toBe(true); + it('does not show the loader', () => { + expect(findTagsLoader().exists()).toBe(false); + }); + + it('does not show the list', () => { + expect(findTagsList().exists()).toBe(false); }); }); - describe('table', () => { + describe('list', () => { beforeEach(() => { mountComponent(); }); it('exists', () => { - expect(findTagsTable().exists()).toBe(true); + expect(findTagsList().exists()).toBe(true); }); it('has the correct props bound', () => { - expect(findTagsTable().props()).toMatchObject({ + expect(findTagsList().props()).toMatchObject({ isDesktop: true, - isLoading: false, tags: store.state.tags, }); }); describe('deleteEvent', () => { describe('single item', () => { + let tagToBeDeleted; beforeEach(() => { - findTagsTable().vm.$emit('delete', [store.state.tags[0].name]); + [tagToBeDeleted] = store.state.tags; + findTagsList().vm.$emit('delete', { [tagToBeDeleted.name]: true }); }); it('open the modal', () => { @@ -124,7 +139,7 @@ describe('Details Page', () => { }); it('maps the selection to itemToBeDeleted', () => { - expect(wrapper.vm.itemsToBeDeleted).toEqual([store.state.tags[0]]); + expect(wrapper.vm.itemsToBeDeleted).toEqual([tagToBeDeleted]); }); it('tracks a single delete event', () => { @@ -136,7 +151,7 @@ describe('Details Page', () => { describe('multiple items', () => { beforeEach(() => { - findTagsTable().vm.$emit('delete', store.state.tags.map(t => t.name)); + findTagsList().vm.$emit('delete', tagsArrayToSelectedTags(store.state.tags)); }); it('open the modal', () => { @@ -202,7 +217,7 @@ describe('Details Page', () => { describe('when one item is selected to be deleted', () => { beforeEach(() => { mountComponent(); - findTagsTable().vm.$emit('delete', [store.state.tags[0].name]); + findTagsList().vm.$emit('delete', { [store.state.tags[0].name]: true }); }); it('dispatch requestDeleteTag with the right parameters', () => { @@ -217,7 +232,7 @@ describe('Details Page', () => { describe('when more than one item is selected to be deleted', () => { beforeEach(() => { mountComponent(); - findTagsTable().vm.$emit('delete', store.state.tags.map(t => t.name)); + findTagsList().vm.$emit('delete', tagsArrayToSelectedTags(store.state.tags)); }); it('dispatch requestDeleteTags with the right parameters', () => { diff --git a/spec/frontend/registry/explorer/stubs.js b/spec/frontend/registry/explorer/stubs.js index d3518c36c82..fae821014be 100644 --- a/spec/frontend/registry/explorer/stubs.js +++ b/spec/frontend/registry/explorer/stubs.js @@ -1,4 +1,3 @@ -import RealTagsTable from '~/registry/explorer/components/details_page/tags_table.vue'; import RealDeleteModal from '~/registry/explorer/components/details_page/delete_modal.vue'; export const GlModal = { @@ -18,11 +17,6 @@ export const RouterLink = { props: ['to'], }; -export const TagsTable = { - props: RealTagsTable.props, - template: `<div><slot name="empty"></slot><slot name="loader"></slot></div>`, -}; - export const DeleteModal = { template: '<div></div>', methods: { diff --git a/spec/graphql/mutations/alert_management/alerts/set_assignees_spec.rb b/spec/graphql/mutations/alert_management/alerts/set_assignees_spec.rb index a025b3d344a..f8b61c5064a 100644 --- a/spec/graphql/mutations/alert_management/alerts/set_assignees_spec.rb +++ b/spec/graphql/mutations/alert_management/alerts/set_assignees_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Mutations::AlertManagement::Alerts::SetAssignees do +RSpec.describe Mutations::AlertManagement::Alerts::SetAssignees do let_it_be(:starting_assignee) { create(:user) } let_it_be(:unassigned_user) { create(:user) } let_it_be(:alert) { create(:alert_management_alert, assignees: [starting_assignee]) } diff --git a/spec/graphql/mutations/container_expiration_policies/update_spec.rb b/spec/graphql/mutations/container_expiration_policies/update_spec.rb index fc90f437576..6aedaab3b53 100644 --- a/spec/graphql/mutations/container_expiration_policies/update_spec.rb +++ b/spec/graphql/mutations/container_expiration_policies/update_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Mutations::ContainerExpirationPolicies::Update do +RSpec.describe Mutations::ContainerExpirationPolicies::Update do using RSpec::Parameterized::TableSyntax let_it_be(:project, reload: true) { create(:project) } diff --git a/spec/graphql/resolvers/concerns/looks_ahead_spec.rb b/spec/graphql/resolvers/concerns/looks_ahead_spec.rb index 8b83f887846..f13823085b8 100644 --- a/spec/graphql/resolvers/concerns/looks_ahead_spec.rb +++ b/spec/graphql/resolvers/concerns/looks_ahead_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe LooksAhead do +RSpec.describe LooksAhead do include GraphqlHelpers let_it_be(:the_user) { create(:user) } diff --git a/spec/graphql/resolvers/project_members_resolver_spec.rb b/spec/graphql/resolvers/project_members_resolver_spec.rb index 3209838850b..602225cf632 100644 --- a/spec/graphql/resolvers/project_members_resolver_spec.rb +++ b/spec/graphql/resolvers/project_members_resolver_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Resolvers::ProjectMembersResolver do +RSpec.describe Resolvers::ProjectMembersResolver do include GraphqlHelpers context "with a group" do diff --git a/spec/graphql/resolvers/project_pipeline_resolver_spec.rb b/spec/graphql/resolvers/project_pipeline_resolver_spec.rb index 72049f16d7d..a659b3bdb6e 100644 --- a/spec/graphql/resolvers/project_pipeline_resolver_spec.rb +++ b/spec/graphql/resolvers/project_pipeline_resolver_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Resolvers::ProjectPipelineResolver do +RSpec.describe Resolvers::ProjectPipelineResolver do include GraphqlHelpers let_it_be(:project) { create(:project) } diff --git a/spec/graphql/resolvers/users_resolver_spec.rb b/spec/graphql/resolvers/users_resolver_spec.rb index e752500d52f..e3d595e0790 100644 --- a/spec/graphql/resolvers/users_resolver_spec.rb +++ b/spec/graphql/resolvers/users_resolver_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Resolvers::UsersResolver do +RSpec.describe Resolvers::UsersResolver do include GraphqlHelpers let_it_be(:user1) { create(:user) } diff --git a/spec/graphql/types/access_level_enum_spec.rb b/spec/graphql/types/access_level_enum_spec.rb index 05a6d6d5545..eeb10a50b7e 100644 --- a/spec/graphql/types/access_level_enum_spec.rb +++ b/spec/graphql/types/access_level_enum_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe GitlabSchema.types['AccessLevelEnum'] do +RSpec.describe GitlabSchema.types['AccessLevelEnum'] do specify { expect(described_class.graphql_name).to eq('AccessLevelEnum') } it 'exposes all the existing access levels' do diff --git a/spec/graphql/types/access_level_type_spec.rb b/spec/graphql/types/access_level_type_spec.rb index b9711a9aa4b..25707ae160d 100644 --- a/spec/graphql/types/access_level_type_spec.rb +++ b/spec/graphql/types/access_level_type_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'spec_helper' -describe GitlabSchema.types['AccessLevel'] do +RSpec.describe GitlabSchema.types['AccessLevel'] do specify { expect(described_class.graphql_name).to eq('AccessLevel') } specify { expect(described_class).to require_graphql_authorizations(nil) } diff --git a/spec/graphql/types/evidence_type_spec.rb b/spec/graphql/types/evidence_type_spec.rb index 4a11f7bcda9..92134e74d51 100644 --- a/spec/graphql/types/evidence_type_spec.rb +++ b/spec/graphql/types/evidence_type_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe GitlabSchema.types['ReleaseEvidence'] do +RSpec.describe GitlabSchema.types['ReleaseEvidence'] do it { expect(described_class).to require_graphql_authorizations(:download_code) } it 'has the expected fields' do diff --git a/spec/graphql/types/group_member_type_spec.rb b/spec/graphql/types/group_member_type_spec.rb index 5d09e60d21c..b1cb8e572ad 100644 --- a/spec/graphql/types/group_member_type_spec.rb +++ b/spec/graphql/types/group_member_type_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Types::GroupMemberType do +RSpec.describe Types::GroupMemberType do specify { expect(described_class).to expose_permissions_using(Types::PermissionTypes::Group) } specify { expect(described_class.graphql_name).to eq('GroupMember') } diff --git a/spec/graphql/types/milestone_stats_type_spec.rb b/spec/graphql/types/milestone_stats_type_spec.rb index 62c2c2ca058..1ccb275c922 100644 --- a/spec/graphql/types/milestone_stats_type_spec.rb +++ b/spec/graphql/types/milestone_stats_type_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe GitlabSchema.types['MilestoneStats'] do +RSpec.describe GitlabSchema.types['MilestoneStats'] do it { expect(described_class).to require_graphql_authorizations(:read_milestone) } it 'has the expected fields' do diff --git a/spec/graphql/types/project_member_type_spec.rb b/spec/graphql/types/project_member_type_spec.rb index 1b1f6c24a32..65c89557ec1 100644 --- a/spec/graphql/types/project_member_type_spec.rb +++ b/spec/graphql/types/project_member_type_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Types::ProjectMemberType do +RSpec.describe Types::ProjectMemberType do specify { expect(described_class).to expose_permissions_using(Types::PermissionTypes::Project) } specify { expect(described_class.graphql_name).to eq('ProjectMember') } diff --git a/spec/graphql/types/release_asset_link_type_spec.rb b/spec/graphql/types/release_asset_link_type_spec.rb index 4da630c6500..679431012cf 100644 --- a/spec/graphql/types/release_asset_link_type_spec.rb +++ b/spec/graphql/types/release_asset_link_type_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe GitlabSchema.types['ReleaseAssetLink'] do +RSpec.describe GitlabSchema.types['ReleaseAssetLink'] do it { expect(described_class).to require_graphql_authorizations(:read_release) } it 'has the expected fields' do diff --git a/spec/graphql/types/snippets/file_input_action_enum_spec.rb b/spec/graphql/types/snippets/file_input_action_enum_spec.rb index 2ccc8b04b8f..ff9b706240b 100644 --- a/spec/graphql/types/snippets/file_input_action_enum_spec.rb +++ b/spec/graphql/types/snippets/file_input_action_enum_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Types::Snippets::FileInputActionEnum do +RSpec.describe Types::Snippets::FileInputActionEnum do specify { expect(described_class.graphql_name).to eq('SnippetFileInputActionEnum') } it 'exposes all file input action types' do diff --git a/spec/graphql/types/snippets/file_input_type_spec.rb b/spec/graphql/types/snippets/file_input_type_spec.rb index 62e5caf20b7..c7d4909b542 100644 --- a/spec/graphql/types/snippets/file_input_type_spec.rb +++ b/spec/graphql/types/snippets/file_input_type_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Types::Snippets::FileInputType do +RSpec.describe Types::Snippets::FileInputType do specify { expect(described_class.graphql_name).to eq('SnippetFileInputType') } it 'has the correct arguments' do diff --git a/spec/graphql/types/untrusted_regexp_spec.rb b/spec/graphql/types/untrusted_regexp_spec.rb index 2aaf51bdaf4..c801c62fbdc 100644 --- a/spec/graphql/types/untrusted_regexp_spec.rb +++ b/spec/graphql/types/untrusted_regexp_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe GitlabSchema.types['UntrustedRegexp'] do +RSpec.describe GitlabSchema.types['UntrustedRegexp'] do using RSpec::Parameterized::TableSyntax specify { expect(described_class.graphql_name).to eq('UntrustedRegexp') } diff --git a/spec/helpers/analytics/unique_visits_helper_spec.rb b/spec/helpers/analytics/unique_visits_helper_spec.rb index 4e0710d0b7f..ff9769078c4 100644 --- a/spec/helpers/analytics/unique_visits_helper_spec.rb +++ b/spec/helpers/analytics/unique_visits_helper_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" -describe Analytics::UniqueVisitsHelper do +RSpec.describe Analytics::UniqueVisitsHelper do include Devise::Test::ControllerHelpers describe '#track_visit' do diff --git a/spec/helpers/subscribable_banner_helper_spec.rb b/spec/helpers/subscribable_banner_helper_spec.rb index 75f2e32d7d8..3f9ea989fb0 100644 --- a/spec/helpers/subscribable_banner_helper_spec.rb +++ b/spec/helpers/subscribable_banner_helper_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe SubscribableBannerHelper do +RSpec.describe SubscribableBannerHelper do describe '#display_subscription_banner!' do it 'is over-written in EE' do expect { helper.display_subscription_banner! }.not_to raise_error diff --git a/spec/lib/api/entities/deploy_key_spec.rb b/spec/lib/api/entities/deploy_key_spec.rb index 704dabae63b..6427d6eac8f 100644 --- a/spec/lib/api/entities/deploy_key_spec.rb +++ b/spec/lib/api/entities/deploy_key_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe API::Entities::DeployKey do +RSpec.describe API::Entities::DeployKey do describe '#as_json' do subject { entity.as_json } diff --git a/spec/lib/api/entities/deploy_keys_project_spec.rb b/spec/lib/api/entities/deploy_keys_project_spec.rb index a357467d7ce..57ffdc55736 100644 --- a/spec/lib/api/entities/deploy_keys_project_spec.rb +++ b/spec/lib/api/entities/deploy_keys_project_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe API::Entities::DeployKeysProject do +RSpec.describe API::Entities::DeployKeysProject do describe '#as_json' do subject { entity.as_json } diff --git a/spec/lib/api/entities/ssh_key_spec.rb b/spec/lib/api/entities/ssh_key_spec.rb index 25a0fecfb75..768ad416fbe 100644 --- a/spec/lib/api/entities/ssh_key_spec.rb +++ b/spec/lib/api/entities/ssh_key_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe API::Entities::SSHKey do +RSpec.describe API::Entities::SSHKey do describe '#as_json' do subject { entity.as_json } diff --git a/spec/lib/api/validations/validators/untrusted_regexp_spec.rb b/spec/lib/api/validations/validators/untrusted_regexp_spec.rb index 491bf94fd79..def67c94de0 100644 --- a/spec/lib/api/validations/validators/untrusted_regexp_spec.rb +++ b/spec/lib/api/validations/validators/untrusted_regexp_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe API::Validations::Validators::UntrustedRegexp do +RSpec.describe API::Validations::Validators::UntrustedRegexp do include ApiValidatorsHelpers subject do diff --git a/spec/lib/banzai/filter/jira_import/adf_to_commonmark_filter_spec.rb b/spec/lib/banzai/filter/jira_import/adf_to_commonmark_filter_spec.rb index debb9493c23..287b5774048 100644 --- a/spec/lib/banzai/filter/jira_import/adf_to_commonmark_filter_spec.rb +++ b/spec/lib/banzai/filter/jira_import/adf_to_commonmark_filter_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Banzai::Filter::JiraImport::AdfToCommonmarkFilter do +RSpec.describe Banzai::Filter::JiraImport::AdfToCommonmarkFilter do include FilterSpecHelper let_it_be(:fixtures_path) { 'lib/kramdown/atlassian_document_format' } diff --git a/spec/lib/banzai/pipeline/jira_import/adf_commonmark_pipeline_spec.rb b/spec/lib/banzai/pipeline/jira_import/adf_commonmark_pipeline_spec.rb index 7eaf886f22e..d8841a9753e 100644 --- a/spec/lib/banzai/pipeline/jira_import/adf_commonmark_pipeline_spec.rb +++ b/spec/lib/banzai/pipeline/jira_import/adf_commonmark_pipeline_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Banzai::Pipeline::JiraImport::AdfCommonmarkPipeline do +RSpec.describe Banzai::Pipeline::JiraImport::AdfCommonmarkPipeline do let_it_be(:fixtures_path) { 'lib/kramdown/atlassian_document_format' } it 'converts text in Atlassian Document Format ' do diff --git a/spec/lib/extracts_ref_spec.rb b/spec/lib/extracts_ref_spec.rb index 1867f639711..ca2f1fd7dc1 100644 --- a/spec/lib/extracts_ref_spec.rb +++ b/spec/lib/extracts_ref_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe ExtractsRef do +RSpec.describe ExtractsRef do include described_class include RepoHelpers diff --git a/spec/lib/gitlab/analytics/unique_visits_spec.rb b/spec/lib/gitlab/analytics/unique_visits_spec.rb index b43cd35d98f..ff3623a3a71 100644 --- a/spec/lib/gitlab/analytics/unique_visits_spec.rb +++ b/spec/lib/gitlab/analytics/unique_visits_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Analytics::UniqueVisits, :clean_gitlab_redis_shared_state do +RSpec.describe Gitlab::Analytics::UniqueVisits, :clean_gitlab_redis_shared_state do let(:unique_visits) { Gitlab::Analytics::UniqueVisits.new } let(:target1_id) { 'g_analytics_contribution' } let(:target2_id) { 'g_analytics_insights' } diff --git a/spec/lib/gitlab/ci/build/releaser_spec.rb b/spec/lib/gitlab/ci/build/releaser_spec.rb index 8c29c08db78..fa5e90674a6 100644 --- a/spec/lib/gitlab/ci/build/releaser_spec.rb +++ b/spec/lib/gitlab/ci/build/releaser_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Build::Releaser do +RSpec.describe Gitlab::Ci::Build::Releaser do subject { described_class.new(config: config[:release]).script } describe '#script' do diff --git a/spec/lib/gitlab/ci/reports/test_report_summary_spec.rb b/spec/lib/gitlab/ci/reports/test_report_summary_spec.rb index 34ca5c764d2..70d82851125 100644 --- a/spec/lib/gitlab/ci/reports/test_report_summary_spec.rb +++ b/spec/lib/gitlab/ci/reports/test_report_summary_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Reports::TestReportSummary do +RSpec.describe Gitlab::Ci::Reports::TestReportSummary do let(:build_report_result_1) { build(:ci_build_report_result) } let(:build_report_result_2) { build(:ci_build_report_result, :with_junit_success) } let(:test_report_summary) { described_class.new([build_report_result_1, build_report_result_2]) } diff --git a/spec/lib/gitlab/ci/reports/test_suite_summary_spec.rb b/spec/lib/gitlab/ci/reports/test_suite_summary_spec.rb index 5bbef62b43d..b2192e24513 100644 --- a/spec/lib/gitlab/ci/reports/test_suite_summary_spec.rb +++ b/spec/lib/gitlab/ci/reports/test_suite_summary_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Ci::Reports::TestSuiteSummary do +RSpec.describe Gitlab::Ci::Reports::TestSuiteSummary do let(:build_report_result_1) { build(:ci_build_report_result) } let(:build_report_result_2) { build(:ci_build_report_result, :with_junit_success) } let(:test_suite_summary) { described_class.new([build_report_result_1, build_report_result_2]) } diff --git a/spec/lib/gitlab/data_builder/alert_spec.rb b/spec/lib/gitlab/data_builder/alert_spec.rb index b881fb8139b..6c3dc3cd8b4 100644 --- a/spec/lib/gitlab/data_builder/alert_spec.rb +++ b/spec/lib/gitlab/data_builder/alert_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::DataBuilder::Alert do +RSpec.describe Gitlab::DataBuilder::Alert do let_it_be(:project) { create(:project) } let_it_be(:alert) { create(:alert_management_alert, project: project) } diff --git a/spec/lib/gitlab/database/custom_structure_spec.rb b/spec/lib/gitlab/database/custom_structure_spec.rb index f03b5ed0a7f..beda9df3684 100644 --- a/spec/lib/gitlab/database/custom_structure_spec.rb +++ b/spec/lib/gitlab/database/custom_structure_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Database::CustomStructure do +RSpec.describe Gitlab::Database::CustomStructure do let_it_be(:structure) { described_class.new } let_it_be(:filepath) { Rails.root.join(described_class::CUSTOM_DUMP_FILE) } let_it_be(:file_header) do diff --git a/spec/lib/gitlab/database/dynamic_model_helpers_spec.rb b/spec/lib/gitlab/database/dynamic_model_helpers_spec.rb index c0dc14a3f4f..23ad621d0ee 100644 --- a/spec/lib/gitlab/database/dynamic_model_helpers_spec.rb +++ b/spec/lib/gitlab/database/dynamic_model_helpers_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Database::DynamicModelHelpers do +RSpec.describe Gitlab::Database::DynamicModelHelpers do describe '#define_batchable_model' do subject { including_class.new.define_batchable_model(table_name) } diff --git a/spec/lib/gitlab/database/migrations/background_migration_helpers_spec.rb b/spec/lib/gitlab/database/migrations/background_migration_helpers_spec.rb index 1b1ac0cb387..26c4f67bd03 100644 --- a/spec/lib/gitlab/database/migrations/background_migration_helpers_spec.rb +++ b/spec/lib/gitlab/database/migrations/background_migration_helpers_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Database::Migrations::BackgroundMigrationHelpers do +RSpec.describe Gitlab::Database::Migrations::BackgroundMigrationHelpers do let(:model) do ActiveRecord::Migration.new.extend(described_class) end diff --git a/spec/lib/gitlab/database/partitioning_migration_helpers/backfill_partitioned_table_spec.rb b/spec/lib/gitlab/database/partitioning_migration_helpers/backfill_partitioned_table_spec.rb index 2016c31b891..16636450239 100644 --- a/spec/lib/gitlab/database/partitioning_migration_helpers/backfill_partitioned_table_spec.rb +++ b/spec/lib/gitlab/database/partitioning_migration_helpers/backfill_partitioned_table_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Database::PartitioningMigrationHelpers::BackfillPartitionedTable, '#perform' do +RSpec.describe Gitlab::Database::PartitioningMigrationHelpers::BackfillPartitionedTable, '#perform' do subject { described_class.new } let(:source_table) { '_test_partitioning_backfills' } diff --git a/spec/lib/gitlab/dependency_linker/go_mod_linker_spec.rb b/spec/lib/gitlab/dependency_linker/go_mod_linker_spec.rb index 769daa0b3a6..605b14bc923 100644 --- a/spec/lib/gitlab/dependency_linker/go_mod_linker_spec.rb +++ b/spec/lib/gitlab/dependency_linker/go_mod_linker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::DependencyLinker::GoModLinker do +RSpec.describe Gitlab::DependencyLinker::GoModLinker do let(:file_name) { 'go.mod' } let(:file_content) do <<-CONTENT.strip_heredoc diff --git a/spec/lib/gitlab/dependency_linker/go_sum_linker_spec.rb b/spec/lib/gitlab/dependency_linker/go_sum_linker_spec.rb index f5cb7809ad3..2836c0e9f29 100644 --- a/spec/lib/gitlab/dependency_linker/go_sum_linker_spec.rb +++ b/spec/lib/gitlab/dependency_linker/go_sum_linker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::DependencyLinker::GoSumLinker do +RSpec.describe Gitlab::DependencyLinker::GoSumLinker do let(:file_name) { 'go.sum' } let(:file_content) do <<-CONTENT.strip_heredoc diff --git a/spec/lib/gitlab/diff/stats_cache_spec.rb b/spec/lib/gitlab/diff/stats_cache_spec.rb index 1de6fa0aab4..8bf510c0bdd 100644 --- a/spec/lib/gitlab/diff/stats_cache_spec.rb +++ b/spec/lib/gitlab/diff/stats_cache_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Diff::StatsCache, :use_clean_rails_memory_store_caching do +RSpec.describe Gitlab::Diff::StatsCache, :use_clean_rails_memory_store_caching do subject(:stats_cache) { described_class.new(cachable_key: cachable_key) } let(:key) { ['diff_stats', cachable_key, described_class::VERSION].join(":") } diff --git a/spec/lib/gitlab/doctor/secrets_spec.rb b/spec/lib/gitlab/doctor/secrets_spec.rb index f118519fd9f..b9e054ce14f 100644 --- a/spec/lib/gitlab/doctor/secrets_spec.rb +++ b/spec/lib/gitlab/doctor/secrets_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Doctor::Secrets do +RSpec.describe Gitlab::Doctor::Secrets do let!(:user) { create(:user, otp_secret: "test") } let!(:group) { create(:group, runners_token: "test") } let(:logger) { double(:logger).as_null_object } diff --git a/spec/lib/gitlab/emoji_spec.rb b/spec/lib/gitlab/emoji_spec.rb index da672ae0572..6cd79b25e55 100644 --- a/spec/lib/gitlab/emoji_spec.rb +++ b/spec/lib/gitlab/emoji_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Emoji do +RSpec.describe Gitlab::Emoji do let_it_be(:emojis) { Gemojione.index.instance_variable_get(:@emoji_by_name) } let_it_be(:emojis_by_moji) { Gemojione.index.instance_variable_get(:@emoji_by_moji) } let_it_be(:emoji_unicode_versions_by_name) { Gitlab::Json.parse(File.read(Rails.root.join('fixtures', 'emojis', 'emoji-unicode-version-map.json'))) } diff --git a/spec/lib/gitlab/git_access_project_spec.rb b/spec/lib/gitlab/git_access_project_spec.rb index f7f7976ccb8..520300363c9 100644 --- a/spec/lib/gitlab/git_access_project_spec.rb +++ b/spec/lib/gitlab/git_access_project_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::GitAccessProject do +RSpec.describe Gitlab::GitAccessProject do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project, :repository) } let(:actor) { user } diff --git a/spec/lib/gitlab/graphql/mount_mutation_spec.rb b/spec/lib/gitlab/graphql/mount_mutation_spec.rb index 9265e078a5a..d6b932e08d2 100644 --- a/spec/lib/gitlab/graphql/mount_mutation_spec.rb +++ b/spec/lib/gitlab/graphql/mount_mutation_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'spec_helper' -describe Gitlab::Graphql::MountMutation do +RSpec.describe Gitlab::Graphql::MountMutation do let_it_be(:mutation) do Class.new(Mutations::BaseMutation) do graphql_name 'TestMutation' diff --git a/spec/lib/gitlab/instrumentation/redis_base_spec.rb b/spec/lib/gitlab/instrumentation/redis_base_spec.rb index 5ea8f00114e..07be0ccf6e9 100644 --- a/spec/lib/gitlab/instrumentation/redis_base_spec.rb +++ b/spec/lib/gitlab/instrumentation/redis_base_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Instrumentation::RedisBase, :request_store do +RSpec.describe Gitlab::Instrumentation::RedisBase, :request_store do let(:instrumentation_class_a) do stub_const('InstanceA', Class.new(described_class)) end diff --git a/spec/lib/gitlab/instrumentation/redis_cluster_validator_spec.rb b/spec/lib/gitlab/instrumentation/redis_cluster_validator_spec.rb index 6aa23118fcc..2ca7465e775 100644 --- a/spec/lib/gitlab/instrumentation/redis_cluster_validator_spec.rb +++ b/spec/lib/gitlab/instrumentation/redis_cluster_validator_spec.rb @@ -4,7 +4,7 @@ require 'fast_spec_helper' require 'support/helpers/rails_helpers' require 'rspec-parameterized' -describe Gitlab::Instrumentation::RedisClusterValidator do +RSpec.describe Gitlab::Instrumentation::RedisClusterValidator do include RailsHelpers describe '.validate!' do diff --git a/spec/lib/gitlab/metrics/dashboard/stages/url_validator_spec.rb b/spec/lib/gitlab/metrics/dashboard/stages/url_validator_spec.rb index 15c562e4b28..83cf161c4e2 100644 --- a/spec/lib/gitlab/metrics/dashboard/stages/url_validator_spec.rb +++ b/spec/lib/gitlab/metrics/dashboard/stages/url_validator_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Metrics::Dashboard::Stages::UrlValidator do +RSpec.describe Gitlab::Metrics::Dashboard::Stages::UrlValidator do let(:project) { build_stubbed(:project) } describe '#transform!' do diff --git a/spec/lib/gitlab/metrics/dashboard/stages/variable_endpoint_inserter_spec.rb b/spec/lib/gitlab/metrics/dashboard/stages/variable_endpoint_inserter_spec.rb index 06e789d025b..9303ff981fb 100644 --- a/spec/lib/gitlab/metrics/dashboard/stages/variable_endpoint_inserter_spec.rb +++ b/spec/lib/gitlab/metrics/dashboard/stages/variable_endpoint_inserter_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Metrics::Dashboard::Stages::VariableEndpointInserter do +RSpec.describe Gitlab::Metrics::Dashboard::Stages::VariableEndpointInserter do include MetricsDashboardHelpers let(:project) { build_stubbed(:project) } diff --git a/spec/lib/gitlab/suggestions/commit_message_spec.rb b/spec/lib/gitlab/suggestions/commit_message_spec.rb index 0774fc80528..1411f64f8b7 100644 --- a/spec/lib/gitlab/suggestions/commit_message_spec.rb +++ b/spec/lib/gitlab/suggestions/commit_message_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Suggestions::CommitMessage do +RSpec.describe Gitlab::Suggestions::CommitMessage do def create_suggestion(file_path, new_line, to_content) position = Gitlab::Diff::Position.new(old_path: file_path, new_path: file_path, diff --git a/spec/lib/gitlab/suggestions/file_suggestion_spec.rb b/spec/lib/gitlab/suggestions/file_suggestion_spec.rb index 15bb8ae5979..1d25bf6edbd 100644 --- a/spec/lib/gitlab/suggestions/file_suggestion_spec.rb +++ b/spec/lib/gitlab/suggestions/file_suggestion_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Suggestions::FileSuggestion do +RSpec.describe Gitlab::Suggestions::FileSuggestion do def create_suggestion(new_line, to_content, lines_above = 0, lines_below = 0) position = Gitlab::Diff::Position.new(old_path: file_path, new_path: file_path, diff --git a/spec/lib/gitlab/suggestions/suggestion_set_spec.rb b/spec/lib/gitlab/suggestions/suggestion_set_spec.rb index b664bb73176..54d79a9d4ba 100644 --- a/spec/lib/gitlab/suggestions/suggestion_set_spec.rb +++ b/spec/lib/gitlab/suggestions/suggestion_set_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Suggestions::SuggestionSet do +RSpec.describe Gitlab::Suggestions::SuggestionSet do def create_suggestion(file_path, new_line, to_content) position = Gitlab::Diff::Position.new(old_path: file_path, new_path: file_path, diff --git a/spec/lib/gitlab/usage_data_concerns/topology_spec.rb b/spec/lib/gitlab/usage_data_concerns/topology_spec.rb index 0428900690c..98f2482c434 100644 --- a/spec/lib/gitlab/usage_data_concerns/topology_spec.rb +++ b/spec/lib/gitlab/usage_data_concerns/topology_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::UsageDataConcerns::Topology do +RSpec.describe Gitlab::UsageDataConcerns::Topology do include UsageDataHelpers describe '#topology_usage_data' do diff --git a/spec/lib/kramdown/parser/atlassian_document_format_spec.rb b/spec/lib/kramdown/parser/atlassian_document_format_spec.rb index 0ba4d430320..f3559503388 100644 --- a/spec/lib/kramdown/parser/atlassian_document_format_spec.rb +++ b/spec/lib/kramdown/parser/atlassian_document_format_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -context Kramdown::Parser::AtlassianDocumentFormat do +RSpec.context Kramdown::Parser::AtlassianDocumentFormat do let_it_be(:options) { { input: 'AtlassianDocumentFormat', html_tables: true } } let_it_be(:fixtures_path) { 'lib/kramdown/atlassian_document_format' } diff --git a/spec/lib/learn_gitlab_spec.rb b/spec/lib/learn_gitlab_spec.rb index 2e50bf2bafc..abfd82999c3 100644 --- a/spec/lib/learn_gitlab_spec.rb +++ b/spec/lib/learn_gitlab_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe LearnGitlab do +RSpec.describe LearnGitlab do let_it_be(:current_user) { create(:user) } let_it_be(:learn_gitlab_project) { create(:project, name: LearnGitlab::PROJECT_NAME) } let_it_be(:learn_gitlab_board) { create(:board, project: learn_gitlab_project, name: LearnGitlab::BOARD_NAME) } diff --git a/spec/migrations/20200526231421_update_index_approval_rule_name_for_code_owners_rule_type_spec.rb b/spec/migrations/20200526231421_update_index_approval_rule_name_for_code_owners_rule_type_spec.rb index 387c477a58e..9f26b698158 100644 --- a/spec/migrations/20200526231421_update_index_approval_rule_name_for_code_owners_rule_type_spec.rb +++ b/spec/migrations/20200526231421_update_index_approval_rule_name_for_code_owners_rule_type_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'migrate', '20200526231421_update_index_approval_rule_name_for_code_owners_rule_type.rb') -describe UpdateIndexApprovalRuleNameForCodeOwnersRuleType do +RSpec.describe UpdateIndexApprovalRuleNameForCodeOwnersRuleType do let(:migration) { described_class.new } let(:approval_rules) { table(:approval_merge_request_rules) } diff --git a/spec/migrations/add_incident_settings_to_all_existing_projects_spec.rb b/spec/migrations/add_incident_settings_to_all_existing_projects_spec.rb index 1745d348a78..dab42c0ffc3 100644 --- a/spec/migrations/add_incident_settings_to_all_existing_projects_spec.rb +++ b/spec/migrations/add_incident_settings_to_all_existing_projects_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'migrate', '20200609212701_add_incident_settings_to_all_existing_projects.rb') -describe AddIncidentSettingsToAllExistingProjects, :migration do +RSpec.describe AddIncidentSettingsToAllExistingProjects, :migration do let(:project_incident_management_settings) { table(:project_incident_management_settings) } let(:labels) { table(:labels) } let(:label_links) { table(:label_links) } diff --git a/spec/migrations/backfill_imported_snippet_repositories_spec.rb b/spec/migrations/backfill_imported_snippet_repositories_spec.rb index c77978b23e4..208bda274e2 100644 --- a/spec/migrations/backfill_imported_snippet_repositories_spec.rb +++ b/spec/migrations/backfill_imported_snippet_repositories_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20200608072931_backfill_imported_snippet_repositories.rb') -describe BackfillImportedSnippetRepositories do +RSpec.describe BackfillImportedSnippetRepositories do let(:users) { table(:users) } let(:snippets) { table(:snippets) } let(:user) { users.create(id: 1, email: 'user@example.com', projects_limit: 10, username: 'test', name: 'Test', state: 'active') } diff --git a/spec/migrations/cap_designs_filename_length_to_new_limit_spec.rb b/spec/migrations/cap_designs_filename_length_to_new_limit_spec.rb index daa07953cb5..523c8864b63 100644 --- a/spec/migrations/cap_designs_filename_length_to_new_limit_spec.rb +++ b/spec/migrations/cap_designs_filename_length_to_new_limit_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20200602013901_cap_designs_filename_length_to_new_limit') -describe CapDesignsFilenameLengthToNewLimit, :migration, schema: 20200528125905 do +RSpec.describe CapDesignsFilenameLengthToNewLimit, :migration, schema: 20200528125905 do let(:namespaces) { table(:namespaces) } let(:projects) { table(:projects) } let(:issues) { table(:issues) } diff --git a/spec/migrations/update_routes_for_lost_and_found_group_and_orphaned_projects_spec.rb b/spec/migrations/update_routes_for_lost_and_found_group_and_orphaned_projects_spec.rb index 4cf096b9df6..a358966aef6 100644 --- a/spec/migrations/update_routes_for_lost_and_found_group_and_orphaned_projects_spec.rb +++ b/spec/migrations/update_routes_for_lost_and_found_group_and_orphaned_projects_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require Rails.root.join('db', 'post_migrate', '20200602143020_update_routes_for_lost_and_found_group_and_orphaned_projects.rb') -describe UpdateRoutesForLostAndFoundGroupAndOrphanedProjects, :migration do +RSpec.describe UpdateRoutesForLostAndFoundGroupAndOrphanedProjects, :migration do let(:users) { table(:users) } let(:namespaces) { table(:namespaces) } let(:members) { table(:members) } diff --git a/spec/models/alert_management/alert_user_mention_spec.rb b/spec/models/alert_management/alert_user_mention_spec.rb index cce090a2231..27c3d290dde 100644 --- a/spec/models/alert_management/alert_user_mention_spec.rb +++ b/spec/models/alert_management/alert_user_mention_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe AlertManagement::AlertUserMention do +RSpec.describe AlertManagement::AlertUserMention do describe 'associations' do it { is_expected.to belong_to(:alert_management_alert) } it { is_expected.to belong_to(:note) } diff --git a/spec/models/blob_viewer/go_mod_spec.rb b/spec/models/blob_viewer/go_mod_spec.rb index ba6038533ea..21e84d39a54 100644 --- a/spec/models/blob_viewer/go_mod_spec.rb +++ b/spec/models/blob_viewer/go_mod_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe BlobViewer::GoMod do +RSpec.describe BlobViewer::GoMod do include FakeBlobHelpers let(:project) { build_stubbed(:project) } diff --git a/spec/models/group_deploy_key_spec.rb b/spec/models/group_deploy_key_spec.rb index 3ba56c7e504..3fe71cc4699 100644 --- a/spec/models/group_deploy_key_spec.rb +++ b/spec/models/group_deploy_key_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe GroupDeployKey do +RSpec.describe GroupDeployKey do it { is_expected.to validate_presence_of(:user) } it 'is of type DeployKey' do diff --git a/spec/models/group_import_state_spec.rb b/spec/models/group_import_state_spec.rb index 9d9cb1e8391..4404ef64966 100644 --- a/spec/models/group_import_state_spec.rb +++ b/spec/models/group_import_state_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe GroupImportState do +RSpec.describe GroupImportState do describe 'validations' do let_it_be(:group) { create(:group) } diff --git a/spec/models/project_services/chat_message/alert_message_spec.rb b/spec/models/project_services/chat_message/alert_message_spec.rb index a1dd332c005..927c5dffe77 100644 --- a/spec/models/project_services/chat_message/alert_message_spec.rb +++ b/spec/models/project_services/chat_message/alert_message_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe ChatMessage::AlertMessage do +RSpec.describe ChatMessage::AlertMessage do subject { described_class.new(args) } let_it_be(:start_time) { Time.current } diff --git a/spec/models/snippet_statistics_spec.rb b/spec/models/snippet_statistics_spec.rb index 1bfb80e2c1d..57a3f844a8a 100644 --- a/spec/models/snippet_statistics_spec.rb +++ b/spec/models/snippet_statistics_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe SnippetStatistics do +RSpec.describe SnippetStatistics do let_it_be(:snippet_without_repo) { create(:snippet) } let_it_be(:snippet_with_repo) { create(:snippet, :repository) } diff --git a/spec/presenters/gitlab/blame_presenter_spec.rb b/spec/presenters/gitlab/blame_presenter_spec.rb index d2a173b557c..b163926154b 100644 --- a/spec/presenters/gitlab/blame_presenter_spec.rb +++ b/spec/presenters/gitlab/blame_presenter_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::BlamePresenter do +RSpec.describe Gitlab::BlamePresenter do let(:project) { create(:project, :repository) } let(:path) { 'files/ruby/popen.rb' } let(:commit) { project.commit('master') } diff --git a/spec/requests/api/graphql/mutations/alert_management/alerts/set_assignees_spec.rb b/spec/requests/api/graphql/mutations/alert_management/alerts/set_assignees_spec.rb index 6663281e093..cd5cefa0a9a 100644 --- a/spec/requests/api/graphql/mutations/alert_management/alerts/set_assignees_spec.rb +++ b/spec/requests/api/graphql/mutations/alert_management/alerts/set_assignees_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'Setting assignees of an alert' do +RSpec.describe 'Setting assignees of an alert' do include GraphqlHelpers let_it_be(:project) { create(:project) } diff --git a/spec/requests/api/graphql/mutations/container_expiration_policy/update_spec.rb b/spec/requests/api/graphql/mutations/container_expiration_policy/update_spec.rb index c82766835de..bc1b42d68e6 100644 --- a/spec/requests/api/graphql/mutations/container_expiration_policy/update_spec.rb +++ b/spec/requests/api/graphql/mutations/container_expiration_policy/update_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'Updating the container expiration policy' do +RSpec.describe 'Updating the container expiration policy' do include GraphqlHelpers using RSpec::Parameterized::TableSyntax diff --git a/spec/requests/api/graphql/mutations/jira_import/import_users_spec.rb b/spec/requests/api/graphql/mutations/jira_import/import_users_spec.rb index be0d843d5ff..4057aa4ba9e 100644 --- a/spec/requests/api/graphql/mutations/jira_import/import_users_spec.rb +++ b/spec/requests/api/graphql/mutations/jira_import/import_users_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'Importing Jira Users' do +RSpec.describe 'Importing Jira Users' do include JiraServiceHelper include GraphqlHelpers diff --git a/spec/requests/api/graphql/mutations/metrics/dashboard/annotations/delete_spec.rb b/spec/requests/api/graphql/mutations/metrics/dashboard/annotations/delete_spec.rb index 217f538c53e..2459a6f3828 100644 --- a/spec/requests/api/graphql/mutations/metrics/dashboard/annotations/delete_spec.rb +++ b/spec/requests/api/graphql/mutations/metrics/dashboard/annotations/delete_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Mutations::Metrics::Dashboard::Annotations::Delete do +RSpec.describe Mutations::Metrics::Dashboard::Annotations::Delete do include GraphqlHelpers let_it_be(:current_user) { create(:user) } diff --git a/spec/requests/api/graphql/project/alert_management/alert/assignees_spec.rb b/spec/requests/api/graphql/project/alert_management/alert/assignees_spec.rb index 4c048caaeee..dd001a73349 100644 --- a/spec/requests/api/graphql/project/alert_management/alert/assignees_spec.rb +++ b/spec/requests/api/graphql/project/alert_management/alert/assignees_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'getting Alert Management Alert Assignees' do +RSpec.describe 'getting Alert Management Alert Assignees' do include GraphqlHelpers let_it_be(:project) { create(:project) } diff --git a/spec/requests/api/graphql/project/alert_management/alert/notes_spec.rb b/spec/requests/api/graphql/project/alert_management/alert/notes_spec.rb index df6bfa8c97b..f5fd2fd8d94 100644 --- a/spec/requests/api/graphql/project/alert_management/alert/notes_spec.rb +++ b/spec/requests/api/graphql/project/alert_management/alert/notes_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'getting Alert Management Alert Notes' do +RSpec.describe 'getting Alert Management Alert Notes' do include GraphqlHelpers let_it_be(:project) { create(:project) } diff --git a/spec/requests/api/graphql/project/pipeline_spec.rb b/spec/requests/api/graphql/project/pipeline_spec.rb index bed9a18577f..57b9de25c3d 100644 --- a/spec/requests/api/graphql/project/pipeline_spec.rb +++ b/spec/requests/api/graphql/project/pipeline_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'getting pipeline information nested in a project' do +RSpec.describe 'getting pipeline information nested in a project' do include GraphqlHelpers let(:project) { create(:project, :repository, :public) } diff --git a/spec/requests/api/graphql/project/releases_spec.rb b/spec/requests/api/graphql/project/releases_spec.rb index 9d0387e6469..7e418bbaa5b 100644 --- a/spec/requests/api/graphql/project/releases_spec.rb +++ b/spec/requests/api/graphql/project/releases_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'Query.project(fullPath).releases()' do +RSpec.describe 'Query.project(fullPath).releases()' do include GraphqlHelpers let_it_be(:stranger) { create(:user) } diff --git a/spec/requests/api/graphql/user/group_member_query_spec.rb b/spec/requests/api/graphql/user/group_member_query_spec.rb index 022ee79297c..3a16d962214 100644 --- a/spec/requests/api/graphql/user/group_member_query_spec.rb +++ b/spec/requests/api/graphql/user/group_member_query_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'GroupMember' do +RSpec.describe 'GroupMember' do include GraphqlHelpers let_it_be(:member) { create(:group_member, :developer) } diff --git a/spec/requests/api/graphql/user/project_member_query_spec.rb b/spec/requests/api/graphql/user/project_member_query_spec.rb index 397d2872189..0790e148caf 100644 --- a/spec/requests/api/graphql/user/project_member_query_spec.rb +++ b/spec/requests/api/graphql/user/project_member_query_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'ProjectMember' do +RSpec.describe 'ProjectMember' do include GraphqlHelpers let_it_be(:member) { create(:project_member, :developer) } diff --git a/spec/requests/api/graphql/users_spec.rb b/spec/requests/api/graphql/users_spec.rb index 1e6d73cbd7d..91ac206676b 100644 --- a/spec/requests/api/graphql/users_spec.rb +++ b/spec/requests/api/graphql/users_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'Users' do +RSpec.describe 'Users' do include GraphqlHelpers let_it_be(:current_user) { create(:user, created_at: 1.day.ago) } diff --git a/spec/routing/routing_spec.rb b/spec/routing/routing_spec.rb index 02e930c1cbf..a6f415a995a 100644 --- a/spec/routing/routing_spec.rb +++ b/spec/routing/routing_spec.rb @@ -373,7 +373,7 @@ RSpec.describe AutocompleteController, 'routing' do end end -describe Snippets::BlobsController, "routing" do +RSpec.describe Snippets::BlobsController, "routing" do it "to #raw" do expect(get('/-/snippets/1/raw/master/lib/version.rb')) .to route_to('snippets/blobs#raw', snippet_id: '1', ref: 'master', path: 'lib/version.rb') diff --git a/spec/rubocop/cop/default_scope_spec.rb b/spec/rubocop/cop/default_scope_spec.rb index 0752b0467c8..617a7f63497 100644 --- a/spec/rubocop/cop/default_scope_spec.rb +++ b/spec/rubocop/cop/default_scope_spec.rb @@ -5,7 +5,7 @@ require 'rubocop' require 'rubocop/rspec/support' require_relative '../../../rubocop/cop/default_scope' -describe RuboCop::Cop::DefaultScope, type: :rubocop do +RSpec.describe RuboCop::Cop::DefaultScope, type: :rubocop do include CopHelper subject(:cop) { described_class.new } diff --git a/spec/rubocop/cop/gitlab/bulk_insert_spec.rb b/spec/rubocop/cop/gitlab/bulk_insert_spec.rb index 08e44e491f6..2766e4f1982 100644 --- a/spec/rubocop/cop/gitlab/bulk_insert_spec.rb +++ b/spec/rubocop/cop/gitlab/bulk_insert_spec.rb @@ -5,7 +5,7 @@ require 'rubocop' require 'rubocop/rspec/support' require_relative '../../../../rubocop/cop/gitlab/bulk_insert' -describe RuboCop::Cop::Gitlab::BulkInsert, type: :rubocop do +RSpec.describe RuboCop::Cop::Gitlab::BulkInsert, type: :rubocop do include CopHelper subject(:cop) { described_class.new } diff --git a/spec/rubocop/cop/migration/drop_table_spec.rb b/spec/rubocop/cop/migration/drop_table_spec.rb index b24e350388c..44a1106ba62 100644 --- a/spec/rubocop/cop/migration/drop_table_spec.rb +++ b/spec/rubocop/cop/migration/drop_table_spec.rb @@ -7,7 +7,7 @@ require 'rubocop/rspec/support' require_relative '../../../../rubocop/cop/migration/drop_table' -describe RuboCop::Cop::Migration::DropTable do +RSpec.describe RuboCop::Cop::Migration::DropTable do include CopHelper subject(:cop) { described_class.new } diff --git a/spec/serializers/ci/daily_build_group_report_result_entity_spec.rb b/spec/serializers/ci/daily_build_group_report_result_entity_spec.rb index cc35b3bc8b8..f468acdcc64 100644 --- a/spec/serializers/ci/daily_build_group_report_result_entity_spec.rb +++ b/spec/serializers/ci/daily_build_group_report_result_entity_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::DailyBuildGroupReportResultEntity do +RSpec.describe Ci::DailyBuildGroupReportResultEntity do let(:report_result) { double(date: '2020-05-20', group_name: 'rspec', data: { 'coverage' => 79.1 }) } let(:entity) { described_class.new(report_result, param_type: param_type) } let(:param_type) { 'coverage' } diff --git a/spec/serializers/ci/daily_build_group_report_result_serializer_spec.rb b/spec/serializers/ci/daily_build_group_report_result_serializer_spec.rb index 4a781971ae0..69bf599c0dd 100644 --- a/spec/serializers/ci/daily_build_group_report_result_serializer_spec.rb +++ b/spec/serializers/ci/daily_build_group_report_result_serializer_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::DailyBuildGroupReportResultSerializer do +RSpec.describe Ci::DailyBuildGroupReportResultSerializer do let(:report_result) do [ double(date: '2020-05-20', group_name: 'rspec', data: { 'coverage' => 79.1 }), diff --git a/spec/serializers/import/bitbucket_provider_repo_entity_spec.rb b/spec/serializers/import/bitbucket_provider_repo_entity_spec.rb index ed3ef26db65..2a0386b779f 100644 --- a/spec/serializers/import/bitbucket_provider_repo_entity_spec.rb +++ b/spec/serializers/import/bitbucket_provider_repo_entity_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Import::BitbucketProviderRepoEntity do +RSpec.describe Import::BitbucketProviderRepoEntity do let(:repo_data) do { 'name' => 'repo_name', diff --git a/spec/serializers/import/bitbucket_server_provider_repo_entity_spec.rb b/spec/serializers/import/bitbucket_server_provider_repo_entity_spec.rb index 9891809cc67..6e00d608d9a 100644 --- a/spec/serializers/import/bitbucket_server_provider_repo_entity_spec.rb +++ b/spec/serializers/import/bitbucket_server_provider_repo_entity_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Import::BitbucketServerProviderRepoEntity do +RSpec.describe Import::BitbucketServerProviderRepoEntity do let(:repo_data) do { 'name' => 'test', diff --git a/spec/serializers/import/fogbugz_provider_repo_entity_spec.rb b/spec/serializers/import/fogbugz_provider_repo_entity_spec.rb index b9029b67aab..748ddd2a108 100644 --- a/spec/serializers/import/fogbugz_provider_repo_entity_spec.rb +++ b/spec/serializers/import/fogbugz_provider_repo_entity_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Import::FogbugzProviderRepoEntity do +RSpec.describe Import::FogbugzProviderRepoEntity do let(:provider_url) { 'https://demo.fogbugz.com/' } let(:repo_data) do { diff --git a/spec/serializers/import/githubish_provider_repo_entity_spec.rb b/spec/serializers/import/githubish_provider_repo_entity_spec.rb index c6a07b2d64a..b8292f71714 100644 --- a/spec/serializers/import/githubish_provider_repo_entity_spec.rb +++ b/spec/serializers/import/githubish_provider_repo_entity_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Import::GithubishProviderRepoEntity do +RSpec.describe Import::GithubishProviderRepoEntity do let(:provider_url) { 'https://github.com/' } let(:repo) do { diff --git a/spec/serializers/import/gitlab_provider_repo_entity_spec.rb b/spec/serializers/import/gitlab_provider_repo_entity_spec.rb index 3f862c16fe2..25e445d336c 100644 --- a/spec/serializers/import/gitlab_provider_repo_entity_spec.rb +++ b/spec/serializers/import/gitlab_provider_repo_entity_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Import::GitlabProviderRepoEntity do +RSpec.describe Import::GitlabProviderRepoEntity do let(:repo_data) do { 'id' => 1, diff --git a/spec/serializers/import/provider_repo_serializer_spec.rb b/spec/serializers/import/provider_repo_serializer_spec.rb index 9bf55e6c65d..430bad151d3 100644 --- a/spec/serializers/import/provider_repo_serializer_spec.rb +++ b/spec/serializers/import/provider_repo_serializer_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Import::ProviderRepoSerializer do +RSpec.describe Import::ProviderRepoSerializer do using RSpec::Parameterized::TableSyntax describe '#represent' do diff --git a/spec/services/alert_management/alerts/update_service_spec.rb b/spec/services/alert_management/alerts/update_service_spec.rb index 69a9287ce2a..3e312e739a4 100644 --- a/spec/services/alert_management/alerts/update_service_spec.rb +++ b/spec/services/alert_management/alerts/update_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe AlertManagement::Alerts::UpdateService do +RSpec.describe AlertManagement::Alerts::UpdateService do let_it_be(:user_with_permissions) { create(:user) } let_it_be(:other_user_with_permissions) { create(:user) } let_it_be(:user_without_permissions) { create(:user) } diff --git a/spec/services/authorized_project_update/periodic_recalculate_service_spec.rb b/spec/services/authorized_project_update/periodic_recalculate_service_spec.rb index 020056da36e..c776e013fdf 100644 --- a/spec/services/authorized_project_update/periodic_recalculate_service_spec.rb +++ b/spec/services/authorized_project_update/periodic_recalculate_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe AuthorizedProjectUpdate::PeriodicRecalculateService do +RSpec.describe AuthorizedProjectUpdate::PeriodicRecalculateService do subject(:service) { described_class.new } describe '#execute' do diff --git a/spec/services/authorized_project_update/project_group_link_create_service_spec.rb b/spec/services/authorized_project_update/project_group_link_create_service_spec.rb index dae2e004ec7..d30d9f1e766 100644 --- a/spec/services/authorized_project_update/project_group_link_create_service_spec.rb +++ b/spec/services/authorized_project_update/project_group_link_create_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe AuthorizedProjectUpdate::ProjectGroupLinkCreateService do +RSpec.describe AuthorizedProjectUpdate::ProjectGroupLinkCreateService do let_it_be(:group_parent) { create(:group, :private) } let_it_be(:group) { create(:group, :private, parent: group_parent) } let_it_be(:group_child) { create(:group, :private, parent: group) } diff --git a/spec/services/authorized_project_update/recalculate_for_user_range_service_spec.rb b/spec/services/authorized_project_update/recalculate_for_user_range_service_spec.rb index 28cbda6f4fd..a4637b6ba1c 100644 --- a/spec/services/authorized_project_update/recalculate_for_user_range_service_spec.rb +++ b/spec/services/authorized_project_update/recalculate_for_user_range_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe AuthorizedProjectUpdate::RecalculateForUserRangeService do +RSpec.describe AuthorizedProjectUpdate::RecalculateForUserRangeService do describe '#execute' do let_it_be(:users) { create_list(:user, 2) } diff --git a/spec/services/ci/create_pipeline_service/parameter_content_spec.rb b/spec/services/ci/create_pipeline_service/parameter_content_spec.rb index 27af212d41c..a0b62ad5194 100644 --- a/spec/services/ci/create_pipeline_service/parameter_content_spec.rb +++ b/spec/services/ci/create_pipeline_service/parameter_content_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Ci::CreatePipelineService do +RSpec.describe Ci::CreatePipelineService do let_it_be(:project) { create(:project, :repository) } let_it_be(:user) { create(:admin) } let(:service) { described_class.new(project, user, { ref: 'refs/heads/master' }) } diff --git a/spec/services/container_expiration_policies/update_service_spec.rb b/spec/services/container_expiration_policies/update_service_spec.rb index ec178f3830f..d4b6715ae86 100644 --- a/spec/services/container_expiration_policies/update_service_spec.rb +++ b/spec/services/container_expiration_policies/update_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe ContainerExpirationPolicies::UpdateService do +RSpec.describe ContainerExpirationPolicies::UpdateService do using RSpec::Parameterized::TableSyntax let_it_be(:project, reload: true) { create(:project) } diff --git a/spec/services/gpg_keys/destroy_service_spec.rb b/spec/services/gpg_keys/destroy_service_spec.rb index 82c7ab7adaa..b9aa3e351c9 100644 --- a/spec/services/gpg_keys/destroy_service_spec.rb +++ b/spec/services/gpg_keys/destroy_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe GpgKeys::DestroyService do +RSpec.describe GpgKeys::DestroyService do let(:user) { create(:user) } subject { described_class.new(user) } diff --git a/spec/services/integrations/test/project_service_spec.rb b/spec/services/integrations/test/project_service_spec.rb index fdb43ca345a..dd603765d59 100644 --- a/spec/services/integrations/test/project_service_spec.rb +++ b/spec/services/integrations/test/project_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Integrations::Test::ProjectService do +RSpec.describe Integrations::Test::ProjectService do let(:user) { double('user') } describe '#execute' do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 41f53ef5196..c43e96f2a1d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -331,6 +331,8 @@ RSpec.configure do |config| Ability.allowed?(*args) end end + + config.disable_monkey_patching! end ActiveRecord::Migration.maintain_test_schema! diff --git a/spec/validators/array_members_validator_spec.rb b/spec/validators/array_members_validator_spec.rb index 4d3a53d64ab..ff8f0da7651 100644 --- a/spec/validators/array_members_validator_spec.rb +++ b/spec/validators/array_members_validator_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe ArrayMembersValidator do +RSpec.describe ArrayMembersValidator do using RSpec::Parameterized::TableSyntax child_class = Class.new diff --git a/spec/views/projects/issues/import_csv/_button.html.haml_spec.rb b/spec/views/projects/issues/import_csv/_button.html.haml_spec.rb index 440edd376e0..8bc0a00d71c 100644 --- a/spec/views/projects/issues/import_csv/_button.html.haml_spec.rb +++ b/spec/views/projects/issues/import_csv/_button.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe 'projects/issues/import_csv/_button' do +RSpec.describe 'projects/issues/import_csv/_button' do include Devise::Test::ControllerHelpers context 'when the user does not have edit permissions' do diff --git a/spec/workers/authorized_project_update/periodic_recalculate_worker_spec.rb b/spec/workers/authorized_project_update/periodic_recalculate_worker_spec.rb index fcd073953b6..2d633828ae3 100644 --- a/spec/workers/authorized_project_update/periodic_recalculate_worker_spec.rb +++ b/spec/workers/authorized_project_update/periodic_recalculate_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe AuthorizedProjectUpdate::PeriodicRecalculateWorker do +RSpec.describe AuthorizedProjectUpdate::PeriodicRecalculateWorker do describe '#perform' do it 'calls AuthorizedProjectUpdate::PeriodicRecalculateService' do expect_next_instance_of(AuthorizedProjectUpdate::PeriodicRecalculateService) do |service| diff --git a/spec/workers/authorized_project_update/project_group_link_create_worker_spec.rb b/spec/workers/authorized_project_update/project_group_link_create_worker_spec.rb index 9d82e9f338d..7c4ad4ce641 100644 --- a/spec/workers/authorized_project_update/project_group_link_create_worker_spec.rb +++ b/spec/workers/authorized_project_update/project_group_link_create_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe AuthorizedProjectUpdate::ProjectGroupLinkCreateWorker do +RSpec.describe AuthorizedProjectUpdate::ProjectGroupLinkCreateWorker do let_it_be(:group) { create(:group, :private) } let_it_be(:group_project) { create(:project, group: group) } let_it_be(:shared_with_group) { create(:group, :private) } diff --git a/spec/workers/authorized_project_update/user_refresh_over_user_range_worker_spec.rb b/spec/workers/authorized_project_update/user_refresh_over_user_range_worker_spec.rb index 5d1c405dfd0..c49e4c453bf 100644 --- a/spec/workers/authorized_project_update/user_refresh_over_user_range_worker_spec.rb +++ b/spec/workers/authorized_project_update/user_refresh_over_user_range_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe AuthorizedProjectUpdate::UserRefreshOverUserRangeWorker do +RSpec.describe AuthorizedProjectUpdate::UserRefreshOverUserRangeWorker do let(:start_user_id) { 42 } let(:end_user_id) { 4242 } diff --git a/spec/workers/gitlab/import/stuck_project_import_jobs_worker_spec.rb b/spec/workers/gitlab/import/stuck_project_import_jobs_worker_spec.rb index 5afc5717b82..510c41cba21 100644 --- a/spec/workers/gitlab/import/stuck_project_import_jobs_worker_spec.rb +++ b/spec/workers/gitlab/import/stuck_project_import_jobs_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Gitlab::Import::StuckProjectImportJobsWorker do +RSpec.describe Gitlab::Import::StuckProjectImportJobsWorker do let(:worker) { described_class.new } describe 'with scheduled import_status' do diff --git a/spec/workers/irker_worker_spec.rb b/spec/workers/irker_worker_spec.rb index 6b58c04d909..aa1f1d2fe1d 100644 --- a/spec/workers/irker_worker_spec.rb +++ b/spec/workers/irker_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe IrkerWorker, '#perform' do +RSpec.describe IrkerWorker, '#perform' do let_it_be(:project) { create(:project, :repository) } let_it_be(:user) { create(:user) } let_it_be(:push_data) { HashWithIndifferentAccess.new(Gitlab::DataBuilder::Push.build_sample(project, user)) } diff --git a/spec/workers/metrics/dashboard/prune_old_annotations_worker_spec.rb b/spec/workers/metrics/dashboard/prune_old_annotations_worker_spec.rb index bab5a5d8740..d93612afe37 100644 --- a/spec/workers/metrics/dashboard/prune_old_annotations_worker_spec.rb +++ b/spec/workers/metrics/dashboard/prune_old_annotations_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Metrics::Dashboard::PruneOldAnnotationsWorker do +RSpec.describe Metrics::Dashboard::PruneOldAnnotationsWorker do let_it_be(:now) { DateTime.parse('2020-06-02T00:12:00Z') } let_it_be(:two_weeks_old_annotation) { create(:metrics_dashboard_annotation, starting_at: now.advance(weeks: -2)) } let_it_be(:one_day_old_annotation) { create(:metrics_dashboard_annotation, starting_at: now.advance(days: -1)) } diff --git a/spec/workers/remove_expired_group_links_worker_spec.rb b/spec/workers/remove_expired_group_links_worker_spec.rb index b637802cd78..91031768632 100644 --- a/spec/workers/remove_expired_group_links_worker_spec.rb +++ b/spec/workers/remove_expired_group_links_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe RemoveExpiredGroupLinksWorker do +RSpec.describe RemoveExpiredGroupLinksWorker do describe '#perform' do context 'ProjectGroupLinks' do let!(:expired_project_group_link) { create(:project_group_link, expires_at: 1.hour.ago) } diff --git a/spec/workers/remove_expired_members_worker_spec.rb b/spec/workers/remove_expired_members_worker_spec.rb index 69a5725bb35..cbdd5a68698 100644 --- a/spec/workers/remove_expired_members_worker_spec.rb +++ b/spec/workers/remove_expired_members_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe RemoveExpiredMembersWorker do +RSpec.describe RemoveExpiredMembersWorker do let(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/remove_unreferenced_lfs_objects_worker_spec.rb b/spec/workers/remove_unreferenced_lfs_objects_worker_spec.rb index 0e21933a9a5..e716d4806d3 100644 --- a/spec/workers/remove_unreferenced_lfs_objects_worker_spec.rb +++ b/spec/workers/remove_unreferenced_lfs_objects_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe RemoveUnreferencedLfsObjectsWorker do +RSpec.describe RemoveUnreferencedLfsObjectsWorker do let(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/repository_check/batch_worker_spec.rb b/spec/workers/repository_check/batch_worker_spec.rb index 12e7d1879d0..643b55af573 100644 --- a/spec/workers/repository_check/batch_worker_spec.rb +++ b/spec/workers/repository_check/batch_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe RepositoryCheck::BatchWorker do +RSpec.describe RepositoryCheck::BatchWorker do let(:shard_name) { 'default' } subject { described_class.new } diff --git a/spec/workers/repository_check/clear_worker_spec.rb b/spec/workers/repository_check/clear_worker_spec.rb index 40cf6abf508..b5f09e8a05f 100644 --- a/spec/workers/repository_check/clear_worker_spec.rb +++ b/spec/workers/repository_check/clear_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe RepositoryCheck::ClearWorker do +RSpec.describe RepositoryCheck::ClearWorker do it 'clears repository check columns' do project = create(:project) project.update_columns( diff --git a/spec/workers/repository_check/dispatch_worker_spec.rb b/spec/workers/repository_check/dispatch_worker_spec.rb index e4bb0bf4046..5e1bc76ec8e 100644 --- a/spec/workers/repository_check/dispatch_worker_spec.rb +++ b/spec/workers/repository_check/dispatch_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe RepositoryCheck::DispatchWorker do +RSpec.describe RepositoryCheck::DispatchWorker do subject { described_class.new } it 'does nothing when repository checks are disabled' do diff --git a/spec/workers/repository_check/single_repository_worker_spec.rb b/spec/workers/repository_check/single_repository_worker_spec.rb index 43998f912ef..28e3f43d374 100644 --- a/spec/workers/repository_check/single_repository_worker_spec.rb +++ b/spec/workers/repository_check/single_repository_worker_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require 'fileutils' -describe RepositoryCheck::SingleRepositoryWorker do +RSpec.describe RepositoryCheck::SingleRepositoryWorker do subject(:worker) { described_class.new } it 'skips when the project has no push events' do diff --git a/spec/workers/repository_cleanup_worker_spec.rb b/spec/workers/repository_cleanup_worker_spec.rb index e58664cf22a..41bfeabb7f3 100644 --- a/spec/workers/repository_cleanup_worker_spec.rb +++ b/spec/workers/repository_cleanup_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe RepositoryCleanupWorker do +RSpec.describe RepositoryCleanupWorker do let(:project) { create(:project) } let(:user) { create(:user) } diff --git a/spec/workers/repository_fork_worker_spec.rb b/spec/workers/repository_fork_worker_spec.rb index 7209c40646f..0f2d4eb4b65 100644 --- a/spec/workers/repository_fork_worker_spec.rb +++ b/spec/workers/repository_fork_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe RepositoryForkWorker do +RSpec.describe RepositoryForkWorker do include ProjectForksHelper describe 'modules' do diff --git a/spec/workers/repository_import_worker_spec.rb b/spec/workers/repository_import_worker_spec.rb index 507098582c9..a0582c5fa64 100644 --- a/spec/workers/repository_import_worker_spec.rb +++ b/spec/workers/repository_import_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe RepositoryImportWorker do +RSpec.describe RepositoryImportWorker do describe 'modules' do it 'includes ProjectImportOptions' do expect(described_class).to include_module(ProjectImportOptions) diff --git a/spec/workers/repository_remove_remote_worker_spec.rb b/spec/workers/repository_remove_remote_worker_spec.rb index afac9212fab..f210300c825 100644 --- a/spec/workers/repository_remove_remote_worker_spec.rb +++ b/spec/workers/repository_remove_remote_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe RepositoryRemoveRemoteWorker do +RSpec.describe RepositoryRemoveRemoteWorker do include ExclusiveLeaseHelpers include GitHelpers diff --git a/spec/workers/repository_update_remote_mirror_worker_spec.rb b/spec/workers/repository_update_remote_mirror_worker_spec.rb index b81b492167a..37eed57cf2e 100644 --- a/spec/workers/repository_update_remote_mirror_worker_spec.rb +++ b/spec/workers/repository_update_remote_mirror_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe RepositoryUpdateRemoteMirrorWorker, :clean_gitlab_redis_shared_state do +RSpec.describe RepositoryUpdateRemoteMirrorWorker, :clean_gitlab_redis_shared_state do subject { described_class.new } let(:remote_mirror) { create(:remote_mirror) } diff --git a/spec/workers/run_pipeline_schedule_worker_spec.rb b/spec/workers/run_pipeline_schedule_worker_spec.rb index afeee4bac73..4999909934b 100644 --- a/spec/workers/run_pipeline_schedule_worker_spec.rb +++ b/spec/workers/run_pipeline_schedule_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe RunPipelineScheduleWorker do +RSpec.describe RunPipelineScheduleWorker do describe '#perform' do let_it_be(:project) { create(:project) } let_it_be(:user) { create(:user) } diff --git a/spec/workers/schedule_migrate_external_diffs_worker_spec.rb b/spec/workers/schedule_migrate_external_diffs_worker_spec.rb index 9d6fecc9f4e..09a0124f6e0 100644 --- a/spec/workers/schedule_migrate_external_diffs_worker_spec.rb +++ b/spec/workers/schedule_migrate_external_diffs_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe ScheduleMigrateExternalDiffsWorker do +RSpec.describe ScheduleMigrateExternalDiffsWorker do include ExclusiveLeaseHelpers let(:worker) { described_class.new } diff --git a/spec/workers/self_monitoring_project_create_worker_spec.rb b/spec/workers/self_monitoring_project_create_worker_spec.rb index 00c288bdc46..b618b8ede99 100644 --- a/spec/workers/self_monitoring_project_create_worker_spec.rb +++ b/spec/workers/self_monitoring_project_create_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe SelfMonitoringProjectCreateWorker do +RSpec.describe SelfMonitoringProjectCreateWorker do describe '#perform' do let(:service_class) { Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService } let(:service) { instance_double(service_class) } diff --git a/spec/workers/self_monitoring_project_delete_worker_spec.rb b/spec/workers/self_monitoring_project_delete_worker_spec.rb index 3685c73513e..9a53fe59a40 100644 --- a/spec/workers/self_monitoring_project_delete_worker_spec.rb +++ b/spec/workers/self_monitoring_project_delete_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe SelfMonitoringProjectDeleteWorker do +RSpec.describe SelfMonitoringProjectDeleteWorker do let_it_be(:jid) { 'b5b28910d97563e58c2fe55f' } let_it_be(:data_key) { "self_monitoring_delete_result:#{jid}" } diff --git a/spec/workers/stage_update_worker_spec.rb b/spec/workers/stage_update_worker_spec.rb index dc7158cfd2f..75b324a9e0a 100644 --- a/spec/workers/stage_update_worker_spec.rb +++ b/spec/workers/stage_update_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe StageUpdateWorker do +RSpec.describe StageUpdateWorker do describe '#perform' do context 'when stage exists' do let(:stage) { create(:ci_stage_entity) } diff --git a/spec/workers/stuck_ci_jobs_worker_spec.rb b/spec/workers/stuck_ci_jobs_worker_spec.rb index c994a5dcb78..b96d506771d 100644 --- a/spec/workers/stuck_ci_jobs_worker_spec.rb +++ b/spec/workers/stuck_ci_jobs_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe StuckCiJobsWorker do +RSpec.describe StuckCiJobsWorker do include ExclusiveLeaseHelpers let!(:runner) { create :ci_runner } diff --git a/spec/workers/stuck_export_jobs_worker_spec.rb b/spec/workers/stuck_export_jobs_worker_spec.rb index fc5758fdadf..cbc7adc8e3f 100644 --- a/spec/workers/stuck_export_jobs_worker_spec.rb +++ b/spec/workers/stuck_export_jobs_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe StuckExportJobsWorker do +RSpec.describe StuckExportJobsWorker do let(:worker) { described_class.new } shared_examples 'project export job detection' do diff --git a/spec/workers/stuck_import_jobs_worker_spec.rb b/spec/workers/stuck_import_jobs_worker_spec.rb index f8d7f8747d5..5664965edf7 100644 --- a/spec/workers/stuck_import_jobs_worker_spec.rb +++ b/spec/workers/stuck_import_jobs_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe StuckImportJobsWorker do +RSpec.describe StuckImportJobsWorker do let(:worker) { described_class.new } describe 'with scheduled import_status' do diff --git a/spec/workers/stuck_merge_jobs_worker_spec.rb b/spec/workers/stuck_merge_jobs_worker_spec.rb index 8ceaf1fc555..bade2e1ca1b 100644 --- a/spec/workers/stuck_merge_jobs_worker_spec.rb +++ b/spec/workers/stuck_merge_jobs_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe StuckMergeJobsWorker do +RSpec.describe StuckMergeJobsWorker do describe 'perform' do let(:worker) { described_class.new } diff --git a/spec/workers/system_hook_push_worker_spec.rb b/spec/workers/system_hook_push_worker_spec.rb index 890a622d11a..43a3f8e3e19 100644 --- a/spec/workers/system_hook_push_worker_spec.rb +++ b/spec/workers/system_hook_push_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe SystemHookPushWorker do +RSpec.describe SystemHookPushWorker do include RepoHelpers subject { described_class.new } diff --git a/spec/workers/todos_destroyer/confidential_issue_worker_spec.rb b/spec/workers/todos_destroyer/confidential_issue_worker_spec.rb index 0907e2768ba..86202fac1ed 100644 --- a/spec/workers/todos_destroyer/confidential_issue_worker_spec.rb +++ b/spec/workers/todos_destroyer/confidential_issue_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe TodosDestroyer::ConfidentialIssueWorker do +RSpec.describe TodosDestroyer::ConfidentialIssueWorker do let(:service) { double } it "calls the Todos::Destroy::ConfidentialIssueService with issue_id parameter" do diff --git a/spec/workers/todos_destroyer/entity_leave_worker_spec.rb b/spec/workers/todos_destroyer/entity_leave_worker_spec.rb index cb14fac0910..db3b0252056 100644 --- a/spec/workers/todos_destroyer/entity_leave_worker_spec.rb +++ b/spec/workers/todos_destroyer/entity_leave_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe TodosDestroyer::EntityLeaveWorker do +RSpec.describe TodosDestroyer::EntityLeaveWorker do it "calls the Todos::Destroy::EntityLeaveService with the params it was given" do service = double diff --git a/spec/workers/todos_destroyer/group_private_worker_spec.rb b/spec/workers/todos_destroyer/group_private_worker_spec.rb index d9a240136d5..4903edd4bbe 100644 --- a/spec/workers/todos_destroyer/group_private_worker_spec.rb +++ b/spec/workers/todos_destroyer/group_private_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe TodosDestroyer::GroupPrivateWorker do +RSpec.describe TodosDestroyer::GroupPrivateWorker do it "calls the Todos::Destroy::GroupPrivateService with the params it was given" do service = double diff --git a/spec/workers/todos_destroyer/private_features_worker_spec.rb b/spec/workers/todos_destroyer/private_features_worker_spec.rb index abd04acc3bd..f346a004670 100644 --- a/spec/workers/todos_destroyer/private_features_worker_spec.rb +++ b/spec/workers/todos_destroyer/private_features_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe TodosDestroyer::PrivateFeaturesWorker do +RSpec.describe TodosDestroyer::PrivateFeaturesWorker do it "calls the Todos::Destroy::PrivateFeaturesService with the params it was given" do service = double diff --git a/spec/workers/todos_destroyer/project_private_worker_spec.rb b/spec/workers/todos_destroyer/project_private_worker_spec.rb index c1bb0438ec3..4e54fbdb275 100644 --- a/spec/workers/todos_destroyer/project_private_worker_spec.rb +++ b/spec/workers/todos_destroyer/project_private_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe TodosDestroyer::ProjectPrivateWorker do +RSpec.describe TodosDestroyer::ProjectPrivateWorker do it "calls the Todos::Destroy::ProjectPrivateService with the params it was given" do service = double diff --git a/spec/workers/trending_projects_worker_spec.rb b/spec/workers/trending_projects_worker_spec.rb index 6e524085662..1f1e312e457 100644 --- a/spec/workers/trending_projects_worker_spec.rb +++ b/spec/workers/trending_projects_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe TrendingProjectsWorker do +RSpec.describe TrendingProjectsWorker do describe '#perform' do it 'refreshes the trending projects' do expect(TrendingProject).to receive(:refresh!) diff --git a/spec/workers/update_external_pull_requests_worker_spec.rb b/spec/workers/update_external_pull_requests_worker_spec.rb index afac0357b2d..80f22470977 100644 --- a/spec/workers/update_external_pull_requests_worker_spec.rb +++ b/spec/workers/update_external_pull_requests_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe UpdateExternalPullRequestsWorker do +RSpec.describe UpdateExternalPullRequestsWorker do describe '#perform' do let_it_be(:project) { create(:project, import_source: 'tanuki/repository') } let_it_be(:user) { create(:user) } diff --git a/spec/workers/update_head_pipeline_for_merge_request_worker_spec.rb b/spec/workers/update_head_pipeline_for_merge_request_worker_spec.rb index 8fe3f27c8b1..e6f4f415987 100644 --- a/spec/workers/update_head_pipeline_for_merge_request_worker_spec.rb +++ b/spec/workers/update_head_pipeline_for_merge_request_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe UpdateHeadPipelineForMergeRequestWorker do +RSpec.describe UpdateHeadPipelineForMergeRequestWorker do describe '#perform' do let_it_be(:user) { create(:user) } let_it_be(:project) { create(:project, :repository) } diff --git a/spec/workers/update_highest_role_worker_spec.rb b/spec/workers/update_highest_role_worker_spec.rb index 3f377208a62..19512fb0cfc 100644 --- a/spec/workers/update_highest_role_worker_spec.rb +++ b/spec/workers/update_highest_role_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe UpdateHighestRoleWorker, :clean_gitlab_redis_shared_state do +RSpec.describe UpdateHighestRoleWorker, :clean_gitlab_redis_shared_state do include ExclusiveLeaseHelpers let(:worker) { described_class.new } diff --git a/spec/workers/update_merge_requests_worker_spec.rb b/spec/workers/update_merge_requests_worker_spec.rb index 14a363f9d59..fb12086c2f4 100644 --- a/spec/workers/update_merge_requests_worker_spec.rb +++ b/spec/workers/update_merge_requests_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe UpdateMergeRequestsWorker do +RSpec.describe UpdateMergeRequestsWorker do include RepoHelpers let(:project) { create(:project, :repository) } diff --git a/spec/workers/update_project_statistics_worker_spec.rb b/spec/workers/update_project_statistics_worker_spec.rb index 191075f1a52..1f840e363ea 100644 --- a/spec/workers/update_project_statistics_worker_spec.rb +++ b/spec/workers/update_project_statistics_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe UpdateProjectStatisticsWorker do +RSpec.describe UpdateProjectStatisticsWorker do let(:worker) { described_class.new } let(:project) { create(:project, :repository) } let(:statistics) { %w(repository_size) } diff --git a/spec/workers/upload_checksum_worker_spec.rb b/spec/workers/upload_checksum_worker_spec.rb index 44e9e4f048d..75d7509b6e6 100644 --- a/spec/workers/upload_checksum_worker_spec.rb +++ b/spec/workers/upload_checksum_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe UploadChecksumWorker do +RSpec.describe UploadChecksumWorker do describe '#perform' do subject { described_class.new } diff --git a/spec/workers/users/create_statistics_worker_spec.rb b/spec/workers/users/create_statistics_worker_spec.rb index 3b2b72a832d..e3f082313a0 100644 --- a/spec/workers/users/create_statistics_worker_spec.rb +++ b/spec/workers/users/create_statistics_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Users::CreateStatisticsWorker do +RSpec.describe Users::CreateStatisticsWorker do describe '#perform' do subject { described_class.new.perform } diff --git a/spec/workers/wait_for_cluster_creation_worker_spec.rb b/spec/workers/wait_for_cluster_creation_worker_spec.rb index b21a9b612af..9079dff1afe 100644 --- a/spec/workers/wait_for_cluster_creation_worker_spec.rb +++ b/spec/workers/wait_for_cluster_creation_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe WaitForClusterCreationWorker do +RSpec.describe WaitForClusterCreationWorker do describe '#perform' do context 'when provider type is gcp' do let(:cluster) { create(:cluster, provider_type: :gcp, provider_gcp: provider) } diff --git a/spec/workers/x509_certificate_revoke_worker_spec.rb b/spec/workers/x509_certificate_revoke_worker_spec.rb index 1e0cbf61267..392cb52d084 100644 --- a/spec/workers/x509_certificate_revoke_worker_spec.rb +++ b/spec/workers/x509_certificate_revoke_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe X509CertificateRevokeWorker do +RSpec.describe X509CertificateRevokeWorker do describe '#perform' do context 'with a revoked certificate' do subject { described_class.new } diff --git a/spec/workers/x509_issuer_crl_check_worker_spec.rb b/spec/workers/x509_issuer_crl_check_worker_spec.rb index f052812b86b..5564147d274 100644 --- a/spec/workers/x509_issuer_crl_check_worker_spec.rb +++ b/spec/workers/x509_issuer_crl_check_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe X509IssuerCrlCheckWorker do +RSpec.describe X509IssuerCrlCheckWorker do subject(:worker) { described_class.new } let(:project) { create(:project, :public, :repository) } |