diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-30 21:08:01 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-30 21:08:01 +0000 |
commit | 95ad46159e4cd93f2b31838199180d824e041994 (patch) | |
tree | d41880d3b6a0093463694978590e590efb08caef /spec | |
parent | 2c72daf2f1744f2b8c8c6674c266907e9ef55558 (diff) | |
download | gitlab-ce-95ad46159e4cd93f2b31838199180d824e041994.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
14 files changed, 85 insertions, 32 deletions
diff --git a/spec/features/issues/user_filters_issues_spec.rb b/spec/features/issues/user_filters_issues_spec.rb index 714bc972025..9ce47e68926 100644 --- a/spec/features/issues/user_filters_issues_spec.rb +++ b/spec/features/issues/user_filters_issues_spec.rb @@ -24,7 +24,7 @@ describe 'User filters issues' do let(:issue) { @issue } it 'allows filtering by issues with no specified assignee' do - visit project_issues_path(project, assignee_id: IssuableFinder::FILTER_NONE) + visit project_issues_path(project, assignee_id: IssuableFinder::Params::FILTER_NONE) expect(page).to have_content 'foobar' expect(page).not_to have_content 'barbaz' diff --git a/spec/features/merge_requests/user_lists_merge_requests_spec.rb b/spec/features/merge_requests/user_lists_merge_requests_spec.rb index f145bdd044b..ee0d7307e6c 100644 --- a/spec/features/merge_requests/user_lists_merge_requests_spec.rb +++ b/spec/features/merge_requests/user_lists_merge_requests_spec.rb @@ -35,7 +35,7 @@ describe 'Merge requests > User lists merge requests' do end it 'filters on no assignee' do - visit_merge_requests(project, assignee_id: IssuableFinder::FILTER_NONE) + visit_merge_requests(project, assignee_id: IssuableFinder::Params::FILTER_NONE) expect(current_path).to eq(project_merge_requests_path(project)) expect(page).to have_content 'merge-test' diff --git a/spec/finders/issues_finder_spec.rb b/spec/finders/issues_finder_spec.rb index ff52e1b9d5f..b6bedab724a 100644 --- a/spec/finders/issues_finder_spec.rb +++ b/spec/finders/issues_finder_spec.rb @@ -429,7 +429,7 @@ describe IssuesFinder do end context 'filtering by no label' do - let(:params) { { label_name: described_class::FILTER_NONE } } + let(:params) { { label_name: described_class::Params::FILTER_NONE } } it 'returns issues with no labels' do expect(issues).to contain_exactly(issue1, issue4) @@ -437,7 +437,7 @@ describe IssuesFinder do end context 'filtering by any label' do - let(:params) { { label_name: described_class::FILTER_ANY } } + let(:params) { { label_name: described_class::Params::FILTER_ANY } } it 'returns issues that have one or more label' do create_list(:label_link, 2, label: create(:label, project: project2), target: issue3) diff --git a/spec/frontend/vue_shared/components/__snapshots__/file_row_header_spec.js.snap b/spec/frontend/vue_shared/components/__snapshots__/file_row_header_spec.js.snap index 26eae2d5e61..5ab159a5a84 100644 --- a/spec/frontend/vue_shared/components/__snapshots__/file_row_header_spec.js.snap +++ b/spec/frontend/vue_shared/components/__snapshots__/file_row_header_spec.js.snap @@ -3,6 +3,7 @@ exports[`File row header component adds multiple ellipsises after 40 characters 1`] = ` <div class="file-row-header bg-white sticky-top p-2 js-file-row-header" + title="app/assets/javascripts/merge_requests/widget/diffs/notes" > <span class="bold" @@ -15,6 +16,7 @@ exports[`File row header component adds multiple ellipsises after 40 characters exports[`File row header component renders file path 1`] = ` <div class="file-row-header bg-white sticky-top p-2 js-file-row-header" + title="app/assets" > <span class="bold" @@ -27,6 +29,7 @@ exports[`File row header component renders file path 1`] = ` exports[`File row header component trucates path after 40 characters 1`] = ` <div class="file-row-header bg-white sticky-top p-2 js-file-row-header" + title="app/assets/javascripts/merge_requests" > <span class="bold" diff --git a/spec/frontend/vue_shared/components/file_row_spec.js b/spec/frontend/vue_shared/components/file_row_spec.js index b3ced84ddb5..732491378fa 100644 --- a/spec/frontend/vue_shared/components/file_row_spec.js +++ b/spec/frontend/vue_shared/components/file_row_spec.js @@ -33,6 +33,35 @@ describe('File row component', () => { expect(name.text().trim()).toEqual(fileName); }); + it('renders the full path as title', () => { + const filePath = 'path/to/file/with a very long folder name/'; + const fileName = 'foo.txt'; + + createComponent({ + file: { + name: fileName, + isHeader: false, + tree: [ + { + parentPath: filePath, + }, + ], + }, + level: 1, + }); + + expect(wrapper.element.title.trim()).toEqual('path/to/file/with a very long folder name/'); + }); + + it('does not render a title attribute if no tree present', () => { + createComponent({ + file: file('f1.txt'), + level: 0, + }); + + expect(wrapper.element.title.trim()).toEqual(''); + }); + it('emits toggleTreeOpen on click', () => { const fileName = 't3'; createComponent({ diff --git a/spec/graphql/resolvers/issues_resolver_spec.rb b/spec/graphql/resolvers/issues_resolver_spec.rb index 4467c228e96..53e0a9e3724 100644 --- a/spec/graphql/resolvers/issues_resolver_spec.rb +++ b/spec/graphql/resolvers/issues_resolver_spec.rb @@ -51,11 +51,11 @@ describe Resolvers::IssuesResolver do end it 'filters by any assignee' do - expect(resolve_issues(assignee_id: IssuableFinder::FILTER_ANY)).to contain_exactly(issue2) + expect(resolve_issues(assignee_id: IssuableFinder::Params::FILTER_ANY)).to contain_exactly(issue2) end it 'filters by no assignee' do - expect(resolve_issues(assignee_id: IssuableFinder::FILTER_NONE)).to contain_exactly(issue1) + expect(resolve_issues(assignee_id: IssuableFinder::Params::FILTER_NONE)).to contain_exactly(issue1) end it 'filters by labels' do diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index b706cad612a..183e6e8d044 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -1919,6 +1919,15 @@ describe Gitlab::Git::Repository, :seed_helper do end end + describe '#replicas', :praefect do + it 'gets the replica checksum through praefect' do + resp = repository.replicas + + expect(resp.replicas).to be_empty + expect(resp.primary.checksum).to eq(repository.checksum) + end + end + describe '#clean_stale_repository_files' do let(:worktree_id) { 'rebase-1' } let(:gitlab_worktree_path) { File.join(repository_path, 'gitlab-worktree', worktree_id) } diff --git a/spec/lib/gitlab/gitaly_client/praefect_info_service_spec.rb b/spec/lib/gitlab/gitaly_client/praefect_info_service_spec.rb new file mode 100644 index 00000000000..9b5c751e0ec --- /dev/null +++ b/spec/lib/gitlab/gitaly_client/praefect_info_service_spec.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Gitlab::GitalyClient::PraefectInfoService do + let(:project) { create(:project, :repository) } + let(:repository) { project.repository } + let(:gitaly_repository) { repository.gitaly_repository } + let(:client) { described_class.new(repository) } + + describe '#repository_replicas', :praefect do + it 'sends an RPC request' do + request = Gitaly::RepositoryReplicasRequest.new(repository: gitaly_repository) + + expect_any_instance_of(Gitaly::PraefectInfoService::Stub).to receive(:repository_replicas).with(request, kind_of(Hash)) + + client.replicas + end + end +end diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index f37e39a9ee9..137795dcbc3 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -3223,14 +3223,6 @@ describe MergeRequest do subject.mark_as_unmergeable end - it 'notifies conflict, with enabled async mergability check' do - expect(notification_service).to receive(:merge_request_unmergeable).with(subject).once - expect(todo_service).to receive(:merge_request_became_unmergeable).with(subject).once - - subject.mark_as_checking - subject.mark_as_unmergeable - end - it 'does not notify whenever merge request is newly unmergeable due to other reasons' do allow(subject.project.repository).to receive(:can_be_merged?).and_return(true) diff --git a/spec/requests/api/issues/get_group_issues_spec.rb b/spec/requests/api/issues/get_group_issues_spec.rb index 0a95f9114a5..3ec5f380390 100644 --- a/spec/requests/api/issues/get_group_issues_spec.rb +++ b/spec/requests/api/issues/get_group_issues_spec.rb @@ -475,27 +475,27 @@ describe API::Issues do end it 'returns an array of group issues with any label' do - get api(base_url, user), params: { labels: IssuesFinder::FILTER_ANY } + get api(base_url, user), params: { labels: IssuableFinder::Params::FILTER_ANY } expect_paginated_array_response(group_issue.id) expect(json_response.first['id']).to eq(group_issue.id) end it 'returns an array of group issues with any label with labels param as array' do - get api(base_url, user), params: { labels: [IssuesFinder::FILTER_ANY] } + get api(base_url, user), params: { labels: [IssuableFinder::Params::FILTER_ANY] } expect_paginated_array_response(group_issue.id) expect(json_response.first['id']).to eq(group_issue.id) end it 'returns an array of group issues with no label' do - get api(base_url, user), params: { labels: IssuesFinder::FILTER_NONE } + get api(base_url, user), params: { labels: IssuableFinder::Params::FILTER_NONE } expect_paginated_array_response([group_closed_issue.id, group_confidential_issue.id]) end it 'returns an array of group issues with no label with labels param as array' do - get api(base_url, user), params: { labels: [IssuesFinder::FILTER_NONE] } + get api(base_url, user), params: { labels: [IssuableFinder::Params::FILTER_NONE] } expect_paginated_array_response([group_closed_issue.id, group_confidential_issue.id]) end diff --git a/spec/requests/api/issues/get_project_issues_spec.rb b/spec/requests/api/issues/get_project_issues_spec.rb index 539841fe460..1e6a1d2ed20 100644 --- a/spec/requests/api/issues/get_project_issues_spec.rb +++ b/spec/requests/api/issues/get_project_issues_spec.rb @@ -350,25 +350,25 @@ describe API::Issues do end it 'returns an array of project issues with any label' do - get api("#{base_url}/issues", user), params: { labels: IssuesFinder::FILTER_ANY } + get api("#{base_url}/issues", user), params: { labels: IssuableFinder::Params::FILTER_ANY } expect_paginated_array_response(issue.id) end it 'returns an array of project issues with any label with labels param as array' do - get api("#{base_url}/issues", user), params: { labels: [IssuesFinder::FILTER_ANY] } + get api("#{base_url}/issues", user), params: { labels: [IssuableFinder::Params::FILTER_ANY] } expect_paginated_array_response(issue.id) end it 'returns an array of project issues with no label' do - get api("#{base_url}/issues", user), params: { labels: IssuesFinder::FILTER_NONE } + get api("#{base_url}/issues", user), params: { labels: IssuableFinder::Params::FILTER_NONE } expect_paginated_array_response([confidential_issue.id, closed_issue.id]) end it 'returns an array of project issues with no label with labels param as array' do - get api("#{base_url}/issues", user), params: { labels: [IssuesFinder::FILTER_NONE] } + get api("#{base_url}/issues", user), params: { labels: [IssuableFinder::Params::FILTER_NONE] } expect_paginated_array_response([confidential_issue.id, closed_issue.id]) end diff --git a/spec/requests/api/issues/issues_spec.rb b/spec/requests/api/issues/issues_spec.rb index 6fea6201a65..d9496d6646f 100644 --- a/spec/requests/api/issues/issues_spec.rb +++ b/spec/requests/api/issues/issues_spec.rb @@ -476,25 +476,25 @@ describe API::Issues do end it 'returns an array of issues with any label' do - get api('/issues', user), params: { labels: IssuesFinder::FILTER_ANY } + get api('/issues', user), params: { labels: IssuableFinder::Params::FILTER_ANY } expect_paginated_array_response(issue.id) end it 'returns an array of issues with any label with labels param as array' do - get api('/issues', user), params: { labels: [IssuesFinder::FILTER_ANY] } + get api('/issues', user), params: { labels: [IssuableFinder::Params::FILTER_ANY] } expect_paginated_array_response(issue.id) end it 'returns an array of issues with no label' do - get api('/issues', user), params: { labels: IssuesFinder::FILTER_NONE } + get api('/issues', user), params: { labels: IssuableFinder::Params::FILTER_NONE } expect_paginated_array_response(closed_issue.id) end it 'returns an array of issues with no label with labels param as array' do - get api('/issues', user), params: { labels: [IssuesFinder::FILTER_NONE] } + get api('/issues', user), params: { labels: [IssuableFinder::Params::FILTER_NONE] } expect_paginated_array_response(closed_issue.id) end diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index a3fd365771b..ab7149a6bb3 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -281,14 +281,14 @@ describe API::MergeRequests do end it 'returns an array of merge requests with any label when filtering by any label' do - get api(endpoint_path, user), params: { labels: IssuesFinder::FILTER_ANY } + get api(endpoint_path, user), params: { labels: IssuableFinder::Params::FILTER_ANY } expect_paginated_array_response([merge_request.id]) expect(json_response.first['id']).to eq(merge_request.id) end it 'returns an array of merge requests without a label when filtering by no label' do - get api(endpoint_path, user), params: { labels: IssuesFinder::FILTER_NONE } + get api(endpoint_path, user), params: { labels: IssuableFinder::Params::FILTER_NONE } expect_response_contain_exactly( merge_request_merged.id, merge_request_locked.id, merge_request_closed.id diff --git a/spec/services/issuable/bulk_update_service_spec.rb b/spec/services/issuable/bulk_update_service_spec.rb index 2b0b486308a..f82a3cee1d9 100644 --- a/spec/services/issuable/bulk_update_service_spec.rb +++ b/spec/services/issuable/bulk_update_service_spec.rb @@ -245,9 +245,9 @@ describe Issuable::BulkUpdateService do end end - context "when the new assignee ID is #{IssuableFinder::NONE}" do + context "when the new assignee ID is #{IssuableFinder::Params::NONE}" do it 'unassigns the issues' do - expect { bulk_update(merge_request, assignee_ids: [IssuableFinder::NONE]) } + expect { bulk_update(merge_request, assignee_ids: [IssuableFinder::Params::NONE]) } .to change { merge_request.reload.assignee_ids }.to([]) end end @@ -282,9 +282,9 @@ describe Issuable::BulkUpdateService do end end - context "when the new assignee ID is #{IssuableFinder::NONE}" do + context "when the new assignee ID is #{IssuableFinder::Params::NONE}" do it "unassigns the issues" do - expect { bulk_update(issue, assignee_ids: [IssuableFinder::NONE.to_s]) } + expect { bulk_update(issue, assignee_ids: [IssuableFinder::Params::NONE.to_s]) } .to change { issue.reload.assignees.count }.from(1).to(0) end end |