diff options
author | Arthur Neves <arthurnn@gmail.com> | 2014-04-03 10:39:05 -0400 |
---|---|---|
committer | Arthur Neves <arthurnn@gmail.com> | 2014-04-03 16:40:01 -0400 |
commit | 815c9deae8de557688e1c99aabe30454bcbe5970 (patch) | |
tree | df11e8eb468b6b22540d7127a698966257848bf2 /activerecord/test | |
parent | ae110ce5d4de8cb3a22f826b0e824f333d2b2742 (diff) | |
download | rails-815c9deae8de557688e1c99aabe30454bcbe5970.tar.gz rails-815c9deae8de557688e1c99aabe30454bcbe5970.tar.bz2 rails-815c9deae8de557688e1c99aabe30454bcbe5970.zip |
Block a few default Class methods as scope name.
Add tests to make sure scopes cannot be create with names such as:
private, protected, public.
Make sure enum values don't collide with those methods too.
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/enum_test.rb | 1 | ||||
-rw-r--r-- | activerecord/test/cases/scoping/named_scoping_test.rb | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/test/cases/enum_test.rb b/activerecord/test/cases/enum_test.rb index f8ebd7caee..47de3dec98 100644 --- a/activerecord/test/cases/enum_test.rb +++ b/activerecord/test/cases/enum_test.rb @@ -194,6 +194,7 @@ class EnumTest < ActiveRecord::TestCase :valid, # generates #valid?, which conflicts with an AR method :save, # generates #save!, which conflicts with an AR method :proposed, # same value as an existing enum + :public, :private, :protected, # generates a method that conflict with ruby words ] conflicts.each_with_index do |value, i| diff --git a/activerecord/test/cases/scoping/named_scoping_test.rb b/activerecord/test/cases/scoping/named_scoping_test.rb index f0ad9ebb8a..59ec2dd6a4 100644 --- a/activerecord/test/cases/scoping/named_scoping_test.rb +++ b/activerecord/test/cases/scoping/named_scoping_test.rb @@ -291,6 +291,9 @@ class NamedScopingTest < ActiveRecord::TestCase :relation, # private class method on AR::Base :new, # redefined class method on AR::Base :all, # a default scope + :public, + :protected, + :private ] non_conflicts = [ |