I am doing the draft version of the railstutorial, when I try to run bundle exec rake test:models
I get this error message:
rake aborted!
Errno:
I deleted the old test.sqlite3 and replaced it with a copy of development.sqlite3 and renamed it test.sqlite3, this seems to have solved the problem.
I noticed this happens if I have one terminal open running the rails server and another terminal to work on. My work Terminal is what gives me the issue when I try to drop or reset a database. I close the server ans try again and it works fine.
Run rake db:migrate RAILS_ENV=test
before running the tests.
I'm not a rails expert, so I don't know if the test DB should be migrated automatically when migrating the development DB, but this will migrate it, and it resolved my similar problem.
Note: My OS is Windows 8.1
Yes, the issue is with Windows. when you read the code for fileutils.rb found in railsinstaller directory. It wants to unlink and want to give permission 700(which is found in unix/linux) but not in windows. so will not work.
Here is the snippet from the fileutil.rb file.
def remove_file
platform_support {
File.unlink path
}
end
def platform_support
return yield unless fu_windows?
first_time_p = true
begin
yield
rescue Errno::ENOENT
raise
rescue => err
if first_time_p
first_time_p = false
begin
File.chmod 0700, path() # Windows does not have symlink
retry
rescue SystemCallError
end
end
raise err
end
end