Using the current File.expand_path(config[:database]), @default_dir will be set to a path of application_root_dir/db which is fine in a typical rails application. However when developing an engine, the database for the dummy app, e.g. spec/dummy/config/database.yml has the same config as above the result of which is that @default_dir is still set application_root_dir/db whereas the app expects to find sqlite3 files in application_root_dir/{test,spec}/dummy/db. Switching to Rails.root solves this issue and does not affect a 'standard' rails app
This is about changing the value of @default_dir to support a {test,spec}/dummy path in an engine. Given an out of the box config/database.yml of:
Using the current
File.expand_path(config[:database])
,@default_dir
will be set to a path ofapplication_root_dir/db
which is fine in a typical rails application. However when developing an engine, the database for the dummy app, e.g.spec/dummy/config/database.yml
has the same config as above the result of which is that@default_dir
is still setapplication_root_dir/db
whereas the app expects to find sqlite3 files inapplication_root_dir/{test,spec}/dummy/db
. Switching toRails.root
solves this issue and does not affect a 'standard' rails app