adapt specs to altered non writable message

pull/7893/head
ulferts 5 years ago
parent 0e57d72262
commit 51e7f1f048
No known key found for this signature in database
GPG Key ID: A205708DE1284017
  1. 13
      spec/models/mail_handler_spec.rb
  2. 2
      spec/requests/api/v3/relations/relations_api_spec.rb
  3. 4
      spec/requests/api/v3/support/response_examples.rb
  4. 4
      spec/requests/api/v3/work_package_resource_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

@ -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

@ -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|

@ -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

Loading…
Cancel
Save