This project is archived and is in readonly mode.
rails test doesn't load initializers when unit testing
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"
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>