Problem with test_truth

hello all,

i have a problem with test_truth.

require 'test_helper'

class MyDataTest < ActiveSupport::TestCase def test_truth   assert true end

end

this should ok without failures or errors. but it failure:

1) Error: test_truth(MyDataTest): ActiveRecord::StatementInvalid: Mysql::Error: Table 'alldataserver_test.members' doesn't exist: DELETE FROM `members`

whats here wrong? i understand table members is not exist in alldataserver_test, but
why? here is a mistake with migration i think, can someone help me?

it means that there is a fixtures file called members.yml so rails
helpfully tries to load it into your test database but there is no
such table.

Fred

Hello Guy wrote:

thanks, i know, in test database are not tables. my question is: why are not the tables for test database create? i did database migration and it creates only tables for development database but not for my test database. where can be the problem?

I find the rake db:migrate commands to be less than comprehensive here. Sometimes one rake command understands testing, but another one does not.

In this case, I always find myself entering:

   rake RAILS_ENV=test db:migrate

That uses rake's ability to push its command line options with = into environmental variables. Then the migrator uses the test: version in database.yml.

Also try db:reset, or db:migrate:reset.

Hello Guy wrote: > thanks, i know, in test database are not tables. my question is: why are > not > the tables for test database create? > i did database migration and it creates only tables for development > database but > not for my test database. where can be the problem?

I find the rake db:migrate commands to be less than comprehensive here. Sometimes one rake command understands testing, but another one does not.

If you run

rake

to run your unit tests, that should clone the structure from the development database to the test one.

Fred

Frederick Cheung wrote:

If you run

rake

to run your unit tests, that should clone the structure from the development database to the test one.

Fred

Hello Philip and Fred,

i use netbeans6.5 and i don't know how i can enter rake RAILS_ENV=test db:migrate

but i try db:migrate:reset and it reset tables on development but in test are nothing with tables :(((

i do the whole time run "rake", but the effect is what i tell :(((

i will tell you, this problem appearance when i checkout the project from svn repository, perhaps this is a good information for you to help me.

Hello,

ok it works :)))))) there are tables in my test database :)))) there are the right tables :)))))

i think .... :((

if i run the unit test   def test_truth     assert true   end

there is one error: 1) Error: test_truth(MyDataTest): ActiveRecord::StatementInvalid: Mysql::Error: Unknown column 'mydata' in 'field list': INSERT INTO `members` (`person_id`, `created_at`, `updated_at`, `mydata`, `id`, `mydata_id`) VALUES (1, '2009-02-22 18:00:49', '2009-02-22 18:00:49', 'verein1', 238752903, 4)

where does this column come from? i look at my database and there is no column witch call 'mydata'. also it is not in schema.rb

hmpf :(((

Frederick Cheung wrote:

I find the rake db:migrate commands to be less than comprehensive here. Sometimes one rake command understands testing, but another one does not.

If you run

rake

to run your unit tests, that should clone the structure from the development database to the test one.

Maybe we do the trick too often where we add a migration, then run the one test waiting for it. That resolves to:

  ruby test/unit/foo_test.rb -n test_bar

...which utterly bypasses all rake scripts.

But our projects are old, so their scripts might not be well tuned.

Then I don't know what the OP's real problem is, but 'rake RAILS_ENV=test db:migrate' is well-worth a shot!

Hello Guy wrote:

i use netbeans6.5 and i don't know how i can enter rake RAILS_ENV=test db:migrate

You cannot do Rails without learning and frequently using a command line. Either CMD.EXE or bash - pick your poison!

test_truth(MyDataTest): ActiveRecord::StatementInvalid: Mysql::Error: Unknown column 'mydata' in 'field list': INSERT INTO `members` (`person_id`, `created_at`, `updated_at`, `mydata`, `id`, `mydata_id`) VALUES (1, '2009-02-22 18:00:49', '2009-02-22 18:00:49', 'verein1', 238752903, 4)

where does this column come from?

test/fixtures/members.yml

Phlip wrote:

test_truth(MyDataTest): ActiveRecord::StatementInvalid: Mysql::Error: Unknown column 'mydata' in 'field list': INSERT INTO `members` (`person_id`, `created_at`, `updated_at`, `mydata`, `id`, `mydata_id`) VALUES (1, '2009-02-22 18:00:49', '2009-02-22 18:00:49', 'verein1', 238752903, 4)

where does this column come from?

test/fixtures/members.yml

THANK YOU SOOOO MUCH!!!

it works great :)))) im so happy :))))