Help with Test


#1

Hi,

I created a rails project named ‘Hi’. I didn’t do anything in it
except

  1. Rails Hi
  2. Ruby script/generate controller hi

thats it.

Now I went to Test\funcational folder and run the
Hi_controller_test.rb and I am getting 2 MySql Error even though I am
not using MySql in this project at all.

Could some one tell me what am I doing wrong?

Thanks.


#2

Rails uses a database by default. If you look in config/database.yml,
you’ll
see what Rails is trying to connect to.

Jason


#3

On Jun 11, 11:08 am, “Jason R.” removed_email_address@domain.invalid wrote:

Hi_controller_test.rb and I am getting 2 MySql Error even though I am
not using MySql in this project at all.

Could some one tell me what am I doing wrong?

Thanks.- Hide quoted text -

  • Show quoted text -

Thanks and yes I did find the database.yml where when I entered valid
database information it worked. But my question is, what if I am
writing a program which doesn’t use database at all, how can I exclude
the mysql from my testing instead of creating a dummy database.


#4

You need to hack Rails itself. I submitted a patch that allows doing
this by
just removing database.yml:

http://dev.rubyonrails.org/ticket/7949

though as it’s yet to be accepted you’ll have to apply the patch
yourself.

Jason


#5

On Jun 11, 11:31 am, “Jason R.” removed_email_address@domain.invalid wrote:

Thanks and yes I did find the database.yml where when I entered valid
database information it worked. But my question is, what if I am
writing a program which doesn’t use database at all, how can I exclude
the mysql from my testing instead of creating a dummy database.- Hide quoted text -

  • Show quoted text -
    Excellent. Thanks for the info, thats what i was looking for.

#6

Good to hear, now if we could just get it committed into Rails
itself…

Jason


#7

On Jun 11, 11:34 am, DBC User removed_email_address@domain.invalid wrote:

Thanks and yes I did find the database.yml where when I entered valid
database information it worked. But my question is, what if I am
writing a program which doesn’t use database at all, how can I exclude
the mysql from my testing instead of creating a dummy database.- Hide quoted text -

  • Show quoted text -

Excellent. Thanks for the info, thats what i was looking for.- Hide quoted text -

  • Show quoted text -

Yes I applied the patch is working excellent.
Thanks.