# Rspec error

**URL:** <https://www.ruby-forum.com/t/rspec-error/162893>\
**Category:** Rails\
**Created:** [March 15, 2009, 6:35am UTC](https://www.ruby-forum.com/t/rspec-error/162893 "2009-03-15T06:35:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![grayson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/c77e96/32.png) [@grayson](https://www.ruby-forum.com/u/grayson)\
**Post date:** [March 15, 2009, 6:35am UTC](https://www.ruby-forum.com/t/rspec-error/162893/1 "2009-03-15T06:35:01Z")

</div>

Hello,

I’m getting the following error when I run

rake spec --trace

Seems a little too deep in the stack for me to figure it out.

Thanks,

GP

\*\* Invoke spec (first\_time)  
\*\* Invoke db:test:prepare (first\_time)  
\*\* Invoke db:abort\_if\_pending\_migrations (first\_time)  
\*\* Invoke environment (first\_time)  
\*\* Execute environment  
\*\* Execute db:abort\_if\_pending\_migrations  
\*\* Execute db:test:prepare  
\*\* Invoke db:test:load (first\_time)  
\*\* Invoke db:test:purge (first\_time)  
\*\* Invoke environment  
\*\* Execute db:test:purge  
\*\* Execute db:test:load  
\*\* Invoke db:schema:load (first\_time)  
\*\* Invoke environment  
\*\* Execute db:schema:load  
rake aborted!  
closed stream  
c:/ruby/lib/ruby/1.8/mysql.rb:1032:in `sync=' c:/ruby/lib/ruby/1.8/mysql.rb:1032:in`write’  
c:/ruby/lib/ruby/1.8/mysql.rb:1092:in `finalizer' c:/ruby/lib/ruby/1.8/mysql.rb:578:in`call’  
c:/ruby/lib/ruby/1.8/mysql.rb:578:in `start' c:/ruby/lib/ruby/1.8/mysql.rb:578:in`free’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active\_record/connection\_a  
dapters/mysql\_adapter.rb:304:in `select_rows' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_a dapters/abstract/database_statements.rb:27:in`select\_values’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active\_record/connection\_a  
dapters/abstract/schema\_statements.rb:343:in  
`assume_migrated_upto_version' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb :346:in`send’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active\_record/migration.rb  
:346:in `method_missing' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb :326:in`say\_with\_time’  
c:/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/migration.rb :326:in`say\_with\_time’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active\_record/migration.rb  
:342:in `method_missing' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/schema.rb:47 :in`define’  
D:/joytorrent/mobenabler/db/schema.rb:12  
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active\_support/dependenci  
es.rb:142:in `load_without_new_constant_marking' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependenci es.rb:142:in`load’  
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active\_support/dependenci  
es.rb:521:in `new_constants_in' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependenci es.rb:142:in`load’  
c:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake:253  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in `call' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in`execute’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in `each' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in`execute’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:578:in  
`invoke_with_call_c hain' c:/ruby/lib/ruby/1.8/monitor.rb:242:in`synchronize’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:in  
`invoke_with_call_c hain' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:564:in`invoke’  
c:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake:298  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in `call' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in`execute’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in `each' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in`execute’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:578:in  
`invoke_with_call_c hain' c:/ruby/lib/ruby/1.8/monitor.rb:242:in`synchronize’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:in  
`invoke_with_call_c hain' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:564:in`invoke’  
c:/ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/databases.rake:372  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in `call' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in`execute’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in `each' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in`execute’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:578:in  
`invoke_with_call_c hain' c:/ruby/lib/ruby/1.8/monitor.rb:242:in`synchronize’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:in  
`invoke_with_call_c hain' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:588:in`invoke\_prerequisit  
es’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:585:in `each' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:585:in`invoke\_prerequisit  
es’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:577:in  
`invoke_with_call_c hain' c:/ruby/lib/ruby/1.8/monitor.rb:242:in`synchronize’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:in  
`invoke_with_call_c hain' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:564:in`invoke’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2027:in  
`invoke_task' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in`top\_level’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in `each' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in`top\_level’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in  
`standard_exceptio n_handling' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1999:in`top\_level’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1977:in `run' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in`standard\_exceptio  
n\_handling’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1974:in `run' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.4/bin/rake:31 c:/ruby/bin/rake:19:in`load’  
c:/ruby/bin/rake:19

---

<div class="post-metadata">

**Author:** ![grayson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/c77e96/32.png) [@grayson](https://www.ruby-forum.com/u/grayson)\
**Post date:** [March 15, 2009, 12:33pm UTC](https://www.ruby-forum.com/t/rspec-error/162893/2 "2009-03-15T12:33:58Z")

</div>

seems there is a problem with your database or its schema. did you  
configure your database.yml correctly for your test-db?

check whether you can access that db with given username/password.  
also check if there are migrations pending or sth like it.

are you able to access test-db with  
script/console test  
?

try to get into your console (test-env) and create a new instance of  
one of your models and save it to see whether your database-  
connnection is working properly.

---

<div class="post-metadata">

**Author:** ![grayson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/c77e96/32.png) [@grayson](https://www.ruby-forum.com/u/grayson)\
**Post date:** [April 7, 2009, 9:16am UTC](https://www.ruby-forum.com/t/rspec-error/162893/3 "2009-04-07T09:16:51Z")

</div>

Hello,

I have exactly the same problem, did you find a way to solve it ?

I can access my database with script/console in the test environment.  
I can run rake db:migrate in the test environment,  
and I can insert datas in my database through the console.

Many thanks
