diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-10 09:10:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-10 09:10:29 +0300 |
commit | 3669bcfaaa7cd18b6b6f890bdd6f75c13e74b830 (patch) | |
tree | c463a7297675a617fbf63e14db28667d54d3daf0 /spec | |
parent | 9cf88c2d9632fe649bd3523fd490d6f5523fb8d0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
17 files changed, 55 insertions, 22 deletions
diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index 96840e09ccf..5024698a769 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -191,7 +191,7 @@ RSpec.describe Projects::IssuesController, :request_store, feature_category: :te it 'redirects to work item page using iid' do make_request - expect(response).to redirect_to(project_work_items_path(project, task.iid, query)) + expect(response).to redirect_to(project_work_item_path(project, task.iid, query)) end end diff --git a/spec/controllers/projects/work_items_controller_spec.rb b/spec/controllers/projects/work_items_controller_spec.rb index e0f61a4977b..fc5ac77c96c 100644 --- a/spec/controllers/projects/work_items_controller_spec.rb +++ b/spec/controllers/projects/work_items_controller_spec.rb @@ -34,10 +34,10 @@ RSpec.describe Projects::WorkItemsController, feature_category: :team_planning d end end - describe 'GET index' do + describe 'GET show' do specify do expect( - get(:index, params: { namespace_id: project.namespace, project_id: project, work_items_path: work_item.id }) + get(:show, params: { namespace_id: project.namespace, project_id: project, iid: work_item.iid }) ).to have_request_urgency(:low) end end diff --git a/spec/factories/packages/package_protection_rules.rb b/spec/factories/packages/protection/rules.rb index 3038fb847e7..3038fb847e7 100644 --- a/spec/factories/packages/package_protection_rules.rb +++ b/spec/factories/packages/protection/rules.rb diff --git a/spec/features/projects/work_items/linked_work_items_spec.rb b/spec/features/projects/work_items/linked_work_items_spec.rb index 1fa2f66e71e..66016cf8b7b 100644 --- a/spec/features/projects/work_items/linked_work_items_spec.rb +++ b/spec/features/projects/work_items/linked_work_items_spec.rb @@ -7,7 +7,7 @@ RSpec.describe 'Work item linked items', :js, feature_category: :team_planning d let_it_be(:project) { create(:project, :public, namespace: group) } let_it_be(:user) { create(:user) } let_it_be(:work_item) { create(:work_item, project: project) } - let(:work_items_path) { project_work_items_path(project, work_items_path: work_item.iid) } + let(:work_items_path) { project_work_item_path(project, work_item.iid) } let_it_be(:task) { create(:work_item, :task, project: project, title: 'Task 1') } context 'for signed in user' do diff --git a/spec/features/projects/work_items/work_item_spec.rb b/spec/features/projects/work_items/work_item_spec.rb index a1f5466f5bf..d5e3fd253b6 100644 --- a/spec/features/projects/work_items/work_item_spec.rb +++ b/spec/features/projects/work_items/work_item_spec.rb @@ -12,7 +12,7 @@ RSpec.describe 'Work item', :js, feature_category: :team_planning do let_it_be(:milestone) { create(:milestone, project: project) } let_it_be(:milestones) { create_list(:milestone, 25, project: project) } let_it_be(:note) { create(:note, noteable: work_item, project: work_item.project) } - let(:work_items_path) { project_work_items_path(project, work_items_path: work_item.iid) } + let(:work_items_path) { project_work_item_path(project, work_item.iid) } context 'for signed in user' do before do diff --git a/spec/fixtures/markdown.md.erb b/spec/fixtures/markdown.md.erb index 37376713355..8e11f95be8b 100644 --- a/spec/fixtures/markdown.md.erb +++ b/spec/fixtures/markdown.md.erb @@ -203,7 +203,7 @@ Note: work item references use `#`, which get built as an issue link. - Ignored in code: `<%= work_item.to_reference %>` - Ignored in links: [Link to <%= work_item.to_reference %>](#work_item-link) - Ignored when backslash escaped: \<%= work_item.to_reference %> -- Work item by URL: <%= urls.project_work_item_url(work_item.project, work_item) %> +- Work item by URL: <%= urls.project_work_item_url(work_item.project, work_item.iid) %> - Link to work item by reference (counted as an issue reference): [Work item](<%= work_item.to_reference %>) - Link to work item by URL: [Work item](<%= urls.project_work_item_url(work_item.project, work_item) %>) diff --git a/spec/frontend/search/sidebar/components/app_spec.js b/spec/frontend/search/sidebar/components/app_spec.js index 8e23f9c1680..d8d2492209e 100644 --- a/spec/frontend/search/sidebar/components/app_spec.js +++ b/spec/frontend/search/sidebar/components/app_spec.js @@ -16,6 +16,7 @@ import BlobsFilters from '~/search/sidebar/components/blobs_filters.vue'; import ProjectsFilters from '~/search/sidebar/components/projects_filters.vue'; import NotesFilters from '~/search/sidebar/components/notes_filters.vue'; import CommitsFilters from '~/search/sidebar/components/commits_filters.vue'; +import MilestonesFilters from '~/search/sidebar/components/milestones_filters.vue'; import ScopeLegacyNavigation from '~/search/sidebar/components/scope_legacy_navigation.vue'; import SmallScreenDrawerNavigation from '~/search/sidebar/components/small_screen_drawer_navigation.vue'; import ScopeSidebarNavigation from '~/search/sidebar/components/scope_sidebar_navigation.vue'; @@ -47,6 +48,7 @@ describe('GlobalSearchSidebar', () => { glFeatures: { searchNotesHideArchivedProjects: true, searchCommitsHideArchivedProjects: true, + searchMilestonesHideArchivedProjects: true, }, }, }); @@ -59,6 +61,7 @@ describe('GlobalSearchSidebar', () => { const findProjectsFilters = () => wrapper.findComponent(ProjectsFilters); const findNotesFilters = () => wrapper.findComponent(NotesFilters); const findCommitsFilters = () => wrapper.findComponent(CommitsFilters); + const findMilestonesFilters = () => wrapper.findComponent(MilestonesFilters); const findScopeLegacyNavigation = () => wrapper.findComponent(ScopeLegacyNavigation); const findSmallScreenDrawerNavigation = () => wrapper.findComponent(SmallScreenDrawerNavigation); const findScopeSidebarNavigation = () => wrapper.findComponent(ScopeSidebarNavigation); @@ -83,10 +86,12 @@ describe('GlobalSearchSidebar', () => { ${'blobs'} | ${findBlobsFilters} | ${SEARCH_TYPE_BASIC} | ${false} ${'blobs'} | ${findBlobsFilters} | ${SEARCH_TYPE_ADVANCED} | ${true} ${'blobs'} | ${findBlobsFilters} | ${SEARCH_TYPE_ZOEKT} | ${false} - ${'notes'} | ${findNotesFilters} | ${SEARCH_TYPE_BASIC} | ${false} + ${'notes'} | ${findNotesFilters} | ${SEARCH_TYPE_BASIC} | ${true} ${'notes'} | ${findNotesFilters} | ${SEARCH_TYPE_ADVANCED} | ${true} - ${'commits'} | ${findCommitsFilters} | ${SEARCH_TYPE_BASIC} | ${false} + ${'commits'} | ${findCommitsFilters} | ${SEARCH_TYPE_BASIC} | ${true} ${'commits'} | ${findCommitsFilters} | ${SEARCH_TYPE_ADVANCED} | ${true} + ${'milestones'} | ${findMilestonesFilters} | ${SEARCH_TYPE_BASIC} | ${true} + ${'milestones'} | ${findMilestonesFilters} | ${SEARCH_TYPE_ADVANCED} | ${true} `('with sidebar $scope scope:', ({ scope, filter, searchType, isShown }) => { beforeEach(() => { getterSpies.currentScope = jest.fn(() => scope); diff --git a/spec/frontend/search/sidebar/components/issues_filters_spec.js b/spec/frontend/search/sidebar/components/issues_filters_spec.js index 39d10cbb8b4..c3b3a93e362 100644 --- a/spec/frontend/search/sidebar/components/issues_filters_spec.js +++ b/spec/frontend/search/sidebar/components/issues_filters_spec.js @@ -111,11 +111,11 @@ describe('GlobalSearch IssuesFilters', () => { }); it("doesn't render ArchivedFilter", () => { - expect(findArchivedFilter().exists()).toBe(false); + expect(findArchivedFilter().exists()).toBe(true); }); it('renders 1 divider', () => { - expect(findDividers()).toHaveLength(1); + expect(findDividers()).toHaveLength(2); }); }); diff --git a/spec/frontend/search/sidebar/components/merge_requests_filters_spec.js b/spec/frontend/search/sidebar/components/merge_requests_filters_spec.js index b50f348be69..278249c2660 100644 --- a/spec/frontend/search/sidebar/components/merge_requests_filters_spec.js +++ b/spec/frontend/search/sidebar/components/merge_requests_filters_spec.js @@ -79,12 +79,12 @@ describe('GlobalSearch MergeRequestsFilters', () => { expect(findStatusFilter().exists()).toBe(true); }); - it("doesn't render ArchivedFilter", () => { - expect(findArchivedFilter().exists()).toBe(false); + it('renders render ArchivedFilter', () => { + expect(findArchivedFilter().exists()).toBe(true); }); it('renders 1 divider', () => { - expect(findDividers()).toHaveLength(0); + expect(findDividers()).toHaveLength(1); }); }); diff --git a/spec/frontend/search/sidebar/components/milestones_filters_spec.js b/spec/frontend/search/sidebar/components/milestones_filters_spec.js new file mode 100644 index 00000000000..e7fcfb030f4 --- /dev/null +++ b/spec/frontend/search/sidebar/components/milestones_filters_spec.js @@ -0,0 +1,28 @@ +import { shallowMount } from '@vue/test-utils'; +import MilestonesFilters from '~/search/sidebar/components/milestones_filters.vue'; +import ArchivedFilter from '~/search/sidebar/components/archived_filter/index.vue'; +import FiltersTemplate from '~/search/sidebar/components/filters_template.vue'; + +describe('GlobalSearch MilestonesFilters', () => { + let wrapper; + + const findArchivedFilter = () => wrapper.findComponent(ArchivedFilter); + const findFiltersTemplate = () => wrapper.findComponent(FiltersTemplate); + + const createComponent = () => { + wrapper = shallowMount(MilestonesFilters); + }; + + describe('Renders correctly', () => { + beforeEach(() => { + createComponent(); + }); + it('renders ArchivedFilter', () => { + expect(findArchivedFilter().exists()).toBe(true); + }); + + it('renders FiltersTemplate', () => { + expect(findFiltersTemplate().exists()).toBe(true); + }); + }); +}); diff --git a/spec/presenters/issue_presenter_spec.rb b/spec/presenters/issue_presenter_spec.rb index 99ab8582f77..07a9f8015e9 100644 --- a/spec/presenters/issue_presenter_spec.rb +++ b/spec/presenters/issue_presenter_spec.rb @@ -37,7 +37,7 @@ RSpec.describe IssuePresenter do it 'returns a work item url using iid for the task' do expect(presenter.web_url).to eq( - project_work_items_url(project, work_items_path: presented_issue.iid) + project_work_item_url(project, presented_issue.iid) ) end end @@ -67,7 +67,7 @@ RSpec.describe IssuePresenter do it 'returns a work item path using iid for the task' do expect(presenter.issue_path).to eq( - project_work_items_path(project, work_items_path: presented_issue.iid) + project_work_item_path(project, presented_issue.iid) ) end end diff --git a/spec/requests/projects/issue_links_controller_spec.rb b/spec/requests/projects/issue_links_controller_spec.rb index c242f762cde..ea73b733285 100644 --- a/spec/requests/projects/issue_links_controller_spec.rb +++ b/spec/requests/projects/issue_links_controller_spec.rb @@ -33,7 +33,7 @@ RSpec.describe Projects::IssueLinksController, feature_category: :team_planning expect(json_response.count).to eq(1) expect(json_response.first).to include( - 'path' => project_work_items_path(issue_b.project, issue_b.iid), + 'path' => project_work_item_path(issue_b.project, issue_b.iid), 'type' => 'TASK' ) end diff --git a/spec/requests/projects/work_items_spec.rb b/spec/requests/projects/work_items_spec.rb index ee9a0ff0a4e..5e9d340de64 100644 --- a/spec/requests/projects/work_items_spec.rb +++ b/spec/requests/projects/work_items_spec.rb @@ -40,8 +40,8 @@ RSpec.describe 'Work Items', feature_category: :team_planning do sign_in(current_user) end - it 'renders index' do - get project_work_items_url(work_item.project, work_items_path: work_item.iid) + it 'renders show' do + get project_work_item_url(work_item.project, work_item.iid) expect(response).to have_gitlab_http_status(:ok) end diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rb index f96d7864782..d4e7dc1542a 100644 --- a/spec/requests/users_controller_spec.rb +++ b/spec/requests/users_controller_spec.rb @@ -528,7 +528,7 @@ RSpec.describe UsersController, feature_category: :user_management do get user_calendar_activities_url public_user.username - expect(response.body).to include(project_work_items_path(project, work_item.iid)) + expect(response.body).to include(project_work_item_path(project, work_item.iid)) expect(response.body).to include(project_issue_path(project, issue)) end diff --git a/spec/serializers/issue_board_entity_spec.rb b/spec/serializers/issue_board_entity_spec.rb index 6042dea249f..04c283ddc2c 100644 --- a/spec/serializers/issue_board_entity_spec.rb +++ b/spec/serializers/issue_board_entity_spec.rb @@ -62,7 +62,7 @@ RSpec.describe IssueBoardEntity do let(:resource) { create(:issue, :task, project: project) } it 'has a work item path with iid' do - expect(subject[:real_path]).to eq(project_work_items_path(project, resource.iid)) + expect(subject[:real_path]).to eq(project_work_item_path(project, resource.iid)) end end end diff --git a/spec/serializers/issue_entity_spec.rb b/spec/serializers/issue_entity_spec.rb index 38c81257a7d..a8fd96a03bb 100644 --- a/spec/serializers/issue_entity_spec.rb +++ b/spec/serializers/issue_entity_spec.rb @@ -19,7 +19,7 @@ RSpec.describe IssueEntity do # This was already a path and not a url when the work items change was introduced it 'has a work item path with iid' do - expect(subject[:web_url]).to eq(project_work_items_path(project, resource.iid)) + expect(subject[:web_url]).to eq(project_work_item_path(project, resource.iid)) end end end diff --git a/spec/serializers/linked_project_issue_entity_spec.rb b/spec/serializers/linked_project_issue_entity_spec.rb index 2f7fb912115..070ddda2a8b 100644 --- a/spec/serializers/linked_project_issue_entity_spec.rb +++ b/spec/serializers/linked_project_issue_entity_spec.rb @@ -49,7 +49,7 @@ RSpec.describe LinkedProjectIssueEntity do it 'returns a work items path using iid' do expect(serialized_entity).to include( - path: project_work_items_path(related_issue.project, related_issue.iid) + path: project_work_item_path(related_issue.project, related_issue.iid) ) end end |