Rails 4.0.0.rc1 と sqlite3 を使用しており、テスト用にテスト データベースをセットアップしようとしています。bundle exec rake db:test:prepare
テスト データベースにテーブルを作成しませんでした。この質問に従った後、 bundle exec rake db:schema:load RAILS_ENV=test -t
What can be the reason for task bundle exec rake db:test:prepare
to not to setup the database を実行してテスト データベースをセットアップできました。
以下は、2 つの rake タスクの出力です。
indika@indika-F3E:~/Documents/my_app$ bundle exec rake db:test:prepare -t
** Invoke db:test:prepare (first_time)
** Execute db:test:prepare
indika@indika-F3E:~/Documents/my_app$
indika@indika-F3E:~/Documents/my_app$ bundle exec rake db:schema:load RAILS_ENV=test -t
** Invoke db:schema:load (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:schema:load
-- create_table("questions", {:force=>true})
-> 0.2590s
-- initialize_schema_migrations_table()
-> 0.0025s
-- assume_migrated_upto_version(20130518181153, ["/home/indika/Documents/my_app/db/migrate"])
-> 0.0007s
indika@indika-F3E:~/Documents/my_app$
でのデータベース構成database.yaml
はこんな感じ。
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
test: &test
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
cucumber:
<<: *test
私の問題は解決したことに注意してください。しかし、何がうまくいかなかったのか知りたいです。