Why does Rails do this?

i was trying to run tests for the sentry plugin and they failed when using fixtures

activerecord's fixtures.rb reads:

      def setup_with_fixtures         return unless defined?(ActiveRecord::Base) && !ActiveRecord::Base.configurations.blank?

This quietly fails to setup fixtures, causing errors later and elsewhere when you try to use a fixture. Not fun to track down. i got sentry's tests to run by adding:

Fixtures are for loading test data into your test database. The code here is doing a basic sanity check: first, that ActiveRecord is defined in your project (should be) and that the database configurations have been loaded (from database.yml).

ActiveRecord::Base.configurations[:nothing] = true

if that works, why check for blank config? apparently none is necessary. alternatively, if blank config is an error, shouldn't Rails raise something instead of ignore it?

You've put something in there to make the sanity check "think" you've configured the database, but you really haven't.

Sounds like your plugin is being loaded before the Rails has had a chance to initialize - that's the real problem here.

Hope this helps Jeff

softiesonrails.com essentialrails.com