diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-02 00:08:18 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-02 00:08:18 +0300 |
commit | 61666f277a484725307ae2b34697b13a300b2129 (patch) | |
tree | 01f93083ca2cb9d0eeca1443a23c31a4bdbd5532 /spec | |
parent | 4e3a998b8ec1351d8345863f6cad4b9bd497bd6a (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
25 files changed, 119 insertions, 102 deletions
diff --git a/spec/features/dashboard/user_filters_projects_spec.rb b/spec/features/dashboard/user_filters_projects_spec.rb index ba265b34490..174d3847e13 100644 --- a/spec/features/dashboard/user_filters_projects_spec.rb +++ b/spec/features/dashboard/user_filters_projects_spec.rb @@ -145,7 +145,7 @@ RSpec.describe 'Dashboard > User filters projects', feature_category: :projects end it 'filters any project' do - # Selecting the same option in the `GlListbox` does not emit `select` event + # Selecting the same option in the `GlCollapsibleListbox` does not emit `select` event # and that is why URL update won't be triggered. Given that `Any` is a default option # we need to explicitly switch from some other option (e.g. `Internal`) to `Any` # to trigger the page update diff --git a/spec/features/projects/settings/repository_settings_spec.rb b/spec/features/projects/settings/repository_settings_spec.rb index e6cdb436f6f..372454e8a35 100644 --- a/spec/features/projects/settings/repository_settings_spec.rb +++ b/spec/features/projects/settings/repository_settings_spec.rb @@ -201,7 +201,12 @@ RSpec.describe 'Projects > Settings > Repository settings' do click_button 'Mirror repository' end - expect(page).to have_content('Mirroring settings were successfully updated') + # TODO: The following line is skipped because a toast with + # "An error occurred while loading branch rules. Please try again." + # shows up right after which hides the below message. It is causing flakiness. + # https://gitlab.com/gitlab-org/gitlab/-/issues/383717#note_1185091998 + + # expect(page).to have_content('Mirroring settings were successfully updated') expect(project.reload.remote_mirrors.first.keep_divergent_refs).to eq(true) end @@ -217,7 +222,12 @@ RSpec.describe 'Projects > Settings > Repository settings' do click_button 'Mirror repository' end - expect(page).to have_content('Mirroring settings were successfully updated') + # TODO: The following line is skipped because a toast with + # "An error occurred while loading branch rules. Please try again." + # shows up right after which hides the below message. It is causing flakiness. + # https://gitlab.com/gitlab-org/gitlab/-/issues/383717#note_1185091998 + + # expect(page).to have_content('Mirroring settings were successfully updated') expect(page).to have_selector('[title="Copy SSH public key"]') end diff --git a/spec/frontend/admin/background_migrations/components/database_listbox_spec.js b/spec/frontend/admin/background_migrations/components/database_listbox_spec.js index 3778943872e..212f4c0842c 100644 --- a/spec/frontend/admin/background_migrations/components/database_listbox_spec.js +++ b/spec/frontend/admin/background_migrations/components/database_listbox_spec.js @@ -1,4 +1,4 @@ -import { GlListbox } from '@gitlab/ui'; +import { GlCollapsibleListbox } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import BackgroundMigrationsDatabaseListbox from '~/admin/background_migrations/components/database_listbox.vue'; import { visitUrl, setUrlParams } from '~/lib/utils/url_utility'; @@ -30,15 +30,15 @@ describe('BackgroundMigrationsDatabaseListbox', () => { wrapper.destroy(); }); - const findGlListbox = () => wrapper.findComponent(GlListbox); + const findGlCollapsibleListbox = () => wrapper.findComponent(GlCollapsibleListbox); describe('template always', () => { beforeEach(() => { createComponent(); }); - it('renders GlListbox', () => { - expect(findGlListbox().exists()).toBe(true); + it('renders GlCollapsibleListbox', () => { + expect(findGlCollapsibleListbox().exists()).toBe(true); }); }); @@ -48,7 +48,7 @@ describe('BackgroundMigrationsDatabaseListbox', () => { }); it('selecting a listbox item fires visitUrl with the database param', () => { - findGlListbox().vm.$emit('select', MOCK_DATABASES[1].value); + findGlCollapsibleListbox().vm.$emit('select', MOCK_DATABASES[1].value); expect(setUrlParams).toHaveBeenCalledWith({ database: MOCK_DATABASES[1].value }); expect(visitUrl).toHaveBeenCalled(); diff --git a/spec/frontend/listbox/index_spec.js b/spec/frontend/listbox/index_spec.js index fd41531796b..0816152f4e3 100644 --- a/spec/frontend/listbox/index_spec.js +++ b/spec/frontend/listbox/index_spec.js @@ -1,6 +1,6 @@ import { nextTick } from 'vue'; import { getAllByRole, getByTestId } from '@testing-library/dom'; -import { GlListbox } from '@gitlab/ui'; +import { GlCollapsibleListbox } from '@gitlab/ui'; import { createWrapper } from '@vue/test-utils'; import { initListbox, parseAttributes } from '~/listbox'; import { getFixture, setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures'; @@ -41,7 +41,7 @@ describe('initListbox', () => { describe('given a valid element', () => { let onChangeSpy; - const listbox = () => createWrapper(instance).findComponent(GlListbox); + const listbox = () => createWrapper(instance).findComponent(GlCollapsibleListbox); const findToggleButton = () => getByTestId(document.body, 'base-dropdown-toggle'); const findSelectedItems = () => getAllByRole(document.body, 'option', { selected: true }); diff --git a/spec/frontend/pages/import/fogbugz/new_user_map/components/user_select_spec.js b/spec/frontend/pages/import/fogbugz/new_user_map/components/user_select_spec.js index c1e1545944b..d60730e630b 100644 --- a/spec/frontend/pages/import/fogbugz/new_user_map/components/user_select_spec.js +++ b/spec/frontend/pages/import/fogbugz/new_user_map/components/user_select_spec.js @@ -1,6 +1,6 @@ import Vue, { nextTick } from 'vue'; import VueApollo from 'vue-apollo'; -import { GlListbox } from '@gitlab/ui'; +import { GlCollapsibleListbox } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import searchUsersQuery from '~/graphql_shared/queries/users_search_all.query.graphql'; @@ -59,7 +59,7 @@ describe('fogbugz user select component', () => { const id = 8; - wrapper.findComponent(GlListbox).vm.$emit('select', `gid://gitlab/User/${id}`); + wrapper.findComponent(GlCollapsibleListbox).vm.$emit('select', `gid://gitlab/User/${id}`); await nextTick(); expect(wrapper.get('input').attributes('value')).toBe(id.toString()); @@ -69,7 +69,7 @@ describe('fogbugz user select component', () => { createComponent(); jest.runOnlyPendingTimers(); - wrapper.findComponent(GlListbox).vm.$emit('search', 'test'); + wrapper.findComponent(GlCollapsibleListbox).vm.$emit('search', 'test'); await nextTick(); jest.runOnlyPendingTimers(); diff --git a/spec/frontend/vue_shared/components/group_select/group_select_spec.js b/spec/frontend/vue_shared/components/group_select/group_select_spec.js index f959d2225fa..c10b32c6acc 100644 --- a/spec/frontend/vue_shared/components/group_select/group_select_spec.js +++ b/spec/frontend/vue_shared/components/group_select/group_select_spec.js @@ -1,5 +1,5 @@ import { nextTick } from 'vue'; -import { GlListbox } from '@gitlab/ui'; +import { GlCollapsibleListbox } from '@gitlab/ui'; import MockAdapter from 'axios-mock-adapter'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import axios from '~/lib/utils/axios_utils'; @@ -31,7 +31,7 @@ describe('GroupSelect', () => { const inputId = 'inputId'; // Finders - const findListbox = () => wrapper.findComponent(GlListbox); + const findListbox = () => wrapper.findComponent(GlCollapsibleListbox); const findInput = () => wrapper.findByTestId('input'); // Helpers diff --git a/spec/lib/banzai/filter/repository_link_filter_spec.rb b/spec/lib/banzai/filter/repository_link_filter_spec.rb index 4aeb6e2a722..0df680dc0c8 100644 --- a/spec/lib/banzai/filter/repository_link_filter_spec.rb +++ b/spec/lib/banzai/filter/repository_link_filter_spec.rb @@ -69,7 +69,7 @@ RSpec.describe Banzai::Filter::RepositoryLinkFilter do expect { filter(raw_doc) }.to change { Gitlab::GitalyClient.get_request_count }.by(2) end - shared_examples :preserve_unchanged do + shared_examples 'preserve unchanged' do it 'does not modify any relative URL in anchor' do doc = filter(link('README.md')) expect(doc.at_css('a')['href']).to eq 'README.md' @@ -96,25 +96,25 @@ RSpec.describe Banzai::Filter::RepositoryLinkFilter do context 'with a wiki' do let(:wiki) { double('ProjectWiki') } - include_examples :preserve_unchanged + include_examples 'preserve unchanged' end context 'without a repository' do let(:project) { create(:project) } - include_examples :preserve_unchanged + include_examples 'preserve unchanged' end context 'with an empty repository' do let(:project) { create(:project_empty_repo) } - include_examples :preserve_unchanged + include_examples 'preserve unchanged' end context 'without project repository access' do let(:project) { create(:project, :repository, repository_access_level: ProjectFeature::PRIVATE) } - include_examples :preserve_unchanged + include_examples 'preserve unchanged' end it 'does not raise an exception on invalid URIs' do @@ -147,7 +147,7 @@ RSpec.describe Banzai::Filter::RepositoryLinkFilter do .to eq "/#{project_path}/-/blob/#{ref}/non/existent.file" end - shared_examples :valid_repository do + shared_examples 'valid repository' do it 'handles Gitaly unavailable exceptions gracefully' do allow_next_instance_of(Gitlab::GitalyClient::BlobService) do |blob_service| allow(blob_service).to receive(:get_blob_types).and_raise(GRPC::Unavailable) @@ -364,13 +364,13 @@ RSpec.describe Banzai::Filter::RepositoryLinkFilter do end context 'with a valid commit' do - include_examples :valid_repository + include_examples 'valid repository' end context 'with a valid ref' do # force filter to use ref instead of commit let(:commit) { nil } - include_examples :valid_repository + include_examples 'valid repository' end end diff --git a/spec/lib/gitlab/asciidoc_spec.rb b/spec/lib/gitlab/asciidoc_spec.rb index d2eb9209f42..3d9076c6fa7 100644 --- a/spec/lib/gitlab/asciidoc_spec.rb +++ b/spec/lib/gitlab/asciidoc_spec.rb @@ -697,7 +697,7 @@ module Gitlab end end - shared_examples :invalid_include do + shared_examples 'invalid include' do let(:include_path) { 'dk.png' } before do @@ -716,7 +716,7 @@ module Gitlab context 'with path to a binary file' do let(:blob) { fake_blob(path: 'dk.png', binary: true) } - include_examples :invalid_include + include_examples 'invalid include' end context 'with path to file in external storage' do @@ -727,7 +727,7 @@ module Gitlab project.update_attribute(:lfs_enabled, true) end - include_examples :invalid_include + include_examples 'invalid include' end context 'with path to a textual file' do @@ -737,7 +737,7 @@ module Gitlab create_file(file_path, "Content from #{include_path}") end - shared_examples :valid_include do + shared_examples 'valid include' do [ ['/doc/sample.adoc', 'doc/sample.adoc', 'absolute path'], ['sample.adoc', 'doc/api/sample.adoc', 'relative path'], @@ -760,24 +760,24 @@ module Gitlab context 'when requested path is a file in the repo' do let(:requested_path) { 'doc/api/README.adoc' } - include_examples :valid_include + include_examples 'valid include' context 'without a commit (only ref)' do let(:commit) { nil } - include_examples :valid_include + include_examples 'valid include' end end context 'when requested path is a directory in the repo' do let(:requested_path) { 'doc/api/' } - include_examples :valid_include + include_examples 'valid include' context 'without a commit (only ref)' do let(:commit) { nil } - include_examples :valid_include + include_examples 'valid include' end end end diff --git a/spec/lib/gitlab/ci/build/cache_spec.rb b/spec/lib/gitlab/ci/build/cache_spec.rb index 7477aedb994..a8fa14b4b4c 100644 --- a/spec/lib/gitlab/ci/build/cache_spec.rb +++ b/spec/lib/gitlab/ci/build/cache_spec.rb @@ -14,8 +14,8 @@ RSpec.describe Gitlab::Ci::Build::Cache do cache = described_class.new(cache_config, pipeline) - expect(Gitlab::Ci::Pipeline::Seed::Build::Cache).to have_received(:new).with(pipeline, { key: 'key-a' }) - expect(Gitlab::Ci::Pipeline::Seed::Build::Cache).to have_received(:new).with(pipeline, { key: 'key-b' }) + expect(Gitlab::Ci::Pipeline::Seed::Build::Cache).to have_received(:new).with(pipeline, { key: 'key-a' }, 0) + expect(Gitlab::Ci::Pipeline::Seed::Build::Cache).to have_received(:new).with(pipeline, { key: 'key-b' }, 1) expect(cache.instance_variable_get(:@cache)).to eq([cache_seed_a, cache_seed_b]) end end @@ -29,7 +29,7 @@ RSpec.describe Gitlab::Ci::Build::Cache do cache = described_class.new(cache_config, pipeline) - expect(Gitlab::Ci::Pipeline::Seed::Build::Cache).to have_received(:new).with(pipeline, cache_config) + expect(Gitlab::Ci::Pipeline::Seed::Build::Cache).to have_received(:new).with(pipeline, cache_config, 0) expect(cache.instance_variable_get(:@cache)).to eq([cache_seed]) end end diff --git a/spec/lib/gitlab/ci/pipeline/seed/build/cache_spec.rb b/spec/lib/gitlab/ci/pipeline/seed/build/cache_spec.rb index 910c12389c3..fb8020bf43e 100644 --- a/spec/lib/gitlab/ci/pipeline/seed/build/cache_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/seed/build/cache_spec.rb @@ -6,8 +6,9 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Build::Cache do let_it_be(:project) { create(:project, :repository) } let_it_be(:head_sha) { project.repository.head_commit.id } let_it_be(:pipeline) { create(:ci_pipeline, project: project, sha: head_sha) } + let(:index) { 1 } - let(:processor) { described_class.new(pipeline, config) } + let(:processor) { described_class.new(pipeline, config, index) } describe '#attributes' do subject { processor.attributes } @@ -40,10 +41,12 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Build::Cache do { key: { files: files } } end - it 'uses default key' do - expected = { key: 'default' } + context 'without a prefix' do + it 'uses default key with an index as a prefix' do + expected = { key: '1-default' } - is_expected.to include(expected) + is_expected.to include(expected) + end end end @@ -57,13 +60,15 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Build::Cache do } end - it 'builds a string key' do - expected = { - key: '703ecc8fef1635427a1f86a8a1a308831c122392', - paths: ['vendor/ruby'] - } + context 'without a prefix' do + it 'builds a string key with an index as a prefix' do + expected = { + key: '1-703ecc8fef1635427a1f86a8a1a308831c122392', + paths: ['vendor/ruby'] + } - is_expected.to include(expected) + is_expected.to include(expected) + end end end @@ -107,10 +112,12 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Build::Cache do } end - it 'builds a string key' do - expected = { key: '74bf43fb1090f161bdd4e265802775dbda2f03d1' } + context 'without a prefix' do + it 'builds a string key with an index as a prefix' do + expected = { key: '1-74bf43fb1090f161bdd4e265802775dbda2f03d1' } - is_expected.to include(expected) + is_expected.to include(expected) + end end end diff --git a/spec/lib/gitlab/ci/pipeline/seed/build_spec.rb b/spec/lib/gitlab/ci/pipeline/seed/build_spec.rb index 75f6a773c2d..ee95cf4d2f8 100644 --- a/spec/lib/gitlab/ci/pipeline/seed/build_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/seed/build_spec.rb @@ -152,7 +152,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Seed::Build do it 'includes cache options' do cache_options = { options: { - cache: [a_hash_including(key: 'f155568ad0933d8358f66b846133614f76dd0ca4')] + cache: [a_hash_including(key: '0-f155568ad0933d8358f66b846133614f76dd0ca4')] } } diff --git a/spec/lib/gitlab/email/handler/create_issue_handler_spec.rb b/spec/lib/gitlab/email/handler/create_issue_handler_spec.rb index 75538baf07f..ad183fd422b 100644 --- a/spec/lib/gitlab/email/handler/create_issue_handler_spec.rb +++ b/spec/lib/gitlab/email/handler/create_issue_handler_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe Gitlab::Email::Handler::CreateIssueHandler do - include_context :email_shared_context + include_context 'email shared context' let!(:user) do create( :user, @@ -16,7 +16,7 @@ RSpec.describe Gitlab::Email::Handler::CreateIssueHandler do let(:namespace) { create(:namespace, path: 'gitlabhq') } let(:email_raw) { email_fixture('emails/valid_new_issue.eml') } - it_behaves_like :reply_processing_shared_examples + it_behaves_like 'reply processing shared examples' before do stub_incoming_email_setting(enabled: true, address: "incoming+%{key}@appmail.adventuretime.ooo") diff --git a/spec/lib/gitlab/email/handler/create_merge_request_handler_spec.rb b/spec/lib/gitlab/email/handler/create_merge_request_handler_spec.rb index 37ee4591db0..60bb94e841f 100644 --- a/spec/lib/gitlab/email/handler/create_merge_request_handler_spec.rb +++ b/spec/lib/gitlab/email/handler/create_merge_request_handler_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe Gitlab::Email::Handler::CreateMergeRequestHandler do - include_context :email_shared_context + include_context 'email shared context' let!(:user) do create( :user, @@ -16,7 +16,7 @@ RSpec.describe Gitlab::Email::Handler::CreateMergeRequestHandler do let(:namespace) { create(:namespace, path: 'gitlabhq') } let(:email_raw) { email_fixture('emails/valid_new_merge_request.eml') } - it_behaves_like :reply_processing_shared_examples + it_behaves_like 'reply processing shared examples' before do stub_incoming_email_setting(enabled: true, address: "incoming+%{key}@appmail.adventuretime.ooo") diff --git a/spec/lib/gitlab/email/handler/create_note_handler_spec.rb b/spec/lib/gitlab/email/handler/create_note_handler_spec.rb index 585dce331ed..222fdb2088b 100644 --- a/spec/lib/gitlab/email/handler/create_note_handler_spec.rb +++ b/spec/lib/gitlab/email/handler/create_note_handler_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe Gitlab::Email::Handler::CreateNoteHandler do - include_context :email_shared_context + include_context 'email shared context' let_it_be(:user) { create(:user, email: 'jake@adventuretime.ooo') } let_it_be(:project) { create(:project, :public, :repository) } @@ -15,9 +15,9 @@ RSpec.describe Gitlab::Email::Handler::CreateNoteHandler do SentNotification.record_note(note, user.id, mail_key) end - it_behaves_like :reply_processing_shared_examples + it_behaves_like 'reply processing shared examples' - it_behaves_like :note_handler_shared_examples do + it_behaves_like 'note handler shared examples' do let(:recipient) { sent_notification.recipient } let(:update_commands_only) { fixture_file('emails/update_commands_only_reply.eml') } @@ -92,7 +92,7 @@ RSpec.describe Gitlab::Email::Handler::CreateNoteHandler do issue.update_attribute(:confidential, true) end - it_behaves_like :checks_permissions_on_noteable_examples + it_behaves_like 'checks permissions on noteable examples' end shared_examples 'a reply to existing comment' do diff --git a/spec/lib/gitlab/email/handler/create_note_on_issuable_handler_spec.rb b/spec/lib/gitlab/email/handler/create_note_on_issuable_handler_spec.rb index d3535fa9bd3..6e83c06c1b4 100644 --- a/spec/lib/gitlab/email/handler/create_note_on_issuable_handler_spec.rb +++ b/spec/lib/gitlab/email/handler/create_note_on_issuable_handler_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe Gitlab::Email::Handler::CreateNoteOnIssuableHandler do - include_context :email_shared_context + include_context 'email shared context' let_it_be(:user) { create(:user, email: 'jake@adventuretime.ooo', incoming_email_token: 'auth_token') } let_it_be(:namespace) { create(:namespace, path: 'gitlabhq') } @@ -17,9 +17,9 @@ RSpec.describe Gitlab::Email::Handler::CreateNoteOnIssuableHandler do stub_config_setting(host: 'localhost') end - it_behaves_like :reply_processing_shared_examples + it_behaves_like 'reply processing shared examples' - it_behaves_like :note_handler_shared_examples, true do + it_behaves_like 'note handler shared examples', true do let_it_be(:recipient) { user } let(:update_commands_only) { email_reply_fixture('emails/update_commands_only.eml') } @@ -42,7 +42,7 @@ RSpec.describe Gitlab::Email::Handler::CreateNoteOnIssuableHandler do noteable.update_attribute(:confidential, true) end - it_behaves_like :checks_permissions_on_noteable_examples + it_behaves_like 'checks permissions on noteable examples' end def email_fixture(path) diff --git a/spec/lib/gitlab/email/handler/service_desk_handler_spec.rb b/spec/lib/gitlab/email/handler/service_desk_handler_spec.rb index 08a7383700b..0cfd81216dc 100644 --- a/spec/lib/gitlab/email/handler/service_desk_handler_spec.rb +++ b/spec/lib/gitlab/email/handler/service_desk_handler_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe Gitlab::Email::Handler::ServiceDeskHandler do - include_context :email_shared_context + include_context 'email shared context' before do stub_incoming_email_setting(enabled: true, address: "incoming+%{key}@appmail.adventuretime.ooo") diff --git a/spec/lib/gitlab/email/handler/unsubscribe_handler_spec.rb b/spec/lib/gitlab/email/handler/unsubscribe_handler_spec.rb index 2bc3cd81b48..f33e9eba5c6 100644 --- a/spec/lib/gitlab/email/handler/unsubscribe_handler_spec.rb +++ b/spec/lib/gitlab/email/handler/unsubscribe_handler_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe Gitlab::Email::Handler::UnsubscribeHandler do - include_context :email_shared_context + include_context 'email shared context' before do stub_incoming_email_setting(enabled: true, address: 'reply+%{key}@appmail.adventuretime.ooo') diff --git a/spec/lib/gitlab/email/receiver_spec.rb b/spec/lib/gitlab/email/receiver_spec.rb index 9240d07fd59..865e40d4ecb 100644 --- a/spec/lib/gitlab/email/receiver_spec.rb +++ b/spec/lib/gitlab/email/receiver_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe Gitlab::Email::Receiver do - include_context :email_shared_context + include_context 'email shared context' let_it_be(:project) { create(:project) } let(:metric_transaction) { instance_double(Gitlab::Metrics::WebTransaction) } diff --git a/spec/lib/gitlab/git/tree_spec.rb b/spec/lib/gitlab/git/tree_spec.rb index 17f802b9f66..2a68fa66b18 100644 --- a/spec/lib/gitlab/git/tree_spec.rb +++ b/spec/lib/gitlab/git/tree_spec.rb @@ -8,7 +8,7 @@ RSpec.describe Gitlab::Git::Tree do let(:project) { create(:project, :repository) } let(:repository) { project.repository.raw } - shared_examples :repo do + shared_examples 'repo' do subject(:tree) { Gitlab::Git::Tree.where(repository, sha, path, recursive, skip_flat_paths, pagination_params) } let(:sha) { SeedRepo::Commit::ID } @@ -151,7 +151,7 @@ RSpec.describe Gitlab::Git::Tree do end describe '.where with Gitaly enabled' do - it_behaves_like :repo do + it_behaves_like 'repo' do context 'with pagination parameters' do let(:pagination_params) { { limit: 3, page_token: nil } } @@ -172,7 +172,7 @@ RSpec.describe Gitlab::Git::Tree do described_class.where(repository, SeedRepo::Commit::ID, 'files', false, false) end - it_behaves_like :repo do + it_behaves_like 'repo' do describe 'Pagination' do context 'with restrictive limit' do let(:pagination_params) { { limit: 3, page_token: nil } } diff --git a/spec/models/design_management/version_spec.rb b/spec/models/design_management/version_spec.rb index 44ecae82174..8c0d7e99ae5 100644 --- a/spec/models/design_management/version_spec.rb +++ b/spec/models/design_management/version_spec.rb @@ -232,7 +232,7 @@ RSpec.describe DesignManagement::Version do context 'there is a single design' do let_it_be(:design) { create(:design) } - shared_examples :a_correctly_categorised_design do |kind, category| + shared_examples 'a correctly categorised design' do |kind, category| let_it_be(:version) { create(:design_version, kind => [design]) } it 'returns a hash with a single key and the single design in that bucket' do @@ -240,9 +240,9 @@ RSpec.describe DesignManagement::Version do end end - it_behaves_like :a_correctly_categorised_design, :created_designs, 'creation' - it_behaves_like :a_correctly_categorised_design, :modified_designs, 'modification' - it_behaves_like :a_correctly_categorised_design, :deleted_designs, 'deletion' + it_behaves_like 'a correctly categorised design', :created_designs, 'creation' + it_behaves_like 'a correctly categorised design', :modified_designs, 'modification' + it_behaves_like 'a correctly categorised design', :deleted_designs, 'deletion' end context 'there are a bunch of different designs in a variety of states' do diff --git a/spec/models/integrations/drone_ci_spec.rb b/spec/models/integrations/drone_ci_spec.rb index 6ff6888e0d3..c46face9702 100644 --- a/spec/models/integrations/drone_ci_spec.rb +++ b/spec/models/integrations/drone_ci_spec.rb @@ -37,7 +37,7 @@ RSpec.describe Integrations::DroneCi, :use_clean_rails_memory_store_caching do end end - shared_context :drone_ci_integration do + shared_context 'drone ci integration' do subject(:drone) do described_class.new( project: project, @@ -116,7 +116,7 @@ RSpec.describe Integrations::DroneCi, :use_clean_rails_memory_store_caching do end it_behaves_like Integrations::HasWebHook do - include_context :drone_ci_integration + include_context 'drone ci integration' let(:integration) { drone } let(:hook_url) { "#{drone_url}/hook?owner=#{project.namespace.full_path}&name=#{project.path}&access_token={token}" } @@ -130,14 +130,14 @@ RSpec.describe Integrations::DroneCi, :use_clean_rails_memory_store_caching do end describe "integration page/path methods" do - include_context :drone_ci_integration + include_context 'drone ci integration' it { expect(drone.build_page(sha, branch)).to eq(build_page) } it { expect(drone.commit_status_path(sha, branch)).to eq(commit_status_path) } end describe '#commit_status' do - include_context :drone_ci_integration + include_context 'drone ci integration' it 'returns the contents of the reactive cache' do stub_reactive_cache(drone, { commit_status: 'foo' }, 'sha', 'ref') @@ -147,7 +147,7 @@ RSpec.describe Integrations::DroneCi, :use_clean_rails_memory_store_caching do end describe '#calculate_reactive_cache' do - include_context :drone_ci_integration + include_context 'drone ci integration' describe '#commit_status' do subject { drone.calculate_reactive_cache(sha, branch)[:commit_status] } @@ -193,7 +193,7 @@ RSpec.describe Integrations::DroneCi, :use_clean_rails_memory_store_caching do end describe "execute" do - include_context :drone_ci_integration + include_context 'drone ci integration' let(:user) { build(:user, username: 'username') } let(:push_sample_data) do diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 7faf9b51720..ec6eca2a66a 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -4436,7 +4436,7 @@ RSpec.describe User do shared_context '#ci_owned_runners' do let(:user) { create(:user) } - shared_examples :nested_groups_owner do + shared_examples 'nested groups owner' do context 'when the user is the owner of a multi-level group' do before do set_permissions_for_users @@ -4453,7 +4453,7 @@ RSpec.describe User do end end - shared_examples :group_owner do + shared_examples 'group owner' do context 'when the user is the owner of a one level group' do before do group.add_owner(user) @@ -4469,7 +4469,7 @@ RSpec.describe User do end end - shared_examples :project_owner do + shared_examples 'project owner' do context 'when the user is the owner of a project' do it 'loads the runner belonging to the project' do expect(user.ci_owned_runners).to contain_exactly(runner) @@ -4481,7 +4481,7 @@ RSpec.describe User do end end - shared_examples :project_member do + shared_examples 'project member' do context 'when the user is a maintainer' do before do add_user(:maintainer) @@ -4539,7 +4539,7 @@ RSpec.describe User do end end - shared_examples :group_member do + shared_examples 'group member' do context 'when the user is a maintainer' do before do add_user(:maintainer) @@ -4612,7 +4612,7 @@ RSpec.describe User do let!(:project) { create(:project, namespace: namespace) } let!(:runner) { create(:ci_runner, :project, projects: [project]) } - it_behaves_like :project_owner + it_behaves_like 'project owner' end context 'with group runner in a non owned group' do @@ -4623,14 +4623,14 @@ RSpec.describe User do group.add_member(user, access) end - it_behaves_like :group_member + it_behaves_like 'group member' end context 'with group runner in an owned group' do let!(:group) { create(:group) } let!(:group_runner) { create(:ci_runner, :group, groups: [group]) } - it_behaves_like :group_owner + it_behaves_like 'group owner' end context 'with group runner in an owned group and group runner in a different owner subgroup' do @@ -4645,7 +4645,7 @@ RSpec.describe User do subgroup.add_owner(another_user) end - it_behaves_like :nested_groups_owner + it_behaves_like 'nested groups owner' end context 'with personal project runner in an an owned group and a group runner in that same group' do @@ -4658,7 +4658,7 @@ RSpec.describe User do group.add_owner(user) end - it_behaves_like :nested_groups_owner + it_behaves_like 'nested groups owner' end context 'with personal project runner in an owned group and a group runner in a subgroup' do @@ -4672,7 +4672,7 @@ RSpec.describe User do group.add_owner(user) end - it_behaves_like :nested_groups_owner + it_behaves_like 'nested groups owner' end context 'with personal project runner in an owned group in an owned namespace and a group runner in that group' do @@ -4686,7 +4686,7 @@ RSpec.describe User do group.add_owner(user) end - it_behaves_like :nested_groups_owner + it_behaves_like 'nested groups owner' end context 'with personal project runner in an owned namespace, an owned group, a subgroup and a group runner in that subgroup' do @@ -4701,7 +4701,7 @@ RSpec.describe User do group.add_owner(user) end - it_behaves_like :nested_groups_owner + it_behaves_like 'nested groups owner' end context 'with a project runner that belong to projects that belong to a not owned group' do @@ -4713,7 +4713,7 @@ RSpec.describe User do project.add_member(user, access) end - it_behaves_like :project_member + it_behaves_like 'project member' end context 'with project runners that belong to projects that do not belong to any group' do @@ -4736,7 +4736,7 @@ RSpec.describe User do group.add_member(another_user, :owner) end - it_behaves_like :group_member + it_behaves_like 'group member' end end diff --git a/spec/requests/api/graphql/project/issue/design_collection/version_spec.rb b/spec/requests/api/graphql/project/issue/design_collection/version_spec.rb index 0444ce43c22..93e32f72ec7 100644 --- a/spec/requests/api/graphql/project/issue/design_collection/version_spec.rb +++ b/spec/requests/api/graphql/project/issue/design_collection/version_spec.rb @@ -67,7 +67,7 @@ RSpec.describe 'Query.project(fullPath).issue(iid).designCollection.version(sha) query_graphql_field(:design_at_version, dav_params, 'id filename') end - shared_examples :finds_dav do + shared_examples 'finds dav' do it 'finds all the designs as of the given version' do post_query @@ -88,19 +88,19 @@ RSpec.describe 'Query.project(fullPath).issue(iid).designCollection.version(sha) context 'by ID' do let(:dav_params) { { id: global_id_of(design_at_version) } } - include_examples :finds_dav + include_examples 'finds dav' end context 'by filename' do let(:dav_params) { { filename: design.filename } } - include_examples :finds_dav + include_examples 'finds dav' end context 'by design_id' do let(:dav_params) { { design_id: global_id_of(design) } } - include_examples :finds_dav + include_examples 'finds dav' end end diff --git a/spec/rubocop/cop/performance/readlines_each_spec.rb b/spec/rubocop/cop/performance/readlines_each_spec.rb index d876cbf79a5..11e2cee9262 100644 --- a/spec/rubocop/cop/performance/readlines_each_spec.rb +++ b/spec/rubocop/cop/performance/readlines_each_spec.rb @@ -6,7 +6,7 @@ require_relative '../../../../rubocop/cop/performance/readlines_each' RSpec.describe RuboCop::Cop::Performance::ReadlinesEach do let(:message) { 'Avoid `IO.readlines.each`, since it reads contents into memory in full. Use `IO.each_line` or `IO.each` instead.' } - shared_examples_for(:class_read) do |klass| + shared_examples_for('class read') do |klass| context "and it is called as a class method on #{klass}" do it 'flags it as an offense' do leading_readline = "#{klass}.readlines(file_path)." @@ -29,7 +29,7 @@ RSpec.describe RuboCop::Cop::Performance::ReadlinesEach do context 'when reading all lines using IO.readlines.each' do %w(IO File).each do |klass| - it_behaves_like(:class_read, klass) + it_behaves_like('class read', klass) end context 'and it is called as an instance method on a return value' do diff --git a/spec/support/shared_contexts/email_shared_context.rb b/spec/support/shared_contexts/email_shared_context.rb index 086cdf50e9d..12d4af5170b 100644 --- a/spec/support/shared_contexts/email_shared_context.rb +++ b/spec/support/shared_contexts/email_shared_context.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.shared_context :email_shared_context do +RSpec.shared_context 'email shared context' do let(:mail_key) { '59d8df8370b7e95c5a49fbf86aeb2c93' } let(:receiver) { Gitlab::Email::Receiver.new(email_raw) } let(:markdown) { '![image](uploads/image.png)' } @@ -27,7 +27,7 @@ def service_desk_fixture(path, slug: nil, key: 'mykey') fixture_file(path).gsub('project_slug', slug).gsub('project_key', key) end -RSpec.shared_examples :reply_processing_shared_examples do +RSpec.shared_examples 'reply processing shared examples' do context 'when the user could not be found' do before do user.destroy! @@ -49,7 +49,7 @@ RSpec.shared_examples :reply_processing_shared_examples do end end -RSpec.shared_examples :checks_permissions_on_noteable_examples do +RSpec.shared_examples 'checks permissions on noteable examples' do context 'when user has access' do before do project.add_reporter(user) @@ -67,7 +67,7 @@ RSpec.shared_examples :checks_permissions_on_noteable_examples do end end -RSpec.shared_examples :note_handler_shared_examples do |forwardable| +RSpec.shared_examples 'note handler shared examples' do |forwardable| context 'when the noteable could not be found' do before do noteable.destroy! @@ -157,7 +157,7 @@ RSpec.shared_examples :note_handler_shared_examples do |forwardable| noteable.update_attribute(:discussion_locked, true) end - it_behaves_like :checks_permissions_on_noteable_examples + it_behaves_like 'checks permissions on noteable examples' end context 'when everything is fine' do |