Indika K
Indika K

Reputation: 1414

rake db:test:prepare does not setup test database

I am using Rails 4.0.0.rc1 with sqlite3 and trying to setup the test database for testing. bundle exec rake db:test:prepare did not create the tables in the test database. After following this question I managed to setup the test database by running 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.

Below is the output of the 2 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 is like this.

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 was solved. But I am curious to know what had gone wrong.

Upvotes: 4

Views: 5417

Answers (1)

sugaryourcoffee
sugaryourcoffee

Reputation: 879

rake db:migrate RAILS_ENV=test works with Ruby 2.0.0 and Rails 4.0.0.rc1 rake db:test:prepare for some reason doesn't work with the new versions.

Upvotes: 2

Related Questions