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

See https://github.com/rails/rails/issues/17119 for the back story.
I'm sure we can think of a way to test this without ObjectSpace. :-/ walking all classes in ObjectSpace seems a bit extreme.

--
Aaron Patterson
http://tenderlovemaking.com/
I'm on an iPhone so I apologize for top posting.

> On Oct 9, 2014, at 9:31 AM, Abdelkader Boudih <notifications@github.com> wrote:
> 
> In activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb:
> 
> > @@ -883,4 +887,15 @@ def test_redefine_habtm
> >      child.special_projects << SpecialProject.new("name" => "Special Project")
> >      assert child.save, 'child object should be saved'
> >    end
> > +
> > +  def test_reflections_do_not_have_nonexistent_constants_as_class_names
> > +    refute_nil Developer._reflections['shared_computers']
> > +    # Checking the fixture for named association is important here, because it's the only way
> > +    # we've been able to reproduce one of the 2 parts of this bug
> > +    refute_nil File.read(File.expand_path("../../../fixtures/developers.yml", __FILE__)).index("shared_computers")
> > +    Developer._reflections.values.each do |association|
> > +      constant = ObjectSpace.each_object(Class).detect{|c| c.to_s == association.class_name }
> we can't have failing jruby test in travis. We either have to turn on ObjectSpace or skip this test in jruby.
> 
> cc @senny @jeremy @tenderlove @rafaelfranca
> 
> \
> Reply to this email directly or view it on GitHub.