Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
a16d7e41
Commit
a16d7e41
authored
Apr 23, 2019
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert Rails.application.env_config after using mock_auth_hash
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
be15592a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
2 deletions
+13
-2
spec/controllers/omniauth_callbacks_controller_spec.rb
spec/controllers/omniauth_callbacks_controller_spec.rb
+5
-1
spec/support/controllers/ldap_omniauth_callbacks_controller_shared_context.rb
...lers/ldap_omniauth_callbacks_controller_shared_context.rb
+5
-1
spec/support/helpers/login_helpers.rb
spec/support/helpers/login_helpers.rb
+3
-0
No files found.
spec/controllers/omniauth_callbacks_controller_spec.rb
View file @
a16d7e41
...
...
@@ -9,10 +9,14 @@ describe OmniauthCallbacksController, type: :controller do
let
(
:user
)
{
create
(
:omniauth_user
,
extern_uid:
extern_uid
,
provider:
provider
)
}
before
do
mock_auth_hash
(
provider
.
to_s
,
+
extern_uid
,
user
.
email
)
@original_env_config_omniauth_auth
=
mock_auth_hash
(
provider
.
to_s
,
+
extern_uid
,
user
.
email
)
stub_omniauth_provider
(
provider
,
context:
request
)
end
after
do
Rails
.
application
.
env_config
[
'omniauth.auth'
]
=
@original_env_config_omniauth_auth
end
context
'when the user is on the last sign in attempt'
do
let
(
:extern_uid
)
{
'my-uid'
}
...
...
spec/support/controllers/ldap_omniauth_callbacks_controller_shared_context.rb
View file @
a16d7e41
...
...
@@ -25,9 +25,13 @@ shared_context 'Ldap::OmniauthCallbacksController' do
described_class
.
define_providers!
Rails
.
application
.
reload_routes!
mock_auth_hash
(
provider
.
to_s
,
uid
,
user
.
email
)
@original_env_config_omniauth_auth
=
mock_auth_hash
(
provider
.
to_s
,
uid
,
user
.
email
)
stub_omniauth_provider
(
provider
,
context:
request
)
allow
(
Gitlab
::
Auth
::
LDAP
::
Access
).
to
receive
(
:allowed?
).
and_return
(
valid_login?
)
end
after
do
Rails
.
application
.
env_config
[
'omniauth.auth'
]
=
@original_env_config_omniauth_auth
end
end
spec/support/helpers/login_helpers.rb
View file @
a16d7e41
...
...
@@ -118,7 +118,10 @@ module LoginHelpers
response_object:
response_object
}
})
original_env_config_omniauth_auth
=
Rails
.
application
.
env_config
[
'omniauth.auth'
]
Rails
.
application
.
env_config
[
'omniauth.auth'
]
=
OmniAuth
.
config
.
mock_auth
[
provider
.
to_sym
]
original_env_config_omniauth_auth
end
def
saml_xml
(
raw_saml_response
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment