Commit 163bb482 authored by James Lopez's avatar James Lopez

Refactor users and spec

parent 09c4d8e0
......@@ -11,13 +11,14 @@ module EE
identity.user.name
end
present_collection true, :email
expose :email_user, as: :emails, using: '::EE::Gitlab::Scim::Emails'
private
DEFAULT_SCHEMA = 'urn:ietf:params:scim:schemas:core:2.0:User'
def schemas
["urn:ietf:params:scim:schemas:core:2.0:User"]
[DEFAULT_SCHEMA]
end
def active
......
......@@ -9,8 +9,7 @@ module EE
expose :items_per_page, as: :itemsPerPage
expose :start_index, as: :startIndex
present_collection true, :Resources
expose :resources, as: :Resources, using: ::EE::Gitlab::Scim::User
expose :resources, as: :Resources, using: ::EE::Gitlab::Scim::User #, if: ->(identity, _) { identity.present? }
private
......@@ -23,7 +22,7 @@ module EE
end
def total_results
1
resources.count
end
def items_per_page
......@@ -35,9 +34,8 @@ module EE
end
# We only support a single resource at the moment
# Please update `total_results` to `resources.count` once this changes
def resources
[object]
object.present? ? [object] : []
end
end
end
......
......@@ -3,8 +3,8 @@
require 'spec_helper'
describe ::EE::Gitlab::Scim::User do
let(:user) { create(:user) }
let(:identity) { create(:group_saml_identity, user: user) }
let(:user) { build(:user) }
let(:identity) { build(:group_saml_identity, user: user) }
let(:entity) do
described_class.new(identity)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment