diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-14 00:08:27 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-14 00:08:27 +0000 |
commit | b7d58ff8b17623f64ac7835a590e79d916e758ac (patch) | |
tree | 4f75a8f9e0e30cf8c7e944ea2c4461be396c0d5f /spec/serializers | |
parent | 0e2fc1701bd0c87cc458cbbb34c618b0e0dc5a14 (diff) | |
download | gitlab-ce-b7d58ff8b17623f64ac7835a590e79d916e758ac.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/serializers')
-rw-r--r-- | spec/serializers/issue_entity_spec.rb | 32 | ||||
-rw-r--r-- | spec/serializers/merge_request_serializer_spec.rb | 19 |
2 files changed, 50 insertions, 1 deletions
diff --git a/spec/serializers/issue_entity_spec.rb b/spec/serializers/issue_entity_spec.rb index 224ed0b402f..a1868b2631b 100644 --- a/spec/serializers/issue_entity_spec.rb +++ b/spec/serializers/issue_entity_spec.rb @@ -92,4 +92,36 @@ describe IssueEntity do end end end + + context 'when issuable in active or archived project' do + before do + project.add_developer(user) + end + + context 'when project is active' do + it 'returns archived false' do + expect(subject[:is_project_archived]).to eq(false) + end + + it 'returns nil for archived project doc' do + response = described_class.new(resource, request: request).as_json + + expect(response[:archived_project_docs_path]).to be nil + end + end + + context 'when project is archived' do + before do + project.update(archived: true) + end + + it 'returns archived true' do + expect(subject[:is_project_archived]).to eq(true) + end + + it 'returns archived project doc' do + expect(subject[:archived_project_docs_path]).to eq('/help/user/project/settings/index.md#archiving-a-project') + end + end + end end diff --git a/spec/serializers/merge_request_serializer_spec.rb b/spec/serializers/merge_request_serializer_spec.rb index a99f11168c0..9297df31842 100644 --- a/spec/serializers/merge_request_serializer_spec.rb +++ b/spec/serializers/merge_request_serializer_spec.rb @@ -48,7 +48,24 @@ describe MergeRequestSerializer do let(:serializer) { 'noteable' } it 'matches noteable merge request json schema' do - expect(json_entity).to match_schema('entities/merge_request_noteable', strict: true) + expect(json_entity).to match_schema('entities/merge_request_noteable') + end + + context 'when merge_request is locked' do + let(:resource) { create(:merge_request, :locked, description: "Description") } + + it 'matches noteable merge request json schema' do + expect(json_entity).to match_schema('entities/merge_request_noteable') + end + end + + context 'when project is archived' do + let(:project) { create(:project, :archived, :repository) } + let(:resource) { create(:merge_request, source_project: project, target_project: project, description: "Description") } + + it 'matches noteable merge request json schema' do + expect(json_entity).to match_schema('entities/merge_request_noteable') + end end end |