Skip to content

Commit

Permalink
Merge pull request #108 from RIPAGlobal/feature/v1-sync-main
Browse files Browse the repository at this point in the history
Reduce diff between 'v1' and 'main'
  • Loading branch information
pond committed Mar 13, 2024
2 parents 604cf36 + 70e545a commit 1d18cf8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/models/scimitar/resources/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def constantize_complex_types(hash)

if scim_attribute && scim_attribute.complexType
if scim_attribute.multiValued
self.send("#{attr_name}=", attr_value.map {|attr_for_each_item| complex_type_from_hash(scim_attribute, attr_for_each_item)})
self.send("#{attr_name}=", attr_value&.map {|attr_for_each_item| complex_type_from_hash(scim_attribute, attr_for_each_item)})
else
self.send("#{attr_name}=", complex_type_from_hash(scim_attribute, attr_value))
end
Expand Down
8 changes: 8 additions & 0 deletions spec/models/scimitar/resources/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ def self.scim_attributes
end

context '#initialize' do
it 'accepts nil for non-required attributes' do
resource = CustomResourse.new(name: nil, names: nil, privateName: nil)

expect(resource.name).to be_nil
expect(resource.names).to be_nil
expect(resource.privateName).to be_nil
end

shared_examples 'an initializer' do | force_upper_case: |
it 'which builds the nested type' do
attributes = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@
expect(response.headers['Content-Type']).to eql('application/scim+json; charset=utf-8')

result = JSON.parse(response.body)

expect(result['scimType']).to eql('invalidValue')
expect(result['detail']).to include('is reserved')
end
Expand All @@ -530,7 +531,6 @@
#
expect_any_instance_of(MockUsersController).to receive(:replace).once.and_call_original
expect_any_instance_of(MockUsersController).to receive(:save! ).once.and_call_original

expect {
put "/Users/#{@u2.primary_key}", params: attributes.merge(format: :scim)
}.to_not change { MockUser.count }
Expand Down

0 comments on commit 1d18cf8

Please sign in to comment.