scimitar 1.10.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/scimitar/active_record_backed_resources_controller.rb +23 -98
- data/app/controllers/scimitar/application_controller.rb +13 -41
- data/app/controllers/scimitar/resource_types_controller.rb +2 -0
- data/app/controllers/scimitar/resources_controller.rb +2 -0
- data/app/controllers/scimitar/schemas_controller.rb +3 -366
- data/app/controllers/scimitar/service_provider_configurations_controller.rb +1 -0
- data/app/models/scimitar/complex_types/address.rb +6 -0
- data/app/models/scimitar/engine_configuration.rb +5 -15
- data/app/models/scimitar/error_response.rb +0 -12
- data/app/models/scimitar/lists/query_parser.rb +13 -113
- data/app/models/scimitar/resource_invalid_error.rb +1 -1
- data/app/models/scimitar/resources/base.rb +9 -53
- data/app/models/scimitar/resources/mixin.rb +59 -646
- data/app/models/scimitar/schema/address.rb +0 -1
- data/app/models/scimitar/schema/attribute.rb +5 -14
- data/app/models/scimitar/schema/base.rb +1 -1
- data/app/models/scimitar/schema/name.rb +2 -2
- data/app/models/scimitar/schema/user.rb +10 -10
- data/app/models/scimitar/schema/vdtp.rb +1 -1
- data/app/models/scimitar/service_provider_configuration.rb +3 -14
- data/config/initializers/scimitar.rb +3 -69
- data/lib/scimitar/engine.rb +12 -57
- data/lib/scimitar/support/hash_with_indifferent_case_insensitive_access.rb +10 -140
- data/lib/scimitar/version.rb +2 -2
- data/lib/scimitar.rb +2 -7
- data/spec/apps/dummy/app/controllers/mock_groups_controller.rb +1 -1
- data/spec/apps/dummy/app/models/mock_group.rb +1 -1
- data/spec/apps/dummy/app/models/mock_user.rb +9 -52
- data/spec/apps/dummy/config/application.rb +1 -0
- data/spec/apps/dummy/config/environments/test.rb +28 -5
- data/spec/apps/dummy/config/initializers/scimitar.rb +10 -90
- data/spec/apps/dummy/config/routes.rb +7 -28
- data/spec/apps/dummy/db/migrate/20210304014602_create_mock_users.rb +1 -11
- data/spec/apps/dummy/db/migrate/20210308044214_create_join_table_mock_groups_mock_users.rb +3 -8
- data/spec/apps/dummy/db/schema.rb +4 -12
- data/spec/controllers/scimitar/application_controller_spec.rb +3 -126
- data/spec/controllers/scimitar/resource_types_controller_spec.rb +2 -2
- data/spec/controllers/scimitar/schemas_controller_spec.rb +48 -344
- data/spec/models/scimitar/complex_types/address_spec.rb +4 -3
- data/spec/models/scimitar/complex_types/email_spec.rb +2 -0
- data/spec/models/scimitar/lists/query_parser_spec.rb +9 -146
- data/spec/models/scimitar/resources/base_spec.rb +71 -217
- data/spec/models/scimitar/resources/base_validation_spec.rb +5 -43
- data/spec/models/scimitar/resources/mixin_spec.rb +129 -1508
- data/spec/models/scimitar/schema/attribute_spec.rb +3 -22
- data/spec/models/scimitar/schema/base_spec.rb +1 -1
- data/spec/models/scimitar/schema/user_spec.rb +2 -12
- data/spec/requests/active_record_backed_resources_controller_spec.rb +66 -1016
- data/spec/requests/application_controller_spec.rb +3 -16
- data/spec/requests/engine_spec.rb +0 -75
- data/spec/spec_helper.rb +1 -9
- data/spec/support/hash_with_indifferent_case_insensitive_access_spec.rb +0 -108
- metadata +26 -37
- data/LICENSE.txt +0 -21
- data/README.md +0 -717
- data/lib/scimitar/support/utilities.rb +0 -111
- data/spec/apps/dummy/app/controllers/custom_create_mock_users_controller.rb +0 -25
- data/spec/apps/dummy/app/controllers/custom_replace_mock_users_controller.rb +0 -25
- data/spec/apps/dummy/app/controllers/custom_save_mock_users_controller.rb +0 -24
- data/spec/apps/dummy/app/controllers/custom_update_mock_users_controller.rb +0 -25
@@ -21,8 +21,10 @@ RSpec.describe Scimitar::Schema::Attribute do
|
|
21
21
|
expect(name.type).to eql('complex')
|
22
22
|
expect(name.subAttributes).to eql(Scimitar::Schema::Name.scim_attributes)
|
23
23
|
end
|
24
|
+
|
24
25
|
end
|
25
26
|
|
27
|
+
|
26
28
|
context '#valid?' do
|
27
29
|
it 'is invalid if attribute is required but value is blank' do
|
28
30
|
attribute = described_class.new(name: 'userName', type: 'string', required: true)
|
@@ -46,28 +48,6 @@ RSpec.describe Scimitar::Schema::Attribute do
|
|
46
48
|
expect(attribute.errors.messages.to_h).to eql({userName: ['has the wrong type. It has to be a(n) string.']})
|
47
49
|
end
|
48
50
|
|
49
|
-
it 'is valid if multi-valued and type is string and given value is an array of strings' do
|
50
|
-
attribute = described_class.new(name: 'scopes', multiValued: true, type: 'string')
|
51
|
-
expect(attribute.valid?(['something', 'something else'])).to be(true)
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'is valid if multi-valued and type is string and given value is an empty array' do
|
55
|
-
attribute = described_class.new(name: 'scopes', multiValued: true, type: 'string')
|
56
|
-
expect(attribute.valid?([])).to be(true)
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'is invalid if multi-valued and type is string and given value is not an array' do
|
60
|
-
attribute = described_class.new(name: 'scopes', multiValued: true, type: 'string')
|
61
|
-
expect(attribute.valid?('something')).to be(false)
|
62
|
-
expect(attribute.errors.messages.to_h).to eql({scopes: ['or one of its elements has the wrong type. It has to be an array of strings.']})
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'is invalid if multi-valued and type is string and given value is an array containing another type' do
|
66
|
-
attribute = described_class.new(name: 'scopes', multiValued: true, type: 'string')
|
67
|
-
expect(attribute.valid?(['something', 123])).to be(false)
|
68
|
-
expect(attribute.errors.messages.to_h).to eql({scopes: ['or one of its elements has the wrong type. It has to be an array of strings.']})
|
69
|
-
end
|
70
|
-
|
71
51
|
it 'is valid if type is boolean and given value is boolean' do
|
72
52
|
expect(described_class.new(name: 'name', type: 'boolean').valid?(false)).to be(true)
|
73
53
|
expect(described_class.new(name: 'name', type: 'boolean').valid?(true)).to be(true)
|
@@ -96,4 +76,5 @@ RSpec.describe Scimitar::Schema::Attribute do
|
|
96
76
|
expect(described_class.new(name: 'startDate', type: 'dateTime').valid?('gaga')).to be(false)
|
97
77
|
end
|
98
78
|
end
|
79
|
+
|
99
80
|
end
|
@@ -27,7 +27,7 @@ RSpec.describe Scimitar::Schema::User do
|
|
27
27
|
"subAttributes": [
|
28
28
|
{
|
29
29
|
"multiValued": false,
|
30
|
-
"required":
|
30
|
+
"required": true,
|
31
31
|
"caseExact": false,
|
32
32
|
"mutability": "readWrite",
|
33
33
|
"uniqueness": "none",
|
@@ -37,7 +37,7 @@ RSpec.describe Scimitar::Schema::User do
|
|
37
37
|
},
|
38
38
|
{
|
39
39
|
"multiValued": false,
|
40
|
-
"required":
|
40
|
+
"required": true,
|
41
41
|
"caseExact": false,
|
42
42
|
"mutability": "readWrite",
|
43
43
|
"uniqueness": "none",
|
@@ -419,16 +419,6 @@ RSpec.describe Scimitar::Schema::User do
|
|
419
419
|
"name": "type",
|
420
420
|
"type": "string"
|
421
421
|
},
|
422
|
-
{
|
423
|
-
"multiValued": false,
|
424
|
-
"required": false,
|
425
|
-
"caseExact": false,
|
426
|
-
"mutability": "readWrite",
|
427
|
-
"uniqueness": "none",
|
428
|
-
"returned": "default",
|
429
|
-
"name": "primary",
|
430
|
-
"type": "boolean"
|
431
|
-
},
|
432
422
|
{
|
433
423
|
"multiValued": false,
|
434
424
|
"required": false,
|