简体   繁体   中英

Errno::EACCES: Permission denied @ unlink_internal when running rake test:models

I'm playing with rails 4. I just created very simple test for my model but when I try to execute "rake test:models" I get following error:

C:\rails\project>rake test:models
DL is deprecated, please use Fiddle
rake aborted!
Errno::EACCES: Permission denied @ unlink_internal - /tmp/db/new.sqlite3
C:/rails/project/test/test_helper.rb:3:in `<top (required)>'
C:/rails/project/test/models/admin_test.rb:1:in `<top (required)>'
Tasks: TOP => test:models
(See full trace by running task with --trace)

My test database configuration looks as follows:

test:
  adapter: sqlite3
  database: /tmp/db/new.sqlite3
  pool: 5
  timeout: 5000

"/tmp/db" is directory where I have full access on my personal laptop.

Any ideas what could be source of this problem?

One way I was able to get around this error was using

rake db:migrate rails_env=test

This generated the necessary migrations on my test.sqlite3

I believe the default setting for rails_env is "dev" but this may vary. I am still very new to rails but I hope this helps.

I had the same problem with my test.sqlite3 table and what worked for me was making a copy of my development.sqlite3 table and renaming it test.sqlite3 . I hope this works for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM