diff options
author | Bob Van Landuyt <bob@gitlab.com> | 2017-04-24 12:22:51 +0200 |
---|---|---|
committer | Bob Van Landuyt <bob@gitlab.com> | 2017-05-01 11:14:24 +0200 |
commit | ea8e86dac856fdf6545e020df346533231379b93 (patch) | |
tree | 2309bba6e9dff9f91cc0fbb4a90fd374550c165e /spec/validators | |
parent | 39efd0c03018089366d5301583a605626e97e9d7 (diff) | |
download | gitlab-ce-ea8e86dac856fdf6545e020df346533231379b93.tar.gz |
Use `%r{}` regexes to avoid having to escape `/`
Diffstat (limited to 'spec/validators')
-rw-r--r-- | spec/validators/dynamic_path_validator_spec.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/spec/validators/dynamic_path_validator_spec.rb b/spec/validators/dynamic_path_validator_spec.rb index 71098b17dfd..960a6204c90 100644 --- a/spec/validators/dynamic_path_validator_spec.rb +++ b/spec/validators/dynamic_path_validator_spec.rb @@ -63,13 +63,13 @@ describe DynamicPathValidator do # - Followed by one or more path-parts not starting with `:` or `*` # - Followed by a path-part that includes a wildcard parameter `*` # At the time of writing these routes match: http://rubular.com/r/Rv2pDE5Dvw - STARTING_WITH_NAMESPACE = /^\/\*namespace_id\/:(project_)?id/ - NON_PARAM_PARTS = /[^:*][a-z\-_\/]*/ - ANY_OTHER_PATH_PART = /[a-z\-_\/:]*/ - WILDCARD_SEGMENT = /\*/ + STARTING_WITH_NAMESPACE = %r{^/\*namespace_id/:(project_)?id} + NON_PARAM_PARTS = %r{[^:*][a-z\-_/]*} + ANY_OTHER_PATH_PART = %r{[a-z\-_/:]*} + WILDCARD_SEGMENT = %r{\*} let(:namespaced_wildcard_routes) do routes_without_format.select do |p| - p =~ %r{#{STARTING_WITH_NAMESPACE}\/#{NON_PARAM_PARTS}\/#{ANY_OTHER_PATH_PART}#{WILDCARD_SEGMENT}} + p =~ %r{#{STARTING_WITH_NAMESPACE}/#{NON_PARAM_PARTS}/#{ANY_OTHER_PATH_PART}#{WILDCARD_SEGMENT}} end end |