-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add regression tests for keys on nested associations #15999
Add regression tests for keys on nested associations #15999
Conversation
@@ -412,6 +412,26 @@ def test_join_table_can_be_overridden | |||
assert_equal 'product_categories', reflection.join_table | |||
end | |||
|
|||
def test_reflection_association_accepts_symbols_as_keys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test name reads strangely to me. Is there a name we can use that better expresses what we're testing? Alternatively, can we test this at a more granular level to make it clearer that what is described in the test name is actually what we're testing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate what you mean by test at a more granular level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test_includes_accepts_strings
test_includes_accepts_symbols
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And by test at a more granular level, I meant actually passing a string or symbol to the reflection method in question, if that's what we want to test.
This adds the regressions tests from issue rails#15893 to master. It's checking that both strings and symbols are accepted as keys for nested associations.
@sgrif I changed the name of the first tests tests and added tests specifically for |
…eys-on-nested-associations Add regression tests for keys on nested associations
@eileencodes I agree completely. Lower level will give the failure I'd want to see if I change this later, higher level helps inform me where it's used so I know where to look if I change the behavior. |
This adds the regressions tests from PR #15893 to master. It's checking that both strings and symbols are accepted as keys for nested associations.