title: bundle exec rake test:models throws Errno::EACCES: Permission denied
body: <p>I am doing the draft version of the <a href="http://draft.railstutorial.org" rel="nofollow">railstutorial</a>, when I try to run <code>bundle exec rake test:models</code> I get this error message:</p>
  
  <pre><code>rake aborted!
  Errno::EACCES: Permission denied - C:/Users/Alex/Desktop/Workspace/Rails/sample_
  app/db/test.sqlite3
  C:/Users/Alex/Desktop/Workspace/Rails/sample_app/test/test_helper.rb:3:in `&lt;top
  (required)&gt;'
  C:/Users/Alex/Desktop/Workspace/Rails/sample_app/test/helpers/application_helper
  _test.rb:1:in `&lt;top (required)&gt;'
  Tasks: TOP =&gt; test:run =&gt; test:units
  (See full trace by running task with --trace)
  </code></pre>
  
  <p>With --trace:</p>
  
  <pre><code>** Invoke test (first_time)
  ** Execute test
  ** Invoke test:run (first_time)
  ** Invoke test:units (first_time)
  ** Invoke test:prepare (first_time)
  ** Execute test:prepare
  ** Execute test:units
  rake aborted!
  Errno::EACCES: Permission denied - C:/Users/Alex/Desktop/Workspace/Rails/sample_
  app/db/test.sqlite3
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/fileutils.rb:1432:in `unlink'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/fileutils.rb:1432:in `block in remove
  _file'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/fileutils.rb:1440:in `platform_suppor
  t'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/fileutils.rb:1431:in `remove_file'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/fileutils.rb:785:in `remove_file'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/fileutils.rb:563:in `block in rm'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/fileutils.rb:562:in `each'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/fileutils.rb:562:in `rm'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta1/li
  b/active_record/tasks/sqlite_database_tasks.rb:22:in `drop'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta1/li
  b/active_record/tasks/sqlite_database_tasks.rb:26:in `purge'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta1/li
  b/active_record/tasks/database_tasks.rb:159:in `purge'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta1/li
  b/active_record/tasks/database_tasks.rb:201:in `load_schema_for'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta1/li
  b/active_record/tasks/database_tasks.rb:216:in `block in load_schema_current'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta1/li
  b/active_record/tasks/database_tasks.rb:255:in `block in each_current_configurat
  ion'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta1/li
  b/active_record/tasks/database_tasks.rb:254:in `each'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta1/li
  b/active_record/tasks/database_tasks.rb:254:in `each_current_configuration'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta1/li
  b/active_record/tasks/database_tasks.rb:215:in `load_schema_current'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta1/li
  b/active_record/migration.rb:402:in `load_schema_if_pending!'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta1/li
  b/active_record/migration.rb:409:in `block in maintain_test_schema!'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta1/li
  b/active_record/migration.rb:637:in `suppress_messages'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta1/li
  b/active_record/migration.rb:414:in `method_missing'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activerecord-4.2.0.beta1/li
  b/active_record/migration.rb:409:in `maintain_test_schema!'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.0.beta1/lib/ra
  ils/test_help.rb:19:in `&lt;top (required)&gt;'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0.beta1/l
  ib/active_support/dependencies.rb:248:in `require'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0.beta1/l
  ib/active_support/dependencies.rb:248:in `block in require'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0.beta1/l
  ib/active_support/dependencies.rb:233:in `load_dependency'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0.beta1/l
  ib/active_support/dependencies.rb:248:in `require'
  C:/Users/Alex/Desktop/Workspace/Rails/sample_app/test/test_helper.rb:3:in `&lt;top
  (required)&gt;'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0.beta1/l
  ib/active_support/dependencies.rb:248:in `require'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0.beta1/l
  ib/active_support/dependencies.rb:248:in `block in require'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0.beta1/l
  ib/active_support/dependencies.rb:233:in `load_dependency'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0.beta1/l
  ib/active_support/dependencies.rb:248:in `require'
  C:/Users/Alex/Desktop/Workspace/Rails/sample_app/test/helpers/application_helper
  _test.rb:1:in `&lt;top (required)&gt;'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0.beta1/l
  ib/active_support/dependencies.rb:248:in `require'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0.beta1/l
  ib/active_support/dependencies.rb:248:in `block in require'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0.beta1/l
  ib/active_support/dependencies.rb:233:in `load_dependency'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.2.0.beta1/l
  ib/active_support/dependencies.rb:248:in `require'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.0.beta1/lib/ra
  ils/test_unit/sub_test_task.rb:114:in `block (3 levels) in define'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.0.beta1/lib/ra
  ils/test_unit/sub_test_task.rb:114:in `each'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.0.beta1/lib/ra
  ils/test_unit/sub_test_task.rb:114:in `block (2 levels) in define'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.0.beta1/lib/ra
  ils/test_unit/sub_test_task.rb:113:in `each'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.0.beta1/lib/ra
  ils/test_unit/sub_test_task.rb:113:in `block in define'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/task.r
  b:240:in `call'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/task.r
  b:240:in `block in execute'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/task.r
  b:235:in `each'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/task.r
  b:235:in `execute'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/task.r
  b:179:in `block in invoke_with_call_chain'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/task.r
  b:172:in `invoke_with_call_chain'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/task.r
  b:201:in `block in invoke_prerequisites'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/task.r
  b:199:in `each'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/task.r
  b:199:in `invoke_prerequisites'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/task.r
  b:178:in `block in invoke_with_call_chain'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/task.r
  b:172:in `invoke_with_call_chain'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/task.r
  b:165:in `invoke'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.0.beta1/lib/ra
  ils/test_unit/sub_test_task.rb:20:in `invoke_rake_task'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.2.0.beta1/lib/ra
  ils/test_unit/testing.rake:8:in `block in &lt;top (required)&gt;'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/task.r
  b:240:in `call'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/task.r
  b:240:in `block in execute'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/task.r
  b:235:in `each'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/task.r
  b:235:in `execute'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/task.r
  b:179:in `block in invoke_with_call_chain'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/task.r
  b:172:in `invoke_with_call_chain'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/task.r
  b:165:in `invoke'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/applic
  ation.rb:150:in `invoke_task'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/applic
  ation.rb:106:in `block (2 levels) in top_level'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/applic
  ation.rb:106:in `each'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/applic
  ation.rb:106:in `block in top_level'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/applic
  ation.rb:115:in `run_with_threads'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/applic
  ation.rb:100:in `top_level'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/applic
  ation.rb:78:in `block in run'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/applic
  ation.rb:176:in `standard_exception_handling'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/lib/rake/applic
  ation.rb:75:in `run'
  C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rake-10.3.2/bin/rake:33:in
  `&lt;top (required)&gt;'
  C:/RailsInstaller/Ruby2.0.0/bin/rake:23:in `load'
  C:/RailsInstaller/Ruby2.0.0/bin/rake:23:in `&lt;main&gt;'
  Tasks: TOP =&gt; test:run =&gt; test:units
  </code></pre>
  
  <p>I have tried checking the permissions on my db folder, and also tried to restart everything. I am using rails version 4.2.0beta1 on windows. The problem started when I made the "User" model. I tried rolling back and migrating up again as well.</p>
  
  <p>Edit:
  It seems that my test database is corrupted in some way. If I change the /config/database.yml test: to /db/development.sqlite the tests work.</p>