Permalink
Browse files

Merge pull request #17732 from rails/add-reflections-string-keys-test

Add a test for reflection keys as Strings, fixes #16928
  • Loading branch information...
guilleiguaran committed Nov 24, 2014
2 parents c837259 + be8d1a9 commit 9fc198e6c3f32e6479c4338da8b7499db676ad5d
Showing with 4 additions and 0 deletions.
  1. +4 −0 activerecord/test/cases/reflection_test.rb
@@ -209,6 +209,10 @@ def test_reflection_should_not_raise_error_when_compared_to_other_object
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

0 comments on commit 9fc198e

Please sign in to comment.