scim_engine 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +25 -0
- data/app/controllers/scim_engine/application_controller.rb +36 -0
- data/app/controllers/scim_engine/resource_types_controller.rb +22 -0
- data/app/controllers/scim_engine/resources_controller.rb +71 -0
- data/app/controllers/scim_engine/schemas_controller.rb +16 -0
- data/app/controllers/scim_engine/service_provider_configurations_controller.rb +8 -0
- data/app/models/scim_engine/authentication_error.rb +9 -0
- data/app/models/scim_engine/authentication_scheme.rb +12 -0
- data/app/models/scim_engine/bulk.rb +5 -0
- data/app/models/scim_engine/complex_types/base.rb +37 -0
- data/app/models/scim_engine/complex_types/email.rb +14 -0
- data/app/models/scim_engine/complex_types/name.rb +9 -0
- data/app/models/scim_engine/complex_types/reference.rb +9 -0
- data/app/models/scim_engine/error_response.rb +13 -0
- data/app/models/scim_engine/errors.rb +14 -0
- data/app/models/scim_engine/filter.rb +5 -0
- data/app/models/scim_engine/meta.rb +7 -0
- data/app/models/scim_engine/not_found_error.rb +10 -0
- data/app/models/scim_engine/resource_invalid_error.rb +9 -0
- data/app/models/scim_engine/resource_type.rb +29 -0
- data/app/models/scim_engine/resources/base.rb +139 -0
- data/app/models/scim_engine/resources/group.rb +13 -0
- data/app/models/scim_engine/resources/user.rb +13 -0
- data/app/models/scim_engine/schema/attribute.rb +91 -0
- data/app/models/scim_engine/schema/base.rb +35 -0
- data/app/models/scim_engine/schema/derived_attributes.rb +24 -0
- data/app/models/scim_engine/schema/email.rb +15 -0
- data/app/models/scim_engine/schema/group.rb +27 -0
- data/app/models/scim_engine/schema/name.rb +17 -0
- data/app/models/scim_engine/schema/reference.rb +14 -0
- data/app/models/scim_engine/schema/user.rb +30 -0
- data/app/models/scim_engine/service_provider_configuration.rb +31 -0
- data/app/models/scim_engine/supportable.rb +10 -0
- data/app/views/layouts/scim_engine/application.html.erb +14 -0
- data/config/routes.rb +6 -0
- data/lib/scim_engine.rb +13 -0
- data/lib/scim_engine/engine.rb +51 -0
- data/lib/scim_engine/version.rb +3 -0
- data/lib/tasks/scim_engine_tasks.rake +4 -0
- data/spec/controllers/scim_engine/application_controller_spec.rb +104 -0
- data/spec/controllers/scim_engine/resource_types_controller_spec.rb +78 -0
- data/spec/controllers/scim_engine/resources_controller_spec.rb +132 -0
- data/spec/controllers/scim_engine/schemas_controller_spec.rb +66 -0
- data/spec/controllers/scim_engine/service_provider_configurations_controller_spec.rb +21 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +16 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +41 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/to_time_preserves_timezone.rb +10 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/log/test.log +175 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/models/scim_engine/complex_types/email_spec.rb +23 -0
- data/spec/models/scim_engine/resource_type_spec.rb +21 -0
- data/spec/models/scim_engine/resources/base_spec.rb +246 -0
- data/spec/models/scim_engine/resources/base_validation_spec.rb +61 -0
- data/spec/models/scim_engine/resources/user_spec.rb +55 -0
- data/spec/models/scim_engine/schema/attribute_spec.rb +80 -0
- data/spec/models/scim_engine/schema/base_spec.rb +19 -0
- data/spec/models/scim_engine/schema/group_spec.rb +66 -0
- data/spec/models/scim_engine/schema/user_spec.rb +140 -0
- data/spec/rails_helper.rb +57 -0
- data/spec/spec_helper.rb +99 -0
- metadata +246 -0
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
describe ScimEngine::Resources::Base do
|
4
|
+
|
5
|
+
describe '#valid?' do
|
6
|
+
MyCustomSchema = Class.new(ScimEngine::Schema::Base) do
|
7
|
+
def self.id
|
8
|
+
'custom-id'
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.scim_attributes
|
12
|
+
[
|
13
|
+
ScimEngine::Schema::Attribute.new(
|
14
|
+
name: 'userName', type: 'string', required: false
|
15
|
+
),
|
16
|
+
ScimEngine::Schema::Attribute.new(
|
17
|
+
name: 'enforce', type: 'boolean', required: true
|
18
|
+
),
|
19
|
+
ScimEngine::Schema::Attribute.new(
|
20
|
+
name: 'complexName', complexType: ScimEngine::ComplexTypes::Name, required: false
|
21
|
+
),
|
22
|
+
ScimEngine::Schema::Attribute.new(
|
23
|
+
name: 'complexNames', complexType: ScimEngine::ComplexTypes::Name, multiValued:true, required: false
|
24
|
+
)
|
25
|
+
]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
MyCustomResource = Class.new(ScimEngine::Resources::Base) do
|
30
|
+
set_schema MyCustomSchema
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'adds validation errors to the resource for simple attributes' do
|
34
|
+
resource = MyCustomResource.new(userName: 10)
|
35
|
+
expect(resource.valid?).to be(false)
|
36
|
+
expect(resource.errors.full_messages).to match_array(['Username has the wrong type. It has to be a(n) string.', 'Enforce is required'])
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'adds validation errors to the resource for the complex attribute when the value does not match the schema' do
|
40
|
+
resource = MyCustomResource.new(complexName: 10, enforce: false)
|
41
|
+
expect(resource.valid?).to be(false)
|
42
|
+
expect(resource.errors.full_messages).to match_array(['Complexname has to follow the complexType format.'])
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'adds validation errors to the resource from what the complex type schema returns' do
|
46
|
+
resource = MyCustomResource.new(complexName: { givenName: 10 }, enforce: false)
|
47
|
+
expect(resource.valid?).to be(false)
|
48
|
+
expect(resource.errors.full_messages).to match_array(["Complexname familyname is required", "Complexname givenname has the wrong type. It has to be a(n) string."])
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'adds validation errors to the resource from what the complex type schema returns when it is multi-valued' do
|
52
|
+
resource = MyCustomResource.new(complexNames: [
|
53
|
+
"Jane Austen",
|
54
|
+
{ givenName: 'Jane', familyName: true }
|
55
|
+
],
|
56
|
+
enforce: false)
|
57
|
+
expect(resource.valid?).to be(false)
|
58
|
+
expect(resource.errors.full_messages).to match_array(["Complexnames has to follow the complexType format.", "Complexnames familyname has the wrong type. It has to be a(n) string."])
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
describe ScimEngine::Resources::User do
|
4
|
+
describe '#name' do
|
5
|
+
it 'allows a setter for a valid name' do
|
6
|
+
user = described_class.new(name: ScimEngine::ComplexTypes::Name.new(
|
7
|
+
familyName: 'Smith',
|
8
|
+
givenName: 'John',
|
9
|
+
formatted: 'John Smith'
|
10
|
+
))
|
11
|
+
|
12
|
+
expect(user.name.familyName).to eql('Smith')
|
13
|
+
expect(user.name.givenName).to eql('John')
|
14
|
+
expect(user.name.formatted).to eql('John Smith')
|
15
|
+
expect(user.as_json['name']['errors']).to be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'validates that the provided name matches the name schema' do
|
19
|
+
user = described_class.new(name: ScimEngine::ComplexTypes::Email.new(
|
20
|
+
value: 'john@smoth.com',
|
21
|
+
primary: true
|
22
|
+
))
|
23
|
+
|
24
|
+
expect(user.valid?).to be(false)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '#add_errors_from_hash' do
|
29
|
+
let(:user) { described_class.new }
|
30
|
+
|
31
|
+
it 'adds the error when the value is a string' do
|
32
|
+
user.add_errors_from_hash(key: 'some error')
|
33
|
+
expect(user.errors.messages).to eql({key: ['some error']})
|
34
|
+
expect(user.errors.full_messages).to eql(['Key some error'])
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'adds the error when the value is an array' do
|
38
|
+
user.add_errors_from_hash(key: ['error1', 'error2'])
|
39
|
+
expect(user.errors.messages).to eql({key: ['error1', 'error2']})
|
40
|
+
expect(user.errors.full_messages).to eql(['Key error1', 'Key error2'])
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'adds the error with prefix when the value is a string' do
|
44
|
+
user.add_errors_from_hash({key: 'some error'}, prefix: :pre)
|
45
|
+
expect(user.errors.messages).to eql({:'pre.key' => ['some error']})
|
46
|
+
expect(user.errors.full_messages).to eql(['Pre key some error'])
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'adds the error wity prefix when the value is an array' do
|
50
|
+
user.add_errors_from_hash({key: ['error1', 'error2']}, prefix: :pre)
|
51
|
+
expect(user.errors.messages).to eql({:'pre.key' => ['error1', 'error2']})
|
52
|
+
expect(user.errors.full_messages).to eql(['Pre key error1', 'Pre key error2'])
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
describe ScimEngine::Schema::Attribute do
|
4
|
+
describe '#initialize' do
|
5
|
+
it 'sets the default properties' do
|
6
|
+
attribute = described_class.new
|
7
|
+
expect(attribute.multiValued).to be(false)
|
8
|
+
expect(attribute.required).to be(true)
|
9
|
+
expect(attribute.caseExact).to be(false)
|
10
|
+
expect(attribute.mutability).to eql('readWrite')
|
11
|
+
expect(attribute.uniqueness).to eql('none')
|
12
|
+
expect(attribute.returned).to eql('default')
|
13
|
+
end
|
14
|
+
it 'lets override the default properties' do
|
15
|
+
attribute = described_class.new(multiValued: true)
|
16
|
+
expect(attribute.multiValued).to be(true)
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'transforms complexTypes into subAttributes' do
|
20
|
+
name = described_class.new(name: 'name', complexType: ScimEngine::ComplexTypes::Name)
|
21
|
+
expect(name.type).to eql('complex')
|
22
|
+
expect(name.subAttributes).to eql(ScimEngine::Schema::Name.scim_attributes)
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
describe '#valid?' do
|
29
|
+
it 'is invalid if attribute is required but value is blank' do
|
30
|
+
attribute = described_class.new(name: 'userName', type: 'string', required: true)
|
31
|
+
expect(attribute.valid?(nil)).to be(false)
|
32
|
+
expect(attribute.errors.messages).to eql({userName: ['is required']})
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'is valid if attribute is not required and value is blank' do
|
36
|
+
attribute = described_class.new(name: 'userName', type: 'string', required: false)
|
37
|
+
expect(attribute.valid?(nil)).to be(true)
|
38
|
+
expect(attribute.errors.messages).to eql({})
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'is valid if type is string and given value is string' do
|
42
|
+
expect(described_class.new(name: 'name', type: 'string').valid?('something')).to be(true)
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'is invalid if type is string and given value is not string' do
|
46
|
+
attribute = described_class.new(name: 'userName', type: 'string')
|
47
|
+
expect(attribute.valid?(10)).to be(false)
|
48
|
+
expect(attribute.errors.messages).to eql({userName: ['has the wrong type. It has to be a(n) string.']})
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'is valid if type is boolean and given value is boolean' do
|
52
|
+
expect(described_class.new(name: 'name', type: 'boolean').valid?(false)).to be(true)
|
53
|
+
expect(described_class.new(name: 'name', type: 'boolean').valid?(true)).to be(true)
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'is valid if type is complex and the schema is same' do
|
57
|
+
expect(described_class.new(name: 'name', complexType: ScimEngine::ComplexTypes::Name).valid?(ScimEngine::ComplexTypes::Name.new(givenName: 'a', familyName: 'b'))).to be(true)
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'is valid if type is integer and given value is integer (duh)' do
|
61
|
+
expect(described_class.new(name: 'quantity', type: 'integer').valid?(123)).to be(true)
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'is not valid if type is integer and given value is not an integer' do
|
65
|
+
expect(described_class.new(name: 'quantity', type: 'integer').valid?(123.3)).to be(false)
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'is valid if type is dateTime and given value is an ISO8601 date time' do
|
69
|
+
expect(described_class.new(name: 'startDate', type: 'dateTime').valid?('2018-07-26T11:59:43-06:00')).to be(true)
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'is not valid if type is dateTime and given value is a valid date but not in ISO8601 format' do
|
73
|
+
expect(described_class.new(name: 'startDate', type: 'dateTime').valid?('2018-07-26')).to be(false)
|
74
|
+
end
|
75
|
+
it 'is not valid if type is dateTime and given value is not a valid date' do
|
76
|
+
expect(described_class.new(name: 'startDate', type: 'dateTime').valid?('gaga')).to be(false)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
describe ScimEngine::Schema::Base do
|
4
|
+
describe '#as_json' do
|
5
|
+
it 'converts the scim_attributes to attributes' do
|
6
|
+
attribute = ScimEngine::Schema::Attribute.new(name: 'nickName')
|
7
|
+
schema = described_class.new(scim_attributes: [attribute])
|
8
|
+
expect(schema.as_json['attributes']).to eql([attribute.as_json])
|
9
|
+
expect(schema.as_json['scim_attributes']).to be_nil
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '#initialize' do
|
14
|
+
it 'creates a meta' do
|
15
|
+
schema = described_class.new
|
16
|
+
expect(schema.meta.resourceType).to eql('Schema')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
describe ScimEngine::Schema::Group do
|
4
|
+
it 'returns Group schema as JSON' do
|
5
|
+
expected_json = <<-EOJ
|
6
|
+
{
|
7
|
+
"name": "Group",
|
8
|
+
"id": "urn:ietf:params:scim:schemas:core:2.0:Group",
|
9
|
+
"description": "Represents a Group",
|
10
|
+
"meta": {
|
11
|
+
"resourceType": "Schema",
|
12
|
+
"location": "/scim_engine/Schemas?name=urn%3Aietf%3Aparams%3Ascim%3Aschemas%3Acore%3A2.0%3AGroup"
|
13
|
+
},
|
14
|
+
"attributes": [
|
15
|
+
{
|
16
|
+
"multiValued": false,
|
17
|
+
"required": true,
|
18
|
+
"caseExact": false,
|
19
|
+
"mutability": "readWrite",
|
20
|
+
"uniqueness": "none",
|
21
|
+
"returned": "default",
|
22
|
+
"name": "displayName",
|
23
|
+
"type": "string"
|
24
|
+
},
|
25
|
+
{
|
26
|
+
"multiValued": true,
|
27
|
+
"required": false,
|
28
|
+
"caseExact": false,
|
29
|
+
"mutability": "readOnly",
|
30
|
+
"uniqueness": "none",
|
31
|
+
"returned": "default",
|
32
|
+
"name": "members",
|
33
|
+
"type": "complex",
|
34
|
+
"subAttributes": [
|
35
|
+
{
|
36
|
+
"multiValued": false,
|
37
|
+
"required": true,
|
38
|
+
"caseExact": false,
|
39
|
+
"mutability": "readOnly",
|
40
|
+
"uniqueness": "none",
|
41
|
+
"returned": "default",
|
42
|
+
"name": "value",
|
43
|
+
"type": "string"
|
44
|
+
},
|
45
|
+
{
|
46
|
+
"multiValued": false,
|
47
|
+
"required": false,
|
48
|
+
"caseExact": false,
|
49
|
+
"mutability": "readOnly",
|
50
|
+
"uniqueness": "none",
|
51
|
+
"returned": "default",
|
52
|
+
"name": "display",
|
53
|
+
"type": "string"
|
54
|
+
}
|
55
|
+
]
|
56
|
+
}
|
57
|
+
]
|
58
|
+
}
|
59
|
+
EOJ
|
60
|
+
|
61
|
+
group_schema = ScimEngine::Schema::Group.new
|
62
|
+
|
63
|
+
expect(JSON.parse(expected_json)).to eql(JSON.parse(group_schema.to_json))
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,140 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
describe ScimEngine::Schema::User do
|
4
|
+
it 'returns User schema as JSON' do
|
5
|
+
expected_json = <<-EOJ
|
6
|
+
[
|
7
|
+
{
|
8
|
+
"multiValued": false,
|
9
|
+
"required": true,
|
10
|
+
"caseExact": false,
|
11
|
+
"mutability": "readWrite",
|
12
|
+
"uniqueness": "server",
|
13
|
+
"returned": "default",
|
14
|
+
"name": "userName",
|
15
|
+
"type": "string"
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"multiValued": false,
|
19
|
+
"required": true,
|
20
|
+
"caseExact": false,
|
21
|
+
"mutability": "readWrite",
|
22
|
+
"uniqueness": "none",
|
23
|
+
"returned": "default",
|
24
|
+
"name": "name",
|
25
|
+
"type": "complex",
|
26
|
+
"subAttributes": [
|
27
|
+
{
|
28
|
+
"multiValued": false,
|
29
|
+
"required": true,
|
30
|
+
"caseExact": false,
|
31
|
+
"mutability": "readWrite",
|
32
|
+
"uniqueness": "none",
|
33
|
+
"returned": "default",
|
34
|
+
"name": "familyName",
|
35
|
+
"type": "string"
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"multiValued": false,
|
39
|
+
"required": true,
|
40
|
+
"caseExact": false,
|
41
|
+
"mutability": "readWrite",
|
42
|
+
"uniqueness": "none",
|
43
|
+
"returned": "default",
|
44
|
+
"name": "givenName",
|
45
|
+
"type": "string"
|
46
|
+
},
|
47
|
+
{
|
48
|
+
"multiValued": false,
|
49
|
+
"required": false,
|
50
|
+
"caseExact": false,
|
51
|
+
"mutability": "readWrite",
|
52
|
+
"uniqueness": "none",
|
53
|
+
"returned": "default",
|
54
|
+
"name": "formatted",
|
55
|
+
"type": "string"
|
56
|
+
}
|
57
|
+
]
|
58
|
+
},
|
59
|
+
{
|
60
|
+
"multiValued": true,
|
61
|
+
"required": true,
|
62
|
+
"caseExact": false,
|
63
|
+
"mutability": "readWrite",
|
64
|
+
"uniqueness": "none",
|
65
|
+
"returned": "default",
|
66
|
+
"name": "emails",
|
67
|
+
"type": "complex",
|
68
|
+
"subAttributes": [
|
69
|
+
{
|
70
|
+
"multiValued": false,
|
71
|
+
"required": true,
|
72
|
+
"caseExact": false,
|
73
|
+
"mutability": "readWrite",
|
74
|
+
"uniqueness": "none",
|
75
|
+
"returned": "default",
|
76
|
+
"name": "value",
|
77
|
+
"type": "string"
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"multiValued": false,
|
81
|
+
"required": false,
|
82
|
+
"caseExact": false,
|
83
|
+
"mutability": "readWrite",
|
84
|
+
"uniqueness": "none",
|
85
|
+
"returned": "default",
|
86
|
+
"name": "primary",
|
87
|
+
"type": "boolean"
|
88
|
+
},
|
89
|
+
{
|
90
|
+
"multiValued": false,
|
91
|
+
"required": false,
|
92
|
+
"caseExact": false,
|
93
|
+
"mutability": "readWrite",
|
94
|
+
"uniqueness": "none",
|
95
|
+
"returned": "default",
|
96
|
+
"name": "type",
|
97
|
+
"type": "string"
|
98
|
+
}
|
99
|
+
]
|
100
|
+
},
|
101
|
+
{
|
102
|
+
"multiValued": true,
|
103
|
+
"required": true,
|
104
|
+
"caseExact": false,
|
105
|
+
"mutability": "immutable",
|
106
|
+
"uniqueness": "none",
|
107
|
+
"returned": "default",
|
108
|
+
"name": "groups",
|
109
|
+
"type": "complex",
|
110
|
+
"subAttributes": [
|
111
|
+
{
|
112
|
+
"multiValued": false,
|
113
|
+
"required": true,
|
114
|
+
"caseExact": false,
|
115
|
+
"mutability": "readOnly",
|
116
|
+
"uniqueness": "none",
|
117
|
+
"returned": "default",
|
118
|
+
"name": "value",
|
119
|
+
"type": "string"
|
120
|
+
},
|
121
|
+
{
|
122
|
+
"multiValued": false,
|
123
|
+
"required": false,
|
124
|
+
"caseExact": false,
|
125
|
+
"mutability": "readOnly",
|
126
|
+
"uniqueness": "none",
|
127
|
+
"returned": "default",
|
128
|
+
"name": "display",
|
129
|
+
"type": "string"
|
130
|
+
}
|
131
|
+
]
|
132
|
+
}
|
133
|
+
]
|
134
|
+
EOJ
|
135
|
+
|
136
|
+
expect(JSON.parse(expected_json)).to eql(JSON.parse(ScimEngine::Schema::User.scim_attributes.to_json))
|
137
|
+
|
138
|
+
end
|
139
|
+
|
140
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
2
|
+
require 'spec_helper'
|
3
|
+
ENV['RAILS_ENV'] ||= 'test'
|
4
|
+
require File.expand_path('../dummy/config/environment', __FILE__)
|
5
|
+
# Prevent database truncation if the environment is production
|
6
|
+
abort("The Rails environment is running in production mode!") if Rails.env.production?
|
7
|
+
require 'rspec/rails'
|
8
|
+
require 'byebug'
|
9
|
+
# Add additional requires below this line. Rails is not loaded until this point!
|
10
|
+
|
11
|
+
# Requires supporting ruby files with custom matchers and macros, etc, in
|
12
|
+
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
13
|
+
# run as spec files by default. This means that files in spec/support that end
|
14
|
+
# in _spec.rb will both be required and run as specs, causing the specs to be
|
15
|
+
# run twice. It is recommended that you do not name files matching this glob to
|
16
|
+
# end with _spec.rb. You can configure this pattern with the --pattern
|
17
|
+
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
18
|
+
#
|
19
|
+
# The following line is provided for convenience purposes. It has the downside
|
20
|
+
# of increasing the boot-up time by auto-requiring all files in the support
|
21
|
+
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
22
|
+
# require only the support files necessary.
|
23
|
+
#
|
24
|
+
# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
25
|
+
|
26
|
+
# Checks for pending migrations and applies them before tests are run.
|
27
|
+
# If you are not using ActiveRecord, you can remove this line.
|
28
|
+
|
29
|
+
RSpec.configure do |config|
|
30
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
31
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
32
|
+
|
33
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
34
|
+
# examples within a transaction, remove the following line or assign false
|
35
|
+
# instead of true.
|
36
|
+
config.use_transactional_fixtures = true
|
37
|
+
|
38
|
+
# RSpec Rails can automatically mix in different behaviours to your tests
|
39
|
+
# based on their file location, for example enabling you to call `get` and
|
40
|
+
# `post` in specs under `spec/controllers`.
|
41
|
+
#
|
42
|
+
# You can disable this behaviour by removing the line below, and instead
|
43
|
+
# explicitly tag your specs with their type, e.g.:
|
44
|
+
#
|
45
|
+
# RSpec.describe UsersController, :type => :controller do
|
46
|
+
# # ...
|
47
|
+
# end
|
48
|
+
#
|
49
|
+
# The different available types are documented in the features, such as in
|
50
|
+
# https://relishapp.com/rspec/rspec-rails/docs
|
51
|
+
config.infer_spec_type_from_file_location!
|
52
|
+
|
53
|
+
# Filter lines from Rails gems in backtraces.
|
54
|
+
config.filter_rails_from_backtrace!
|
55
|
+
# arbitrary gems may also be filtered via:
|
56
|
+
# config.filter_gems_from_backtrace("gem name")
|
57
|
+
end
|