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
52fa309e
Commit
52fa309e
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
f1701c0f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
2 deletions
+38
-2
config/routes.rb
config/routes.rb
+2
-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 @
52fa309e
...
...
@@ -34,6 +34,8 @@ Rails.application.routes.draw do
match
'*all'
,
via:
[
:get
,
:post
],
to:
proc
{
[
404
,
{},
[
''
]]
}
end
draw
:oauth
use_doorkeeper_openid_connect
# Autocomplete
...
...
lib/gitlab/patch/draw_route.rb
View file @
52fa309e
...
...
@@ -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 @
52fa309e
# 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