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

匿名 (未验证) 提交于 2019-12-03 02:00:02

问题:

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 `' C:/rails/project/test/models/admin_test.rb:1:in `' 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?

回答1:

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.



回答2:

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.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!