Commit 9d037f7

mokha <mokha@cisco.com>
2019-01-08 17:44:38
add schema extensions to resource types tag: v0.2.3
1 parent f55b629
lib/scim/kit/v2/templates/resource_type.json.jbuilder
@@ -10,4 +10,4 @@ json.name name
 json.description description
 json.endpoint endpoint
 json.schema schema
-json.schema_extensions []
+json.schema_extensions schema_extensions
lib/scim/kit/v2/resource_type.rb
@@ -12,11 +12,13 @@ module Scim
         attr_accessor :description
         attr_accessor :endpoint
         attr_accessor :schema
+        attr_accessor :schema_extensions
         attr_reader :meta
 
         def initialize(location:)
           @meta = Meta.new('ResourceType', location)
           @meta.version = @meta.created = @meta.last_modified = nil
+          @schema_extensions = []
         end
 
         def self.build(*args)
lib/scim/kit/version.rb
@@ -2,6 +2,6 @@
 
 module Scim
   module Kit
-    VERSION = '0.2.2'
+    VERSION = '0.2.3'
   end
 end
spec/scim/kit/v2/attribute_spec.rb
@@ -193,8 +193,8 @@ RSpec.describe Scim::Kit::V2::Attribute do
     specify { expect(subject._value).to match_array([{ value: email, primary: true }, { value: other_email, primary: false }]) }
     specify { expect(subject.as_json[:emails]).to match_array([{ value: email, primary: true }, { value: other_email, primary: false }]) }
 
-    context "when the hash is invalid" do
-      xspecify { expect { subject._value = [ { blah: 'blah' } ] }.to raise_error(ArgumentError) }
+    context 'when the hash is invalid' do
+      xspecify { expect { subject._value = [{ blah: 'blah' }] }.to raise_error(ArgumentError) }
     end
   end
 end
spec/scim/kit/v2/resource_type_spec.rb
@@ -22,4 +22,12 @@ RSpec.describe Scim::Kit::V2::ResourceType do
   specify { expect(subject.to_h[:name]).to eql(subject.name) }
   specify { expect(subject.to_h[:schema]).to eql(subject.schema) }
   specify { expect(subject.to_h[:schemaExtensions]).to match_array([]) }
+
+  context 'with a schema extension' do
+    let(:extension) { 'urn:ietf:params:scim:schemas:extension:enterprise:2.0:User' }
+
+    before { subject.schema_extensions.push(extension) }
+
+    specify { expect(subject.to_h[:schemaExtensions]).to match_array([extension]) }
+  end
 end