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
f4d06fad
Commit
f4d06fad
authored
Oct 18, 2018
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract EE only oauth routes and add tests
parent
745d18e7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
86 additions
and
9 deletions
+86
-9
config/routes.rb
config/routes.rb
+1
-7
ee/config/routes/oauth.rb
ee/config/routes/oauth.rb
+7
-0
ee/spec/lib/gitlab/patch/draw_route_spec.rb
ee/spec/lib/gitlab/patch/draw_route_spec.rb
+42
-0
lib/gitlab/patch/draw_route.rb
lib/gitlab/patch/draw_route.rb
+6
-2
spec/lib/gitlab/patch/draw_route_spec.rb
spec/lib/gitlab/patch/draw_route_spec.rb
+30
-0
No files found.
config/routes.rb
View file @
f4d06fad
...
...
@@ -37,13 +37,7 @@ Rails.application.routes.draw do
match
'*all'
,
via:
[
:get
,
:post
],
to:
proc
{
[
404
,
{},
[
''
]]
}
end
namespace
:oauth
do
scope
path:
'geo'
,
controller: :geo_auth
,
as: :geo
do
get
'auth'
get
'callback'
get
'logout'
end
end
draw
:oauth
use_doorkeeper_openid_connect
...
...
ee/config/routes/oauth.rb
0 → 100644
View file @
f4d06fad
namespace
:oauth
do
scope
path:
'geo'
,
controller: :geo_auth
,
as: :geo
do
get
'auth'
get
'callback'
get
'logout'
end
end
ee/spec/lib/gitlab/patch/draw_route_spec.rb
0 → 100644
View file @
f4d06fad
# frozen_string_literal: true
require
'fast_spec_helper'
describe
Gitlab
::
Patch
::
DrawRoute
do
subject
do
Class
.
new
do
include
Gitlab
::
Patch
::
DrawRoute
def
route_path
(
route_name
)
File
.
expand_path
(
"../../../../../
#{
route_name
}
"
,
__dir__
)
end
end
.
new
end
before
do
allow
(
subject
).
to
receive
(
:instance_eval
)
end
it
'evaluates EE only routes'
do
subject
.
draw
(
:oauth
)
expect
(
subject
).
to
have_received
(
:instance_eval
)
.
with
(
File
.
read
(
subject
.
route_path
(
'ee/config/routes/oauth.rb'
)))
.
once
expect
(
subject
).
to
have_received
(
:instance_eval
)
.
once
end
it
'evaluates CE and EE routes'
do
subject
.
draw
(
:admin
)
expect
(
subject
).
to
have_received
(
:instance_eval
)
.
with
(
File
.
read
(
subject
.
route_path
(
'config/routes/admin.rb'
)))
.
once
expect
(
subject
).
to
have_received
(
:instance_eval
)
.
with
(
File
.
read
(
subject
.
route_path
(
'ee/config/routes/admin.rb'
)))
.
once
end
end
lib/gitlab/patch/draw_route.rb
View file @
f4d06fad
...
...
@@ -13,11 +13,15 @@ module Gitlab
end
def
draw_ce
(
routes_name
)
draw_route
(
Rails
.
root
.
join
(
"config/routes/
#{
routes_name
}
.rb"
))
draw_route
(
route_path
(
"config/routes/
#{
routes_name
}
.rb"
))
end
def
draw_ee
(
routes_name
)
draw_route
(
Rails
.
root
.
join
(
"ee/config/routes/
#{
routes_name
}
.rb"
))
draw_route
(
route_path
(
"ee/config/routes/
#{
routes_name
}
.rb"
))
end
def
route_path
(
routes_name
)
Rails
.
root
.
join
(
routes_name
)
end
def
draw_route
(
path
)
...
...
spec/lib/gitlab/patch/draw_route_spec.rb
0 → 100644
View file @
f4d06fad
# frozen_string_literal: true
require
'fast_spec_helper'
describe
Gitlab
::
Patch
::
DrawRoute
do
subject
do
Class
.
new
do
include
Gitlab
::
Patch
::
DrawRoute
def
route_path
(
route_name
)
File
.
expand_path
(
"../../../../
#{
route_name
}
"
,
__dir__
)
end
end
.
new
end
before
do
allow
(
subject
).
to
receive
(
:instance_eval
)
end
it
'evaluates CE only route'
do
subject
.
draw
(
:help
)
expect
(
subject
).
to
have_received
(
:instance_eval
)
.
with
(
File
.
read
(
subject
.
route_path
(
'config/routes/help.rb'
)))
.
once
expect
(
subject
).
to
have_received
(
:instance_eval
)
.
once
end
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