Commit 52fa309e authored by Lin Jen-Shin's avatar Lin Jen-Shin

Extract EE only oauth routes and add tests

parent f1701c0f
......@@ -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
......
......@@ -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)
......
# 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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment