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"