This project is archived and is in readonly mode.

#1177 ✓ invalid
Leon Bogaert

rails test doesn't load initializers when unit testing

Reported by Leon Bogaert | October 5th, 2008 @ 11:26 PM | in 2.x

I've got some custom inflection rules. One is for 'merk', it lives in 'initialializers/inflections.rb':

ActiveSupport::Inflector.inflections do |inflect| inflect.irregular 'merk', 'merken' end

But when I run rake test:units, I get an error:

test_truth(BrandstofTest): ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: merks: DELETE FROM "merks" WHERE 1=1

So, I think the custom inflection rules aren't loaded during these unit tests. However, if I go into 'script/console test', these rules work fine!

'merk'.pluralize => "merken"

Merk.delete_all => 0

Merk.table_name => "merken"

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Tickets have moved to Github

The new ticket tracker is available at https://github.com/rails/rails/issues

Shared Ticket Bins

People watching this ticket

Pages