Skip to content

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

adapt specs to altered non writable message

ulferts51e7f1f0483c
diff --git a/spec/models/mail_handler_spec.rb b/spec/models/mail_handler_spec.rb
index 74724e2399b..9855bef4f44 100644
--- a/spec/models/mail_handler_spec.rb
+++ b/spec/models/mail_handler_spec.rb
@@ -276,18 +276,19 @@ describe MailHandler, type: :model do
end
it 'rejects if unknown_user=accept and permission check is present' do
-
expected =
'MailHandler: work_package could not be created by Anonymous due to ' \
- '#["may not be accessed.", "Type is not writable.", "Project is not writable.", ' \
- '"Subject is not writable.", "Description is not writable."]'
+ '#["may not be accessed.", "Type was attempted to be written but is not writable.", ' \
+ '"Project was attempted to be written but is not writable.", ' \
+ '"Subject was attempted to be written but is not writable.", ' \
+ '"Description was attempted to be written but is not writable."]'
expect(Rails.logger)
- .to(receive(:error))
+ .to receive(:error)
.with(expected)
result = submit_email 'ticket_by_unknown_user.eml',
- issue: {project: project.identifier},
+ issue: { project: project.identifier },
unknown_user: 'accept'
expect(result).to eq false
@@ -295,7 +296,7 @@ describe MailHandler, type: :model do
it 'accepts if unknown_user=accept and no_permission_check' do
work_package = submit_email 'ticket_by_unknown_user.eml',
- issue: {project: project.identifier},
+ issue: { project: project.identifier },
unknown_user: 'accept',
no_permission_check: 1
diff --git a/spec/requests/api/v3/relations/relations_api_spec.rb b/spec/requests/api/v3/relations/relations_api_spec.rb
index b572c5575b4..6e191ce9962 100644
--- a/spec/requests/api/v3/relations/relations_api_spec.rb
+++ b/spec/requests/api/v3/relations/relations_api_spec.rb
@@ -302,7 +302,7 @@ describe 'API v3 Relation resource', type: :request, content_type: :json do
it "should let the user know the attribute is read-only" do
msg = JSON.parse(last_response.body)["message"]
- expect(msg).to include 'read-only'
+ expect(msg).to include "Work package an existing relation's `from` link is immutable"
end
end
end
diff --git a/spec/requests/api/v3/support/response_examples.rb b/spec/requests/api/v3/support/response_examples.rb
index cda20d2cce2..d01b13c1f3b 100644
--- a/spec/requests/api/v3/support/response_examples.rb
+++ b/spec/requests/api/v3/support/response_examples.rb
@@ -150,7 +150,7 @@ shared_examples_for 'format error' do |message|
message
end
-shared_examples_for 'read-only violation' do |attribute, model|
+shared_examples_for 'read-only violation' do |attribute, model, attribute_message = nil|
describe 'details' do
subject { JSON.parse(last_response.body)['_embedded']['details'] }
@@ -160,7 +160,7 @@ shared_examples_for 'read-only violation' do |attribute, model|
it_behaves_like 'error response',
422,
'PropertyIsReadOnly',
- "#{model.human_attribute_name(attribute)} #{I18n.t('activerecord.errors.messages.error_readonly')}"
+ "#{attribute_message || model.human_attribute_name(attribute)} #{I18n.t('activerecord.errors.messages.error_readonly')}"
end
shared_examples_for 'multiple errors' do |code, _message|
diff --git a/spec/requests/api/v3/work_package_resource_spec.rb b/spec/requests/api/v3/work_package_resource_spec.rb
index c58eef42c16..69a5b4303b9 100644
--- a/spec/requests/api/v3/work_package_resource_spec.rb
+++ b/spec/requests/api/v3/work_package_resource_spec.rb
@@ -856,13 +856,13 @@ describe 'API v3 Work package resource',
context 'created_at' do
let(:params) { valid_params.merge(createdAt: tomorrow) }
- it_behaves_like 'read-only violation', 'createdAt', WorkPackage
+ it_behaves_like 'read-only violation', 'createdAt', WorkPackage, 'Created on'
end
context 'updated_at' do
let(:params) { valid_params.merge(updatedAt: tomorrow) }
- it_behaves_like 'read-only violation', 'updatedAt', WorkPackage
+ it_behaves_like 'read-only violation', 'updatedAt', WorkPackage, 'Updated on'
end
end
end