The error:
Errno::ETXTBSY: Text file busy @ unlink_internal - /home/vagrant/shared/sample_app/db/test.sqlite3
/home/vagrant/shared/sample_app/test/test_helper.rb:3:in <top (required)>'
/home/vagrant/shared/sample_app/test/helpers/static_pages_helper_test.rb:1:in
'
Tasks: TOP => test:run => test:units
(See full trace by running task with --trace)
Workaround:
The error was related to Vagrant (or VirtualBox) custom shared folders. I couldn't figure out how to solve it, but there is a workaround. Instead of working with a vagrant custom shared folder (~/shared/sample_app), defined in the vagrantfile I moved the app folder to a standard shared folder inside the VM root (/vagrant). Now I still get the file sync in my host machine and the issue is gone.
UPDATE 1
Reached another conclusion today. Everytime
bundle exec rake db:migrate
orrails generate migration
is executed the error will return.Another Workaround
1 - Delete the test.sqlite3 file.
2 - Copy the development.sqlite3 file
3 - Paste and change the name to test.sqlite3
* - Just migrated for testing and this seems to be a permanent solution.
Move the database files outside vagrant share, for example to /tmp.
edit database.yml: