diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-03 03:05:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-03 03:05:59 +0300 |
commit | 427b23c12718bea233931431e7d9307881a960c0 (patch) | |
tree | 5e15672783c950a5e68dd89517d7888e652e01a7 /com | |
parent | 6d60f910762c1a92a07a4afaf1b26962f75ee4b6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'com')
-rw-r--r-- | com/lib/com/gitlab/patch/draw_route.rb | 16 | ||||
-rw-r--r-- | com/spec/lib/gitlab/patch/draw_route_spec.rb | 25 |
2 files changed, 41 insertions, 0 deletions
diff --git a/com/lib/com/gitlab/patch/draw_route.rb b/com/lib/com/gitlab/patch/draw_route.rb new file mode 100644 index 00000000000..8626ff06c28 --- /dev/null +++ b/com/lib/com/gitlab/patch/draw_route.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module Com + module Gitlab + module Patch + module DrawRoute + extend ::Gitlab::Utils::Override + + override :draw_com + def draw_com(routes_name) + draw_route(route_path("com/config/routes/#{routes_name}.rb")) + end + end + end + end +end diff --git a/com/spec/lib/gitlab/patch/draw_route_spec.rb b/com/spec/lib/gitlab/patch/draw_route_spec.rb new file mode 100644 index 00000000000..823bebd5c0d --- /dev/null +++ b/com/spec/lib/gitlab/patch/draw_route_spec.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +require 'fast_spec_helper' +require 'com_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 'raises an error when nothing is drawn' do + expect { subject.draw(:non_existing) } + .to raise_error(described_class::RoutesNotFound) + end +end |