Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I get a "database does not exist error" when running unit tests

Every time I run the command:

rake test test/models/post_test.rb test_the_truth

I get the following error:

`initialize': FATAL:  database "knome_test" does not exist (PG::Error).

Can someone explain and help me to debug it?

like image 267
manish kumar Avatar asked Jun 05 '26 13:06

manish kumar


1 Answers

It sounds like you have not created the database.

Try running the following to create, migrate, then prepare your test database.

rake db:create
rake db:migrate
rake db:test:prepare
like image 66
Mohamad Avatar answered Jun 10 '26 19:06

Mohamad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!