mirror of https://github.com/rails/rails
Make sure multiline string is not accepted by the regexp
This commit is contained in:
parent
bfdae1775a
commit
04ad814bb9
|
@ -107,7 +107,7 @@ module ActiveSupport
|
|||
options = names.extract_options!
|
||||
|
||||
names.each do |name|
|
||||
raise NameError.new('invalid config attribute name') unless name =~ /\A[_A-Za-z]\w*\Z/
|
||||
raise NameError.new('invalid config attribute name') unless name =~ /\A[_A-Za-z]\w*\z/
|
||||
|
||||
reader, reader_line = "def #{name}; config.#{name}; end", __LINE__
|
||||
writer, writer_line = "def #{name}=(value); config.#{name} = value; end", __LINE__
|
||||
|
|
|
@ -95,10 +95,18 @@ class ConfigurableActiveSupport < ActiveSupport::TestCase
|
|||
config_accessor "invalid attribute name"
|
||||
end
|
||||
end
|
||||
|
||||
assert_raises NameError do
|
||||
Class.new do
|
||||
include ActiveSupport::Configurable
|
||||
config_accessor "invalid attribute\nname"
|
||||
config_accessor "invalid\nattribute"
|
||||
end
|
||||
end
|
||||
|
||||
assert_raises NameError do
|
||||
Class.new do
|
||||
include ActiveSupport::Configurable
|
||||
config_accessor "invalid\n"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue