# Test:prepare failure with enum columns

**URL:** <https://www.ruby-forum.com/t/test-prepare-failure-with-enum-columns/138561>\
**Category:** Rails\
**Created:** [May 24, 2008, 7:14pm UTC](https://www.ruby-forum.com/t/test-prepare-failure-with-enum-columns/138561 "2008-05-24T19:14:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![marmolin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/71e660/32.png) [@marmolin](https://www.ruby-forum.com/u/marmolin)\
**Post date:** [May 24, 2008, 7:14pm UTC](https://www.ruby-forum.com/t/test-prepare-failure-with-enum-columns/138561/1 "2008-05-24T19:14:42Z")

</div>

Hi,  
I have a MySQL database that I use with my Rails application. I  
attempted to use “rake db:test:prepare” to create a test database. (Very  
cool, feature, by the way.) I then get the error

rake aborted!  
You have a nil object when you didn’t expect it!  
You might have expected an instance of Array.  
The error occured while evaluating nil.[]

After some search I learned that the schema dump cannot handle e.g. enum  
columns. There is an old ticket #2379 about it but it seems not to have  
been implemented in 2.0. ( I am using a Imac and textmate)

I also found another solution  
([http://snippets.dzone.com/posts/show/2031](http://snippets.dzone.com/posts/show/2031)) using a rake file that I  
called test\_prepare.rake and put in lib/tasks/test\_prepare.rake, but  
when I used the rake command I got the message  
Don’t know how to build task ‘test\_prepare’

The question is now how to create a test database??  
When I tried just to use the development database it complained about  
that there was no test database configured. I tried several other rake  
commands but they all complained about the nil object or missing  
configuration ?

How to go on with the testing ??? Thanks in advance. /Hans

---

<div class="post-metadata">

**Author:** ![marmolin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/71e660/32.png) [@marmolin](https://www.ruby-forum.com/u/marmolin)\
**Post date:** [May 24, 2008, 8:11pm UTC](https://www.ruby-forum.com/t/test-prepare-failure-with-enum-columns/138561/2 "2008-05-24T20:11:01Z")

</div>

> The question is now how to create a test database??

Can you create an empty database by hand, in MySQL, then migrate-in your  
schema with

```
rake RAILS_ENV=test db:migrate

```

?

---

<div class="post-metadata">

**Author:** ![marmolin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/71e660/32.png) [@marmolin](https://www.ruby-forum.com/u/marmolin)\
**Post date:** [May 25, 2008, 9:58am UTC](https://www.ruby-forum.com/t/test-prepare-failure-with-enum-columns/138561/3 "2008-05-25T09:58:53Z")

</div>

Phlip wrote:

> > The question is now how to create a test database??
> 
> Can you create an empty database by hand, in MySQL, then migrate-in your  
> schema with
> 
> ```
> rake RAILS_ENV=test db:migrate
> 
> ```
> 
> ?

Thanks, it seems that your advice solved the problem. I had to do some  
other corrections as I had a blank before the database name in my  
configuration file and I had not init a constant in a plugin I not yet  
use.

But then rake RAILS\_ENV=test db:migrate created a test data base and I  
can now start the testings

Thanks again
