Skip to content

Commit

Permalink
Add test for changing status
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverguenther committed Mar 15, 2021
1 parent da33f4f commit fd99aa3
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions spec/requests/api/v3/user/update_form_resource_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,38 @@
end
end

describe 'with a non-writable status' do
let(:payload) do
{
"status": 'locked'
}
end

it 'returns an invalid form', :aggregate_failures do
expect(response.status).to eq(200)
expect(response.body).to be_json_eql('Form'.to_json).at_path('_type')

expect(body)
.to be_json_eql('locked'.to_json)
.at_path('_embedded/payload/status')

expect(subject.body)
.to have_json_size(1)
.at_path('_embedded/validationErrors')

expect(subject.body)
.to have_json_path('_embedded/validationErrors/status')

expect(body)
.to be_json_eql('urn:openproject-org:api:v3:errors:PropertyIsReadOnly'.to_json)
.at_path('_embedded/validationErrors/status/errorIdentifier')

# Does not change the user's status
user.reload
expect(user.status).to eq 'active'
end
end

describe 'with an empty firstname' do
let(:payload) do
{
Expand Down

0 comments on commit fd99aa3

Please sign in to comment.