Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails : Rake Test:functionals cannot access DB (Sqlite3 on winXP)

I am unable to run rake test:functionals with SQLite3, it gives me this error :

rake aborted!
Permission denied - db/test.sqlite

(See full trace by running task with --trace)

My setup is on Windows XP. Tests were working a few weeks ago. Rails 2.3.2, Rake 0.8.7, sqlite3-ruby 1.2.5 gems

I am using Netbeans for development, but even when it's close I cannot run the test from a command prompt.

I also checked that no handles to test.sqlite are open (through the sysinternals task manager).

I checked the permissions, they are ok.

I tried to delete the file and recreate it, or copy to another filename without any luck either.

I tried running the command as soon as my computer is booted.

Any help is appreciated.

Thanks

like image 530
user62605 Avatar asked Aug 05 '09 16:08

user62605


3 Answers

I just had this issue. For me, it was caused by me having my rails console opened in a test environment. Closed my session and it no longer threw the error.

like image 74
erictheavg Avatar answered Sep 20 '22 08:09

erictheavg


Very, very similar behavior on my part: Windows XP, SQLite3, Rails 2.3.4, Rake 0.8.7, Ruby 1.8.6

rake test

works (but I don't believe it's actually running the unit test)

rake test:units

and

rake test:functionals

both fail with a "Permission denied - db/test.sqlite3" With --trace enabled the specific error occurs at ../rails-2.3.4/lib/task/databases.rake:370 at a line that reads "File.delete(dbfile) if File.exist?(dbfile)

So... long story short... I commented it out.

This is NOT a fix, but it was enough of a hack to get the tests to work for me.

like image 33
GSP Avatar answered Sep 18 '22 08:09

GSP


If you're running under Cygwin, try running this on your database files:

chmod 777 <your-files>

Cygwin can become confused about what permissions should be applied.

Yes I know these permissions are ridiculous, but so is Cygwin sometimes...

like image 40
Jason Cohen Avatar answered Sep 22 '22 08:09

Jason Cohen