Rake db: test: prepare does not install test database

I am using Rails 4.0.0.rc1 with sqlite3 and am trying to set up a test database for testing. bundle exec rake db:test:prepare did not create tables in the test database. After completing this question, I was able to configure the test database by running bundle exec rake db:schema:load RAILS_ENV=test -t What is the reason for the bundle exec rake db:test:prepare task so as not to install the database.

Below is the result of two rake tasks.

 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$ 

The database configuration in database.yaml as follows.

 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 

Please note that my problem is resolved. But I'm curious to see what went wrong.

+4
source share
1 answer

rake db:migrate RAILS_ENV=test works with Ruby 2.0.0 and Rails 4.0.0.rc1 rake db: test: preparation for some reason does not work with new versions.

+2
source

Source: https://habr.com/ru/post/1481591/


All Articles