aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorZachary Scott <e@zzak.io>2014-11-23 12:06:57 -0800
committerZachary Scott <e@zzak.io>2014-11-23 12:06:57 -0800
commitbe8d1a9b57175732f9dafe23f790da82d4b06135 (patch)
tree683f1713f48e60556de47e3b28905d91991a4dfa /activerecord/test
parentc837259ae422a659b2a71e6f29e3a4f3ea049f05 (diff)
downloadrails-be8d1a9b57175732f9dafe23f790da82d4b06135.tar.gz
rails-be8d1a9b57175732f9dafe23f790da82d4b06135.tar.bz2
rails-be8d1a9b57175732f9dafe23f790da82d4b06135.zip
Add a test for reflection keys as Strings, fixes #16928
See also PR: #17610
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/reflection_test.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/test/cases/reflection_test.rb b/activerecord/test/cases/reflection_test.rb
index 84abaf0291..094fcccc89 100644
--- a/activerecord/test/cases/reflection_test.rb
+++ b/activerecord/test/cases/reflection_test.rb
@@ -209,6 +209,10 @@ class ReflectionTest < ActiveRecord::TestCase
assert_not_equal Object.new, Firm._reflections['clients']
end
+ def test_reflections_should_return_keys_as_strings
+ assert Category.reflections.keys.all? { |key| key.is_a? String }, "Model.reflections is expected to return string for keys"
+ end
+
def test_has_and_belongs_to_many_reflection
assert_equal :has_and_belongs_to_many, Category.reflections['posts'].macro
assert_equal :posts, Category.reflect_on_all_associations(:has_and_belongs_to_many).first.name