> Just spent a good bit of time trying to figure out why I couldn't get > fixtures to work in a plugin test. I was including > ActiveRecord::TestFixtures into ActiveSupport::TestCase and trying to get > fixtures to automatically reload for every test like regular Rails tests.
ActiveSupport::TestCase *does* have fixtures support, I'm not sure what you're trying to get done here? > The problem was in the first line of > ActiveRecord::TestFixtures.setup_fixtures: > return unless defined?(ActiveRecord) && > !ActiveRecord::Base.configurations.blank? > > This causes setup_fixtures to silently return without doing anything if you > call ActiveRecord::Base.establish_connection directly without setting > ActiveRecord::Base.configurations. The method doesn't appear to actually use > the configurations. > > Is there some reason for this behavior? It appears like it should be removed > to me, but if it is there for a reason, maybe it can be documented that > populating configurations is a prerequisite to using fixtures in plugins. This is to avoid breaking people trying to use ActiveSupport::TestCase subclasses without active record configured in their application, we could change that logic to support your case where you've connected manually, but due to how things are laid out there'll still need to be some short-circuiting behaviour to avoid a bunch of misleading errors. > I am using 2.3.5 but it appears to still be the case in edge. > > Jack > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. > > -- Cheers Koz -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
