scimitar 1.7.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/scimitar/active_record_backed_resources_controller.rb +10 -49
  3. data/app/controllers/scimitar/application_controller.rb +11 -35
  4. data/app/controllers/scimitar/schemas_controller.rb +0 -5
  5. data/app/models/scimitar/engine_configuration.rb +5 -13
  6. data/app/models/scimitar/error_response.rb +0 -12
  7. data/app/models/scimitar/lists/query_parser.rb +10 -25
  8. data/app/models/scimitar/resources/base.rb +4 -14
  9. data/app/models/scimitar/resources/mixin.rb +13 -137
  10. data/app/models/scimitar/schema/address.rb +0 -1
  11. data/app/models/scimitar/schema/attribute.rb +5 -14
  12. data/app/models/scimitar/schema/base.rb +1 -1
  13. data/app/models/scimitar/schema/vdtp.rb +1 -1
  14. data/app/models/scimitar/service_provider_configuration.rb +3 -14
  15. data/config/initializers/scimitar.rb +3 -28
  16. data/lib/scimitar/version.rb +2 -2
  17. data/lib/scimitar.rb +2 -6
  18. data/spec/apps/dummy/app/controllers/mock_groups_controller.rb +1 -1
  19. data/spec/apps/dummy/app/models/mock_group.rb +1 -1
  20. data/spec/apps/dummy/app/models/mock_user.rb +8 -36
  21. data/spec/apps/dummy/config/application.rb +1 -0
  22. data/spec/apps/dummy/config/environments/test.rb +28 -5
  23. data/spec/apps/dummy/config/initializers/scimitar.rb +10 -61
  24. data/spec/apps/dummy/config/routes.rb +6 -15
  25. data/spec/apps/dummy/db/migrate/20210304014602_create_mock_users.rb +1 -10
  26. data/spec/apps/dummy/db/migrate/20210308044214_create_join_table_mock_groups_mock_users.rb +3 -8
  27. data/spec/apps/dummy/db/schema.rb +4 -11
  28. data/spec/controllers/scimitar/application_controller_spec.rb +3 -72
  29. data/spec/controllers/scimitar/resource_types_controller_spec.rb +2 -2
  30. data/spec/controllers/scimitar/schemas_controller_spec.rb +2 -10
  31. data/spec/models/scimitar/complex_types/email_spec.rb +2 -0
  32. data/spec/models/scimitar/lists/query_parser_spec.rb +9 -76
  33. data/spec/models/scimitar/resources/base_spec.rb +70 -208
  34. data/spec/models/scimitar/resources/base_validation_spec.rb +2 -27
  35. data/spec/models/scimitar/resources/mixin_spec.rb +43 -768
  36. data/spec/models/scimitar/schema/attribute_spec.rb +3 -22
  37. data/spec/models/scimitar/schema/base_spec.rb +1 -1
  38. data/spec/models/scimitar/schema/user_spec.rb +0 -10
  39. data/spec/requests/active_record_backed_resources_controller_spec.rb +64 -423
  40. data/spec/requests/application_controller_spec.rb +3 -16
  41. metadata +7 -11
  42. data/LICENSE.txt +0 -21
  43. data/README.md +0 -671
  44. data/spec/apps/dummy/app/controllers/custom_save_mock_users_controller.rb +0 -24
@@ -9,22 +9,11 @@ module Scimitar
9
9
  class ServiceProviderConfiguration
10
10
  include ActiveModel::Model
11
11
 
12
- attr_accessor(
13
- :uses_defaults,
14
- :patch,
15
- :bulk,
16
- :filter,
17
- :changePassword,
18
- :sort,
19
- :etag,
20
- :authenticationSchemes,
21
- :schemas,
22
- :meta,
23
- )
12
+ attr_accessor :patch, :bulk, :filter, :changePassword,
13
+ :sort, :etag, :authenticationSchemes,
14
+ :schemas, :meta
24
15
 
25
16
  def initialize(attributes = {})
26
- @uses_defaults = attributes.empty?
27
-
28
17
  defaults = {
29
18
  bulk: Supportable.unsupported,
30
19
  changePassword: Supportable.unsupported,
@@ -38,10 +38,9 @@ Rails.application.config.to_prepare do # (required for >= Rails 7 / Zeitwerk)
38
38
  Scimitar.engine_configuration = Scimitar::EngineConfiguration.new({
39
39
 
40
40
  # If you have filters you want to run for any Scimitar action/route, you
41
- # can define them here. You can also override any shared controller methods
42
- # here. For example, you might use a before-action to set up some
43
- # multi-tenancy related state, skip Rails CSRF token verification, or
44
- # customise how Scimitar generates URLs:
41
+ # can define them here. For example, you might use a before-action to set
42
+ # up some multi-tenancy related state, or skip Rails CSRF token
43
+ # verification. For example:
45
44
  #
46
45
  # application_controller_mixin: Module.new do
47
46
  # def self.included(base)
@@ -55,10 +54,6 @@ Rails.application.config.to_prepare do # (required for >= Rails 7 / Zeitwerk)
55
54
  # prepend_before_action :setup_some_kind_of_multi_tenancy_data
56
55
  # end
57
56
  # end
58
- #
59
- # def scim_schemas_url(options)
60
- # super(custom_param: 'value', **options)
61
- # end
62
57
  # end, # ...other configuration entries might follow...
63
58
 
64
59
  # If you want to support username/password authentication:
@@ -86,26 +81,6 @@ Rails.application.config.to_prepare do # (required for >= Rails 7 / Zeitwerk)
86
81
  # Note that both basic and token authentication can be declared, with the
87
82
  # parameters in the inbound HTTP request determining which is invoked.
88
83
 
89
- # Scimitar rescues certain error cases and exceptions, in order to return a
90
- # JSON response to the API caller. If you want exceptions to also be
91
- # reported to a third party system such as sentry.io or raygun.com, you can
92
- # configure a Proc to do so. It is passed a Ruby exception subclass object.
93
- # For example, a minimal sentry.io reporter might do this:
94
- #
95
- # exception_reporter: Proc.new do | exception |
96
- # Sentry.capture_exception(exception)
97
- # end
98
- #
99
- # You will still need to configure your reporting system according to its
100
- # documentation (e.g. via a Rails "config/initializers/<foo>.rb" file).
101
-
102
- # Scimilar treats "VDTP" (Value, Display, Type, Primary) attribute values,
103
- # used for e.g. e-mail addresses or phone numbers, as required by default.
104
- # If you encounter a service which calls these with e.g. "null" value data,
105
- # you can configure all values to be optional. You'll need to deal with
106
- # whatever that means for you receiving system in your model code.
107
- #
108
- # optional_value_fields_required: false
109
84
  })
110
85
 
111
86
  end
@@ -3,11 +3,11 @@ module Scimitar
3
3
  # Gem version. If this changes, be sure to re-run "bundle install" or
4
4
  # "bundle update".
5
5
  #
6
- VERSION = '1.7.1'
6
+ VERSION = '2.0.0'
7
7
 
8
8
  # Date for VERSION. If this changes, be sure to re-run "bundle install"
9
9
  # or "bundle update".
10
10
  #
11
- DATE = '2023-11-15'
11
+ DATE = '2022-03-04'
12
12
 
13
13
  end
data/lib/scimitar.rb CHANGED
@@ -4,9 +4,7 @@ require 'scimitar/engine'
4
4
 
5
5
  module Scimitar
6
6
  def self.service_provider_configuration=(custom_configuration)
7
- if @service_provider_configuration.nil? || ! custom_configuration.uses_defaults
8
- @service_provider_configuration = custom_configuration
9
- end
7
+ @service_provider_configuration = custom_configuration
10
8
  end
11
9
 
12
10
  def self.service_provider_configuration(location:)
@@ -16,9 +14,7 @@ module Scimitar
16
14
  end
17
15
 
18
16
  def self.engine_configuration=(custom_configuration)
19
- if @engine_configuration.nil? || ! custom_configuration.uses_defaults
20
- @engine_configuration = custom_configuration
21
- end
17
+ @engine_configuration = custom_configuration
22
18
  end
23
19
 
24
20
  def self.engine_configuration
@@ -1,4 +1,4 @@
1
- class MockGroupsController < Scimitar::ActiveRecordBackedResourcesController
1
+ class MockUsersController < Scimitar::ActiveRecordBackedResourcesController
2
2
 
3
3
  protected
4
4
 
@@ -58,7 +58,7 @@ class MockGroup < ActiveRecord::Base
58
58
 
59
59
  case type.downcase
60
60
  when 'user'
61
- MockUser.find_by_primary_key(id)
61
+ MockUser.find_by_id(id)
62
62
  when 'group'
63
63
  MockGroup.find_by_id(id)
64
64
  else
@@ -1,24 +1,18 @@
1
1
  class MockUser < ActiveRecord::Base
2
2
 
3
- self.primary_key = :primary_key
4
-
5
3
  # ===========================================================================
6
4
  # TEST ATTRIBUTES - see db/migrate/20210304014602_create_mock_users.rb etc.
7
5
  # ===========================================================================
8
6
 
9
7
  READWRITE_ATTRS = %w{
10
- primary_key
8
+ id
11
9
  scim_uid
12
10
  username
13
- password
14
11
  first_name
15
12
  last_name
16
13
  work_email_address
17
14
  home_email_address
18
15
  work_phone_number
19
- organization
20
- department
21
- mock_groups
22
16
  }
23
17
 
24
18
  has_and_belongs_to_many :mock_groups
@@ -44,10 +38,9 @@ class MockUser < ActiveRecord::Base
44
38
 
45
39
  def self.scim_attributes_map
46
40
  return {
47
- id: :primary_key,
41
+ id: :id,
48
42
  externalId: :scim_uid,
49
43
  userName: :username,
50
- password: :password,
51
44
  name: {
52
45
  givenName: :first_name,
53
46
  familyName: :last_name
@@ -89,23 +82,7 @@ class MockUser < ActiveRecord::Base
89
82
  }
90
83
  }
91
84
  ],
92
- active: :is_active,
93
-
94
- # Custom extension schema - see configuration in
95
- # "spec/apps/dummy/config/initializers/scimitar.rb".
96
- #
97
- organization: :organization,
98
- department: :department,
99
- userGroups: [
100
- {
101
- list: :mock_groups,
102
- find_with: ->(value) { MockGroup.find(value["value"]) },
103
- using: {
104
- value: :id,
105
- display: :display_name
106
- }
107
- }
108
- ]
85
+ active: :is_active
109
86
  }
110
87
  end
111
88
 
@@ -115,16 +92,11 @@ class MockUser < ActiveRecord::Base
115
92
 
116
93
  def self.scim_queryable_attributes
117
94
  return {
118
- 'id' => { column: :primary_key },
119
- 'externalId' => { column: :scim_uid },
120
- 'meta.lastModified' => { column: :updated_at },
121
- 'name.givenName' => { column: :first_name },
122
- 'name.familyName' => { column: :last_name },
123
- 'groups' => { column: MockGroup.arel_table[:id] },
124
- 'groups.value' => { column: MockGroup.arel_table[:id] },
125
- 'emails' => { columns: [ :work_email_address, :home_email_address ] },
126
- 'emails.value' => { columns: [ :work_email_address, :home_email_address ] },
127
- 'emails.type' => { ignore: true } # We can't filter on that; it'll just search all e-mails
95
+ 'name.givenName' => { column: :first_name },
96
+ 'name.familyName' => { column: :last_name },
97
+ 'emails' => { columns: [ :work_email_address, :home_email_address ] },
98
+ 'emails.value' => { columns: [ :work_email_address, :home_email_address ] },
99
+ 'emails.type' => { ignore: true } # We can't filter on that; it'll just search all e-mails
128
100
  }
129
101
  end
130
102
 
@@ -12,6 +12,7 @@ require 'scimitar'
12
12
 
13
13
  module Dummy
14
14
  class Application < Rails::Application
15
+ config.load_defaults 7.0
15
16
  end
16
17
  end
17
18
 
@@ -1,15 +1,38 @@
1
+ require 'active_support/core_ext/integer/time'
2
+
1
3
  Rails.application.configure do
2
4
  config.cache_classes = true
3
5
  config.eager_load = false
4
- config.serve_static_files = true
5
- config.static_cache_control = 'public, max-age=3600'
6
- config.consider_all_requests_local = true
7
6
 
8
- config.action_dispatch.show_exceptions = false
7
+ # Configure public file server for tests with Cache-Control for performance.
8
+ config.public_file_server.enabled = true
9
+ config.public_file_server.headers = {
10
+ 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
11
+ }
9
12
 
13
+ # Show full error reports and disable caching.
14
+ config.consider_all_requests_local = true
10
15
  config.action_controller.perform_caching = false
16
+ config.cache_store = :null_store
17
+
18
+ # Raise exceptions instead of rendering exception templates.
19
+ config.action_dispatch.show_exceptions = false
20
+
21
+ # Disable request forgery protection in test environment.
11
22
  config.action_controller.allow_forgery_protection = false
12
23
 
13
- config.active_support.test_order = :random
24
+ # Print deprecation notices to the stderr.
14
25
  config.active_support.deprecation = :stderr
26
+
27
+ # Raise exceptions for disallowed deprecations.
28
+ config.active_support.disallowed_deprecation = :raise
29
+
30
+ # Tell Active Support which deprecation messages to disallow.
31
+ config.active_support.disallowed_deprecation_warnings = []
32
+
33
+ # Raises error for missing translations.
34
+ config.i18n.raise_on_missing_translations = true
35
+
36
+ # Annotate rendered view with file names.
37
+ # config.action_view.annotate_rendered_view_with_filenames = true
15
38
  end
@@ -1,67 +1,16 @@
1
1
  # Test app configuration.
2
2
  #
3
- # Note that as a result of https://github.com/RIPAGlobal/scimitar/issues/48,
4
- # tests include a custom extension of the core User schema. A shortcoming of
5
- # some of the code from which Scimitar was originally built is that those
6
- # extensions are done with class-level ivars, so it is largely impossible (or
7
- # at least, impractical in tests) to avoid polluting the core class itself
8
- # with the extension.
9
- #
10
- # All related schema tests are written with this in mind.
11
- #
12
- # Further, https://github.com/RIPAGlobal/scimitar/pull/54 fixed warning
13
- # messages in a way that worked on Rails 6+ but, for V1 Scimitar, it would
14
- # break existing working setups that didn't use the +to_prepare+ wrapper. Their
15
- # application configuration would be written *first* but then *overwritten* by
16
- # the default +to_prepare+ block in Scimitar itself, since that runs later. The
17
- # file below does *not* use +to_prepare+ in order to test the workaround that
18
- # was produced; it should work on all Ruby versions as-is.
19
- #
20
- Scimitar.engine_configuration = Scimitar::EngineConfiguration.new({
21
-
22
- application_controller_mixin: Module.new do
23
- def self.included(base)
24
- base.class_eval do
25
- def test_hook; end
26
- before_action :test_hook
3
+ Rails.application.config.to_prepare do
4
+ Scimitar.engine_configuration = Scimitar::EngineConfiguration.new({
5
+
6
+ application_controller_mixin: Module.new do
7
+ def self.included(base)
8
+ base.class_eval do
9
+ def test_hook; end
10
+ before_action :test_hook
11
+ end
27
12
  end
28
13
  end
29
14
 
30
- def scim_schemas_url(options)
31
- super(test: 1, **options)
32
- end
33
-
34
- def scim_resource_type_url(options)
35
- super(test: 1, **options)
36
- end
37
- end
38
-
39
- })
40
-
41
- module ScimSchemaExtensions
42
- module User
43
- class Enterprise < Scimitar::Schema::Base
44
- def initialize(options = {})
45
- super(
46
- name: 'ExtendedUser',
47
- description: 'Enterprise extension for a User',
48
- id: self.class.id,
49
- scim_attributes: self.class.scim_attributes
50
- )
51
- end
52
-
53
- def self.id
54
- 'urn:ietf:params:scim:schemas:extension:enterprise:2.0:User'
55
- end
56
-
57
- def self.scim_attributes
58
- [
59
- Scimitar::Schema::Attribute.new(name: 'organization', type: 'string'),
60
- Scimitar::Schema::Attribute.new(name: 'department', type: 'string')
61
- ]
62
- end
63
- end
64
- end
15
+ })
65
16
  end
66
-
67
- Scimitar::Resources::User.extend_schema ScimSchemaExtensions::User::Enterprise
@@ -6,26 +6,17 @@
6
6
  Rails.application.routes.draw do
7
7
  mount Scimitar::Engine, at: '/'
8
8
 
9
- get 'Users', to: 'mock_users#index'
10
- get 'Users/:id', to: 'mock_users#show'
11
- post 'Users', to: 'mock_users#create'
12
- put 'Users/:id', to: 'mock_users#replace'
13
- patch 'Users/:id', to: 'mock_users#update'
14
- delete 'Users/:id', to: 'mock_users#destroy'
15
-
16
- get 'Groups', to: 'mock_groups#index'
17
- get 'Groups/:id', to: 'mock_groups#show'
18
- patch 'Groups/:id', to: 'mock_groups#update'
9
+ get 'Users', to: 'mock_users#index'
10
+ get 'Users/:id', to: 'mock_users#show'
11
+ post 'Users', to: 'mock_users#create'
12
+ put 'Users/:id', to: 'mock_users#replace'
13
+ patch 'Users/:id', to: 'mock_users#update'
14
+ delete 'Users/:id', to: 'mock_users#destroy'
19
15
 
20
16
  # For testing blocks passed to ActiveRecordBackedResourcesController#destroy
21
17
  #
22
18
  delete 'CustomDestroyUsers/:id', to: 'custom_destroy_mock_users#destroy'
23
19
 
24
- # For testing blocks passed to ActiveRecordBackedResourcesController#save!
25
- #
26
- post 'CustomSaveUsers', to: 'custom_save_mock_users#create'
27
- get 'CustomSaveUsers/:id', to: 'custom_save_mock_users#show'
28
-
29
20
  # For testing environment inside Scimitar::ApplicationController subclasses.
30
21
  #
31
22
  get 'CustomRequestVerifiers', to: 'custom_request_verifiers#index'
@@ -1,24 +1,15 @@
1
1
  class CreateMockUsers < ActiveRecord::Migration[6.1]
2
2
  def change
3
- create_table :mock_users, id: :uuid, primary_key: :primary_key do |t|
4
- t.timestamps
3
+ create_table :mock_users do |t|
5
4
 
6
- # Support part of the core schema
7
- #
8
5
  t.text :scim_uid
9
6
  t.text :username
10
- t.text :password
11
7
  t.text :first_name
12
8
  t.text :last_name
13
9
  t.text :work_email_address
14
10
  t.text :home_email_address
15
11
  t.text :work_phone_number
16
12
 
17
- # Support the custom extension schema - see configuration in
18
- # "spec/apps/dummy/config/initializers/scimitar.rb".
19
- #
20
- t.text :organization
21
- t.text :department
22
13
  end
23
14
  end
24
15
  end
@@ -1,13 +1,8 @@
1
1
  class CreateJoinTableMockGroupsMockUsers < ActiveRecord::Migration[6.1]
2
2
  def change
3
- create_table :mock_groups_users, id: false do | t |
4
- t.references :mock_group, foreign_key: true, type: :int8, index: true, null: false
5
- t.references :mock_user, type: :uuid, index: true, null: false, primary_key: :primary_key
6
-
7
- # The 'foreign_key:' option (used above) only works for 'id' column names
8
- # but the test data has a column named 'primary_key' for 'mock_users'.
9
- #
10
- t.foreign_key :mock_users, primary_key: :primary_key
3
+ create_join_table :mock_groups, :mock_users do |t|
4
+ t.index [:mock_group_id, :mock_user_id]
5
+ t.index [:mock_user_id, :mock_group_id]
11
6
  end
12
7
  end
13
8
  end
@@ -24,26 +24,19 @@ ActiveRecord::Schema.define(version: 2021_03_08_044214) do
24
24
 
25
25
  create_table "mock_groups_users", id: false, force: :cascade do |t|
26
26
  t.bigint "mock_group_id", null: false
27
- t.uuid "mock_user_id", null: false
28
- t.index ["mock_group_id"], name: "index_mock_groups_users_on_mock_group_id"
29
- t.index ["mock_user_id"], name: "index_mock_groups_users_on_mock_user_id"
27
+ t.bigint "mock_user_id", null: false
28
+ t.index ["mock_group_id", "mock_user_id"], name: "index_mock_groups_users_on_mock_group_id_and_mock_user_id"
29
+ t.index ["mock_user_id", "mock_group_id"], name: "index_mock_groups_users_on_mock_user_id_and_mock_group_id"
30
30
  end
31
31
 
32
- create_table "mock_users", primary_key: "primary_key", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
33
- t.datetime "created_at", null: false
34
- t.datetime "updated_at", null: false
32
+ create_table "mock_users", force: :cascade do |t|
35
33
  t.text "scim_uid"
36
34
  t.text "username"
37
- t.text "password"
38
35
  t.text "first_name"
39
36
  t.text "last_name"
40
37
  t.text "work_email_address"
41
38
  t.text "home_email_address"
42
39
  t.text "work_phone_number"
43
- t.text "organization"
44
- t.text "department"
45
40
  end
46
41
 
47
- add_foreign_key "mock_groups_users", "mock_groups"
48
- add_foreign_key "mock_groups_users", "mock_users", primary_key: "primary_key"
49
42
  end
@@ -24,7 +24,7 @@ RSpec.describe Scimitar::ApplicationController do
24
24
  get :index, params: { format: :scim }
25
25
  expect(response).to be_ok
26
26
  expect(JSON.parse(response.body)).to eql({ 'message' => 'cool, cool!' })
27
- expect(response.headers['WWW-Authenticate']).to eql('Basic')
27
+ expect(response.headers['WWW_AUTHENTICATE']).to eql('Basic')
28
28
  end
29
29
 
30
30
  it 'renders failure with bad password' do
@@ -84,7 +84,7 @@ RSpec.describe Scimitar::ApplicationController do
84
84
  get :index, params: { format: :scim }
85
85
  expect(response).to be_ok
86
86
  expect(JSON.parse(response.body)).to eql({ 'message' => 'cool, cool!' })
87
- expect(response.headers['WWW-Authenticate']).to eql('Bearer')
87
+ expect(response.headers['WWW_AUTHENTICATE']).to eql('Bearer')
88
88
  end
89
89
 
90
90
  it 'renders failure with bad token' do
@@ -169,74 +169,5 @@ RSpec.describe Scimitar::ApplicationController do
169
169
  expect(parsed_body).to include('status' => '500')
170
170
  expect(parsed_body).to include('detail' => 'Bang')
171
171
  end
172
-
173
- context 'with an exception reporter' do
174
- around :each do | example |
175
- original_configuration = Scimitar.engine_configuration.exception_reporter
176
- Scimitar.engine_configuration.exception_reporter = Proc.new do | exception |
177
- @exception = exception
178
- end
179
- example.run()
180
- ensure
181
- Scimitar.engine_configuration.exception_reporter = original_configuration
182
- end
183
-
184
- context 'and "internal server error"' do
185
- it 'is invoked' do
186
- get :index, params: { format: :scim }
187
-
188
- expect(@exception).to be_a(RuntimeError)
189
- expect(@exception.message).to eql('Bang')
190
- end
191
- end
192
-
193
- context 'and "not found"' do
194
- controller do
195
- def index
196
- handle_resource_not_found(ActiveRecord::RecordNotFound.new(42))
197
- end
198
- end
199
-
200
- it 'is invoked' do
201
- get :index, params: { format: :scim }
202
-
203
- expect(@exception).to be_a(ActiveRecord::RecordNotFound)
204
- expect(@exception.message).to eql('42')
205
- end
206
- end
207
-
208
- context 'and bad JSON' do
209
- controller do
210
- def index
211
- begin
212
- raise 'Hello'
213
- rescue
214
- raise ActionDispatch::Http::Parameters::ParseError
215
- end
216
- end
217
- end
218
-
219
- it 'is invoked' do
220
- get :index, params: { format: :scim }
221
-
222
- expect(@exception).to be_a(ActionDispatch::Http::Parameters::ParseError)
223
- expect(@exception.message).to eql('Hello')
224
- end
225
- end
226
-
227
- context 'and a bad content type' do
228
- controller do
229
- def index; end
230
- end
231
-
232
- it 'is invoked' do
233
- request.headers['Content-Type'] = 'text/plain'
234
- get :index
235
-
236
- expect(@exception).to be_a(Scimitar::ErrorResponse)
237
- expect(@exception.message).to eql('Only application/scim+json type is accepted.')
238
- end
239
- end
240
- end # "context 'exception reporter' do"
241
- end # "context 'error handling' do"
172
+ end
242
173
  end
@@ -9,8 +9,8 @@ RSpec.describe Scimitar::ResourceTypesController do
9
9
  it 'renders the resource type for user' do
10
10
  get :index, format: :scim
11
11
  response_hash = JSON.parse(response.body)
12
- expected_response = [ Scimitar::Resources::User.resource_type(scim_resource_type_url(name: 'User', test: 1)),
13
- Scimitar::Resources::Group.resource_type(scim_resource_type_url(name: 'Group', test: 1))
12
+ expected_response = [ Scimitar::Resources::User.resource_type(scim_resource_type_url(name: 'User')),
13
+ Scimitar::Resources::Group.resource_type(scim_resource_type_url(name: 'Group'))
14
14
  ].to_json
15
15
 
16
16
  response_hash = JSON.parse(response.body)
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe Scimitar::SchemasController do
4
- routes { Scimitar::Engine.routes }
5
4
 
6
5
  before(:each) { allow(controller).to receive(:authenticated?).and_return(true) }
7
6
 
@@ -15,9 +14,9 @@ RSpec.describe Scimitar::SchemasController do
15
14
  get :index, params: { format: :scim }
16
15
  expect(response).to be_ok
17
16
  parsed_body = JSON.parse(response.body)
18
- expect(parsed_body.length).to eql(3)
17
+ expect(parsed_body.length).to eql(2)
19
18
  schema_names = parsed_body.map {|schema| schema['name']}
20
- expect(schema_names).to match_array(['User', 'ExtendedUser', 'Group'])
19
+ expect(schema_names).to match_array(['User', 'Group'])
21
20
  end
22
21
 
23
22
  it 'returns only the User schema when its id is provided' do
@@ -27,13 +26,6 @@ RSpec.describe Scimitar::SchemasController do
27
26
  expect(parsed_body['name']).to eql('User')
28
27
  end
29
28
 
30
- it 'includes the controller customised schema location' do
31
- get :index, params: { name: Scimitar::Schema::User.id, format: :scim }
32
- expect(response).to be_ok
33
- parsed_body = JSON.parse(response.body)
34
- expect(parsed_body.dig('meta', 'location')).to eq scim_schemas_url(name: Scimitar::Schema::User.id, test: 1)
35
- end
36
-
37
29
  it 'returns only the Group schema when its id is provided' do
38
30
  get :index, params: { name: Scimitar::Schema::Group.id, format: :scim }
39
31
  expect(response).to be_ok
@@ -18,4 +18,6 @@ RSpec.describe Scimitar::ComplexTypes::Email do
18
18
  expect(described_class.new(value: 'a@b.c').as_json).to eq('value' => 'a@b.c')
19
19
  end
20
20
  end
21
+
21
22
  end
23
+