|
|
@ -448,9 +448,13 @@ h4. things we like |
|
|
|
context 'invalid status' do |
|
|
|
context 'invalid status' do |
|
|
|
include_context 'patch request' |
|
|
|
include_context 'patch request' |
|
|
|
|
|
|
|
|
|
|
|
it_behaves_like 'constraint violation', |
|
|
|
it_behaves_like 'constraint violation' do |
|
|
|
'Status ' + I18n.t('activerecord.errors.models.' \ |
|
|
|
let(:message) { |
|
|
|
|
|
|
|
'Status ' + I18n.t('activerecord.errors.models.' \ |
|
|
|
'work_package.attributes.status_id.status_transition_invalid') |
|
|
|
'work_package.attributes.status_id.status_transition_invalid') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context 'wrong resource' do |
|
|
|
context 'wrong resource' do |
|
|
@ -458,11 +462,14 @@ h4. things we like |
|
|
|
|
|
|
|
|
|
|
|
include_context 'patch request' |
|
|
|
include_context 'patch request' |
|
|
|
|
|
|
|
|
|
|
|
it_behaves_like 'constraint violation', |
|
|
|
it_behaves_like 'constraint violation' do |
|
|
|
I18n.t('api_v3.errors.invalid_resource', |
|
|
|
let(:message) { |
|
|
|
property: 'Status', |
|
|
|
I18n.t('api_v3.errors.invalid_resource', |
|
|
|
expected: 'Status', |
|
|
|
property: 'Status', |
|
|
|
actual: 'User') |
|
|
|
expected: 'Status', |
|
|
|
|
|
|
|
actual: 'User') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
@ -553,20 +560,25 @@ h4. things we like |
|
|
|
context 'user doesn\'t exist' do |
|
|
|
context 'user doesn\'t exist' do |
|
|
|
let(:user_href) { '/api/v3/users/909090' } |
|
|
|
let(:user_href) { '/api/v3/users/909090' } |
|
|
|
|
|
|
|
|
|
|
|
it_behaves_like 'constraint violation', |
|
|
|
it_behaves_like 'constraint violation' do |
|
|
|
I18n.t('api_v3.errors.validation.' \ |
|
|
|
let(:message) { |
|
|
|
|
|
|
|
I18n.t('api_v3.errors.validation.' \ |
|
|
|
'invalid_user_assigned_to_work_package', |
|
|
|
'invalid_user_assigned_to_work_package', |
|
|
|
property: property.capitalize) |
|
|
|
property: property.capitalize) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context 'user is not visible' do |
|
|
|
context 'user is not visible' do |
|
|
|
let(:invalid_user) { FactoryGirl.create(:user) } |
|
|
|
let(:invalid_user) { FactoryGirl.create(:user) } |
|
|
|
let(:user_href) { "/api/v3/users/#{invalid_user.id}" } |
|
|
|
let(:user_href) { "/api/v3/users/#{invalid_user.id}" } |
|
|
|
|
|
|
|
|
|
|
|
it_behaves_like 'constraint violation', |
|
|
|
it_behaves_like 'constraint violation' do |
|
|
|
I18n.t('api_v3.errors.validation.' \ |
|
|
|
let(:message) { |
|
|
|
'invalid_user_assigned_to_work_package', |
|
|
|
I18n.t('api_v3.errors.validation.invalid_user_assigned_to_work_package', |
|
|
|
property: property.capitalize) |
|
|
|
property: property.capitalize) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context 'wrong resource' do |
|
|
|
context 'wrong resource' do |
|
|
@ -574,11 +586,14 @@ h4. things we like |
|
|
|
|
|
|
|
|
|
|
|
include_context 'patch request' |
|
|
|
include_context 'patch request' |
|
|
|
|
|
|
|
|
|
|
|
it_behaves_like 'constraint violation', |
|
|
|
it_behaves_like 'constraint violation' do |
|
|
|
I18n.t('api_v3.errors.invalid_resource', |
|
|
|
let(:message) { |
|
|
|
property: "#{property.capitalize}", |
|
|
|
I18n.t('api_v3.errors.invalid_resource', |
|
|
|
expected: 'User', |
|
|
|
property: "#{property.capitalize}", |
|
|
|
actual: 'Status') |
|
|
|
expected: 'User', |
|
|
|
|
|
|
|
actual: 'Status') |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context 'group assignement disabled' do |
|
|
|
context 'group assignement disabled' do |
|
|
@ -587,10 +602,12 @@ h4. things we like |
|
|
|
include_context 'setup group membership', false |
|
|
|
include_context 'setup group membership', false |
|
|
|
include_context 'patch request' |
|
|
|
include_context 'patch request' |
|
|
|
|
|
|
|
|
|
|
|
it_behaves_like 'constraint violation', |
|
|
|
it_behaves_like 'constraint violation' do |
|
|
|
I18n.t('api_v3.errors.validation.' \ |
|
|
|
let(:message) { |
|
|
|
'invalid_user_assigned_to_work_package', |
|
|
|
I18n.t('api_v3.errors.validation.invalid_user_assigned_to_work_package', |
|
|
|
property: "#{property.capitalize}") |
|
|
|
property: "#{property.capitalize}") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
@ -741,7 +758,9 @@ h4. things we like |
|
|
|
|
|
|
|
|
|
|
|
include_context 'patch request' |
|
|
|
include_context 'patch request' |
|
|
|
|
|
|
|
|
|
|
|
it_behaves_like 'constraint violation', "Subject can't be blank" |
|
|
|
it_behaves_like 'constraint violation' do |
|
|
|
|
|
|
|
let(:message) { "Subject can't be blank" } |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context 'multiple invalid attributes' do |
|
|
|
context 'multiple invalid attributes' do |
|
|
|