Ensure HABTM relationships produce valid class names (Fixes #17119)

See https://github.com/rails/rails/issues/17119 for the back story.
Thanks for the feedback. I'll remove it, but I preferred it because it makes the intent more clear. I would hate to see the test removed in the future because it doesn't appear to be testing anything. Perhaps the comments are enough.