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