OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Fix specs
Oliver Günther0ed37a6e8a18
diff --git a/spec/requests/api/v3/attachments/attachment_resource_shared_examples.rb b/spec/requests/api/v3/attachments/attachment_resource_shared_examples.rbindex 0a88b8199fc..2788b911f84 100644--- a/spec/requests/api/v3/attachments/attachment_resource_shared_examples.rb+++ b/spec/requests/api/v3/attachments/attachment_resource_shared_examples.rb@@ -45,6 +45,7 @@ shared_examples 'it supports direct uploads' dolet(:request_parts) { { metadata: metadata.to_json, file: file } }let(:metadata) { { fileName: 'cat.png', fileSize: file.size, contentType: 'image/png' } }let(:file) { mock_uploaded_file(name: 'original-filename.txt') }+ let(:json_response) { JSON.parse last_response.body }def request!post request_path, request_parts@@ -57,8 +58,12 @@ shared_examples 'it supports direct uploads' dorequest!end- it 'should respond with HTTP Not Found' do- expect(subject.status).to eq(404)+ it 'should respond with validation error' do+ expect(subject.status).to eq(422)+ end++ it_behaves_like 'constraint violation' do+ let(:message) { "is not available due to a system configuration" }endend@@ -270,7 +275,9 @@ shared_examples 'an APIv3 attachment resource', type: :request, content_type: :j# however as long as we depend on correctly named sections this test should do just finelet(:request_parts) { { metadata: metadata.to_json, wrongFileSection: file } }- it_behaves_like 'invalid request body', I18n.t('api_v3.errors.multipart_body_error')+ it_behaves_like 'constraint violation' do+ let(:message) { "Content type #{I18n.t('activerecord.errors.messages.blank')}" }+ endendcontext 'metadata section is no valid JSON' do@@ -546,7 +553,11 @@ shared_examples 'an APIv3 attachment resource', type: :request, content_type: :jcontext 'metadata section is missing' dolet(:request_parts) { { file: file } }- it_behaves_like 'invalid request body', I18n.t('api_v3.errors.multipart_body_error')+ it_behaves_like 'constraint violation' do+ # File here is the localized name for fileName property+ # which is derived from the missing metadata+ let(:message) { "File #{I18n.t('activerecord.errors.messages.blank')}" }+ endendcontext 'file section is missing' do@@ -554,7 +565,9 @@ shared_examples 'an APIv3 attachment resource', type: :request, content_type: :j# however as long as we depend on correctly named sections this test should do just finelet(:request_parts) { { metadata: metadata.to_json, wrongFileSection: file } }- it_behaves_like 'invalid request body', I18n.t('api_v3.errors.multipart_body_error')+ it_behaves_like 'constraint violation' do+ let(:message) { "Content type #{I18n.t('activerecord.errors.messages.blank')}" }+ endendcontext 'metadata section is no valid JSON' do@@ -567,7 +580,7 @@ shared_examples 'an APIv3 attachment resource', type: :request, content_type: :jlet(:metadata) { Hash.new }it_behaves_like 'constraint violation' do- let(:message) { "fileName #{I18n.t('activerecord.errors.messages.blank')}" }+ let(:message) { "File #{I18n.t('activerecord.errors.messages.blank')}" }endend