Skip to content

Commit

Permalink
Fix expectation with changed attribute mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverguenther committed Mar 15, 2021
1 parent 803fedd commit a18dc13
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions lib/api/v3/users/user_representer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,7 @@ class UserRepresenter < ::API::V3::Principals::PrincipalRepresenter
setter: ->(fragment:, represented:, **) { represented.status = User.statuses[fragment.to_sym] },
exec_context: :decorator,
render_nil: true,
cache_if: -> {
binding.pry
current_user_can_manage?
}
cache_if: -> { current_user_can_manage? }

property :identity_url,
exec_context: :decorator,
Expand Down
4 changes: 2 additions & 2 deletions spec/requests/api/v3/user/create_user_common_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

expect(errors.count).to eq(5)
expect(errors.collect { |el| el['_embedded']['details']['attribute'] })
.to contain_exactly('password', 'login', 'firstname', 'lastname', 'email')
.to contain_exactly('password', 'login', 'firstName', 'lastName', 'email')

expect(last_response.body)
.to be_json_eql('urn:openproject-org:api:v3:errors:MultipleErrors'.to_json)
Expand Down Expand Up @@ -131,7 +131,7 @@
expect(errors.count).to eq 4

attributes = errors.map { |error| error.dig('_embedded', 'details', 'attribute') }
expect(attributes).to contain_exactly('login', 'firstname', 'lastname', 'email')
expect(attributes).to contain_exactly('login', 'firstName', 'lastName', 'email')
end
end
end
Expand Down

0 comments on commit a18dc13

Please sign in to comment.