Commit c5059cb4 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Make path validation case-insensitive

parent 27f54beb
......@@ -94,6 +94,7 @@ class DynamicPathValidator < ActiveModel::EachValidator
end
def self.reserved?(value, type: :strict)
value = value.to_s.downcase
case type
when :wildcard
WILDCARD_ROUTES.include?(value)
......
......@@ -81,7 +81,13 @@ describe DynamicPathValidator do
end
end
describe '#valid_full_path' do
describe ".valid?" do
it 'is not case sensitive' do
expect(described_class.valid?("Users", type: :top_level)).to be(false)
end
end
describe '.valid_full_path' do
it "isn't valid when the top level is reserved" do
test_path = 'u/should-be-a/reserved-word'
......
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