diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-09 06:07:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-09 06:07:46 +0300 |
commit | 38ff3a81189c8323d323946afcf7dad62c84b9aa (patch) | |
tree | f5763c753d647f63ec06daea3f83f2e0e6d5be4d /spec | |
parent | c46d8e7601c032d954c9f35761ae14dc4bacf6ce (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
6 files changed, 70 insertions, 36 deletions
diff --git a/spec/controllers/projects/settings/repository_controller_spec.rb b/spec/controllers/projects/settings/repository_controller_spec.rb index 51ea2e5d7c6..781e4ff7b00 100644 --- a/spec/controllers/projects/settings/repository_controller_spec.rb +++ b/spec/controllers/projects/settings/repository_controller_spec.rb @@ -19,40 +19,6 @@ RSpec.describe Projects::Settings::RepositoryController, feature_category: :sour expect(response).to have_gitlab_http_status(:ok) expect(response).to render_template(:show) end - - context 'when feature flag `group_protected_branches` disabled' do - before do - stub_feature_flags(group_protected_branches: false) - end - - it 'does not assign instance variable `protected_group_branches`' do - get :show, params: base_params - - expect(assigns).not_to include(:protected_group_branches) - end - end - - context 'when feature flag `group_protected_branches` enabled' do - context 'when the root namespace is a user' do - it 'assigns empty instance variable `protected_group_branches`' do - get :show, params: base_params - - expect(assigns[:protected_group_branches]).to eq([]) - end - end - - context 'when the root namespace is a group' do - let_it_be(:project) { create(:project_empty_repo, :public, :in_group) } - - let(:protected_group_branch) { create(:protected_branch, group: project.root_namespace, project: nil) } - - it 'assigns instance variable `protected_group_branches`' do - get :show, params: base_params - - expect(assigns[:protected_group_branches]).to include(protected_group_branch) - end - end - end end describe 'PUT cleanup' do diff --git a/spec/frontend/boards/components/board_list_header_spec.js b/spec/frontend/boards/components/board_list_header_spec.js index a16b99728c3..80e77921459 100644 --- a/spec/frontend/boards/components/board_list_header_spec.js +++ b/spec/frontend/boards/components/board_list_header_spec.js @@ -35,6 +35,7 @@ describe('Board List Header Component', () => { withLocalStorage = true, currentUserId = 1, listQueryHandler = jest.fn().mockResolvedValue(boardListQueryResponse()), + injectedProps = {}, } = {}) => { const boardId = '1'; @@ -76,6 +77,7 @@ describe('Board List Header Component', () => { currentUserId, isEpicBoard: false, disabled: false, + ...injectedProps, }, }), ); @@ -86,6 +88,7 @@ describe('Board List Header Component', () => { const findAddIssueButton = () => wrapper.findComponent({ ref: 'newIssueBtn' }); const findTitle = () => wrapper.find('.board-title'); const findCaret = () => wrapper.findByTestId('board-title-caret'); + const findSettingsButton = () => wrapper.findComponent({ ref: 'settingsBtn' }); describe('Add issue button', () => { const hasNoAddButton = [ListType.closed]; @@ -126,6 +129,33 @@ describe('Board List Header Component', () => { }); }); + describe('Settings Button', () => { + describe('with disabled=true', () => { + const hasSettings = [ + ListType.assignee, + ListType.milestone, + ListType.iteration, + ListType.label, + ]; + const hasNoSettings = [ListType.backlog, ListType.closed]; + + it.each(hasSettings)('does render for List Type `%s` when disabled=true', (listType) => { + createComponent({ listType, injectedProps: { disabled: true } }); + + expect(findSettingsButton().exists()).toBe(true); + }); + + it.each(hasNoSettings)( + 'does not render for List Type `%s` when disabled=true', + (listType) => { + createComponent({ listType }); + + expect(findSettingsButton().exists()).toBe(false); + }, + ); + }); + }); + describe('expanding / collapsing the column', () => { it('should display collapse icon when column is expanded', async () => { createComponent(); diff --git a/spec/frontend/groups_projects/components/transfer_locations_spec.js b/spec/frontend/groups_projects/components/transfer_locations_spec.js index 74424ee3230..77c0966ba1e 100644 --- a/spec/frontend/groups_projects/components/transfer_locations_spec.js +++ b/spec/frontend/groups_projects/components/transfer_locations_spec.js @@ -15,7 +15,7 @@ import { mountExtended } from 'helpers/vue_test_utils_helper'; import waitForPromises from 'helpers/wait_for_promises'; import createMockApollo from 'helpers/mock_apollo_helper'; import { __ } from '~/locale'; -import TransferLocations from '~/groups_projects/components/transfer_locations.vue'; +import TransferLocations, { i18n } from '~/groups_projects/components/transfer_locations.vue'; import { getTransferLocations } from '~/api/projects_api'; import currentUserNamespaceQuery from '~/projects/settings/graphql/queries/current_user_namespace.query.graphql'; @@ -374,4 +374,23 @@ describe('TransferLocations', () => { expect(wrapper.findByRole('group', { name: label }).exists()).toBe(true); }); }); + + describe('when there are no results', () => { + it('displays no results message', async () => { + mockResolvedGetTransferLocations({ + data: [], + page: '1', + nextPage: null, + total: '0', + totalPages: '1', + prevPage: null, + }); + + createComponent({ propsData: { showUserTransferLocations: false } }); + + await showDropdown(); + + expect(wrapper.findComponent(GlDropdownItem).text()).toBe(i18n.NO_RESULTS_TEXT); + }); + }); }); diff --git a/spec/models/protected_branch_spec.rb b/spec/models/protected_branch_spec.rb index d5e9b04f03e..71e22f848cc 100644 --- a/spec/models/protected_branch_spec.rb +++ b/spec/models/protected_branch_spec.rb @@ -526,4 +526,22 @@ RSpec.describe ProtectedBranch do it { is_expected.not_to be_default_branch } end end + + describe '#group_level?' do + context 'when entity is a Group' do + before do + subject.assign_attributes(project: nil, group: build(:group)) + end + + it { is_expected.to be_group_level } + end + + context 'when entity is a Project' do + before do + subject.assign_attributes(project: build(:project), group: nil) + end + + it { is_expected.not_to be_group_level } + end + end end diff --git a/spec/services/ci/job_token_scope/remove_project_service_spec.rb b/spec/services/ci/job_token_scope/remove_project_service_spec.rb index c3f9081cbd8..e154d8c0422 100644 --- a/spec/services/ci/job_token_scope/remove_project_service_spec.rb +++ b/spec/services/ci/job_token_scope/remove_project_service_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'spec_helper' -RSpec.describe Ci::JobTokenScope::RemoveProjectService do +RSpec.describe Ci::JobTokenScope::RemoveProjectService, feature_category: :continuous_integration do let(:service) { described_class.new(project, current_user) } let_it_be(:project) { create(:project, ci_outbound_job_token_scope_enabled: true).tap(&:save!) } diff --git a/spec/workers/every_sidekiq_worker_spec.rb b/spec/workers/every_sidekiq_worker_spec.rb index c444e1f383c..c583631e4d5 100644 --- a/spec/workers/every_sidekiq_worker_spec.rb +++ b/spec/workers/every_sidekiq_worker_spec.rb @@ -303,6 +303,7 @@ RSpec.describe 'Every Sidekiq worker' do 'Gitlab::JiraImport::Stage::StartImportWorker' => 5, 'Gitlab::PhabricatorImport::ImportTasksWorker' => 5, 'GitlabPerformanceBarStatsWorker' => 3, + 'GitlabSubscriptions::RefreshSeatsWorker' => 0, 'GitlabShellWorker' => 3, 'GitlabServicePingWorker' => 3, 'GroupDestroyWorker' => 3, |