summaryrefslogtreecommitdiff
path: root/spec/requests/openid_connect_spec.rb
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2018-02-16 16:00:03 -0600
committerMike Greiling <mike@pixelcog.com>2018-02-16 16:00:03 -0600
commit8e65c13a586031928c681c4926d059df23ad5753 (patch)
treedf99f6a592a2d3f7f5fabb4c85c6b90f0343ca68 /spec/requests/openid_connect_spec.rb
parentfa260ac8400b16bc19acc5740b47c596c1c903c0 (diff)
parentb236348388c46c0550ec6844df35ec2689c4060b (diff)
downloadgitlab-ce-chart.html.haml-refactor.tar.gz
Merge branch 'master' into chart.html.haml-refactorchart.html.haml-refactor
* master: (484 commits) migrate admin:users:* to static bundle correct for missing break statement in dispatcher.js alias create and update actions to new and edit migrate projects:merge_requests:edit to static bundle migrate projects:merge_requests:creations:diffs to static bundle migrate projects:merge_requests:creations:new to static bundle migrate projects:issues:new and projects:issues:edit to static bundle migrate projects:branches:index to static bundle migrate projects:branches:new to static bundle migrate projects:compare:show to static bundle migrate projects:environments:metrics to static bundle migrate projects:milestones:* and groups:milestones:* to static bundle migrate explore:groups:index to static bundle migrate explore:projects:* to static bundle migrate dashboard:projects:* to static bundle migrate admin:jobs:index to static bundle migrate dashboard:todos:index to static bundle migrate groups:merge_requests to static bundle migrate groups:issues to static bundle migrate dashboard:merge_requests to static bundle ...
Diffstat (limited to 'spec/requests/openid_connect_spec.rb')
-rw-r--r--spec/requests/openid_connect_spec.rb27
1 files changed, 21 insertions, 6 deletions
diff --git a/spec/requests/openid_connect_spec.rb b/spec/requests/openid_connect_spec.rb
index 1a5ad9b04e4..de829011e58 100644
--- a/spec/requests/openid_connect_spec.rb
+++ b/spec/requests/openid_connect_spec.rb
@@ -65,13 +65,23 @@ describe 'OpenID Connect requests' do
)
end
- let(:public_email) { build :email, email: 'public@example.com' }
- let(:private_email) { build :email, email: 'private@example.com' }
+ let!(:public_email) { build :email, email: 'public@example.com' }
+ let!(:private_email) { build :email, email: 'private@example.com' }
- it 'includes all user information' do
+ let!(:group1) { create :group, path: 'group1' }
+ let!(:group2) { create :group, path: 'group2' }
+ let!(:group3) { create :group, path: 'group3', parent: group2 }
+ let!(:group4) { create :group, path: 'group4', parent: group3 }
+
+ before do
+ group1.add_user(user, GroupMember::OWNER)
+ group3.add_user(user, Gitlab::Access::DEVELOPER)
+ end
+
+ it 'includes all user information and group memberships' do
request_user_info
- expect(json_response).to eq({
+ expect(json_response).to match(a_hash_including({
'sub' => hashed_subject,
'name' => 'Alice',
'nickname' => 'alice',
@@ -79,8 +89,13 @@ describe 'OpenID Connect requests' do
'email_verified' => true,
'website' => 'https://example.com',
'profile' => 'http://localhost/alice',
- 'picture' => "http://localhost/uploads/-/system/user/avatar/#{user.id}/dk.png"
- })
+ 'picture' => "http://localhost/uploads/-/system/user/avatar/#{user.id}/dk.png",
+ 'groups' => anything
+ }))
+
+ expected_groups = %w[group1 group2/group3]
+ expected_groups << 'group2/group3/group4' if Group.supports_nested_groups?
+ expect(json_response['groups']).to match_array(expected_groups)
end
end