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

See https://github.com/rails/rails/issues/17119 for the back story.
There's no need to call `assert_nothing_raised` ; actually it will only yield the content of the given block so we try to avoid to use it. You can simply write `association.class_name.constantize` inside your `#each` block.