Test error response for invalid children

pull/2315/head
Hagen Schink 10 years ago
parent 4a5c5cc87b
commit 8180b6682e
  1. 22
      spec/requests/api/v3/work_package_resource_spec.rb

@ -642,6 +642,28 @@ h4. things we like
it_behaves_like 'update conflict'
end
context 'invalid work package children' do
let(:params) { valid_params.merge(lockVersion: work_package.reload.lock_version) }
let!(:child_1) { FactoryGirl.create(:work_package, id: 98) }
let!(:child_2) { FactoryGirl.create(:work_package, id: 99) }
before do
[child_1, child_2].each do |c|
c.parent = work_package
c.save!(validate: false)
end
end
include_context 'patch request'
it_behaves_like 'multiple errors', 422, 'Multiple fields violated their constraints.'
it_behaves_like 'multiple errors of the same type', 2, 'PropertyConstraintViolation'
it_behaves_like 'multiple errors of the same type with messages',
[98, 99].map { |id| "##{id} cannot be in another project." }
end
end
end
end

Loading…
Cancel
Save