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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
8dcff73e
Commit
8dcff73e
authored
Nov 03, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stub more and memorise current user
parent
5de49a36
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
ee/lib/ee/api/helpers.rb
ee/lib/ee/api/helpers.rb
+2
-0
spec/ee/spec/lib/ee/api/helpers_spec.rb
spec/ee/spec/lib/ee/api/helpers_spec.rb
+9
-3
No files found.
ee/lib/ee/api/helpers.rb
View file @
8dcff73e
...
...
@@ -2,6 +2,8 @@ module EE
module
API
module
Helpers
def
current_user
return
@current_user
if
defined?
(
@current_user
)
user
=
super
::
Gitlab
::
Database
::
LoadBalancing
::
RackMiddleware
...
...
spec/ee/spec/lib/ee/api/helpers_spec.rb
View file @
8dcff73e
require
'spec_helper'
describe
EE
::
API
::
Helpers
do
let
(
:helper
)
{
Class
.
new
{
include
API
::
Helpers
}.
new
}
let
(
:env
)
{
{
'rack.input'
=>
StringIO
.
new
}
}
let
(
:helper
)
do
Class
.
new
{
include
API
::
Helpers
,
API
::
APIGuard
::
HelperMethods
}.
new
end
before
do
allow
(
helper
).
to
receive
(
:env
).
and_return
({})
allow
(
helper
).
to
receive
(
:env
).
and_return
(
env
)
allow
(
helper
).
to
receive
(
:params
).
and_return
({})
allow
(
helper
).
to
receive
(
:options
).
and_return
({})
allow
(
Gitlab
::
Database
::
LoadBalancing
).
to
receive
(
:enable?
).
and_return
(
true
)
end
...
...
@@ -19,7 +25,7 @@ describe EE::API::Helpers do
allow
(
helper
).
to
receive
(
:initial_current_user
).
and_return
(
user
)
expect
(
Gitlab
::
Database
::
LoadBalancing
::
RackMiddleware
)
.
to
receive
(
:stick_or_unstick
).
with
(
{}
,
:user
,
42
)
.
to
receive
(
:stick_or_unstick
).
with
(
env
,
:user
,
42
)
helper
.
current_user
end
...
...
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