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: 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? - Elliot Temple www.curi.us -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Oct 12, 1:28 pm, Elliot Temple <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> 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> - Elliot Templewww.curi.us > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jeff Cohen wrote:> On Oct 12, 1:28 pm, Elliot Temple <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: >> 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).I understand having a sanity check, but I don''t understand failing *quietly*, so you get an error later and elsewhere b/c a variable wasn''t initialized b/c the setup just returned.> 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.The thing is: it works when I trick it. It is loading active record and connecting to the database, and the fixtures are loading data into the database and the tests pass -- all with the configurations blank. Here''s some relevant code. Maybe the establish_connection call is improper? cause it''s using the db config but without activerecord getting fully clued in. require ''active_record'' require ''active_record/fixtures'' config_location = File.dirname(__FILE__) + ''/database.yml'' config = YAML::load(IO.read(config_location)) ActiveRecord::Base.establish_connection(config[ENV[''DB''] || ''mysql'']) - Elliot www.curi.us -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---