Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/com
diff options
context:
space:
mode:
Diffstat (limited to 'com')
-rw-r--r--com/lib/com/gitlab/patch/draw_route.rb16
-rw-r--r--com/spec/lib/gitlab/patch/draw_route_spec.rb25
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