summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2017-11-06 12:53:54 +0000
committerDouwe Maan <douwe@gitlab.com>2017-11-06 12:53:54 +0000
commitcfd09fe88301e3ba01b1bfbfc1454c04f0cca3d9 (patch)
tree5c9258e756ccb70d212c23e8b8431c9511c21d41
parentd77b9715406f027a060f376199dbd1f56dd866b3 (diff)
parentcc829e81924259169fa562ec59a5bf899e59e479 (diff)
downloadgitlab-ce-cfd09fe88301e3ba01b1bfbfc1454c04f0cca3d9.tar.gz
Merge branch 'ignore-legacy-routes-in-routing-spec' into 'master'
Ignore routes matching legacy_*_redirect in route specs See merge request gitlab-org/gitlab-ce!15208
-rw-r--r--spec/lib/gitlab/path_regex_spec.rb19
1 files changed, 16 insertions, 3 deletions
diff --git a/spec/lib/gitlab/path_regex_spec.rb b/spec/lib/gitlab/path_regex_spec.rb
index f1f188cbfb5..ee63c9338c5 100644
--- a/spec/lib/gitlab/path_regex_spec.rb
+++ b/spec/lib/gitlab/path_regex_spec.rb
@@ -68,14 +68,27 @@ describe Gitlab::PathRegex do
message
end
- let(:all_routes) do
+ let(:all_non_legacy_routes) do
route_set = Rails.application.routes
routes_collection = route_set.routes
routes_array = routes_collection.routes
- routes_array.map { |route| route.path.spec.to_s }
+
+ non_legacy_routes = routes_array.reject do |route|
+ route.name.to_s =~ /legacy_(\w*)_redirect/
+ end
+
+ non_deprecated_redirect_routes = non_legacy_routes.reject do |route|
+ app = route.app
+ # `app.app` is either another app, or `self`. We want to find the final app.
+ app = app.app while app.try(:app) && app.app != app
+
+ app.is_a?(ActionDispatch::Routing::PathRedirect) && app.block.include?('/-/')
+ end
+
+ non_deprecated_redirect_routes.map { |route| route.path.spec.to_s }
end
- let(:routes_without_format) { all_routes.map { |path| without_format(path) } }
+ let(:routes_without_format) { all_non_legacy_routes.map { |path| without_format(path) } }
# Routes not starting with `/:` or `/*`
# all routes not starting with a param