Where are those tables listed for fixtures?

I’m sorry if this is posted in wrong forum. I am new to all of this with
rails and rspec.

Something got messed up when I changed a table’s name from ‘works’ to
‘work_periods’. Now the fixture:load thing does not work. Obviously the
old table is still in there in some file.

Anyone have any idea on where to find that file? Where does rspec read
all tables when it deletes table-entries?

rake db:fixtures:load

rake aborted!
Mysql::Error: #42S02Table ‘db_development.works’ doesn’t exist: DELETE FROM works

Do you still have “works.yml” in your fixtures/ directory? If so
you’ll need to rename that to “work_periods.yml”.

Zach

On Fri, Oct 17, 2008 at 2:46 PM, Rasmus R. [email protected]
wrote:

http://rubyforge.org/mailman/listinfo/rspec-users


Zach D.
http://www.continuousthinking.com

Zach D. wrote:

Do you still have “works.yml” in your fixtures/ directory? If so
you’ll need to rename that to “work_periods.yml”.

Zach

On Fri, Oct 17, 2008 at 2:46 PM, Rasmus R. [email protected]
wrote:

http://rubyforge.org/mailman/listinfo/rspec-users


Zach D.
http://www.continuousthinking.com
http://www.mutuallyhuman.com

Nope, but I really wished it was this simple. (it probably is!) I cannot
find any traces from “works” or “Work” anywhere in whole project.

I found the file in rspec that prints the msg:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.6/lib/active_record/fixtures.rb.
Perhaps there is a clever way to redefine that class to get more
tracing?

On 2008-10-17, at 14:46, Rasmus R. wrote:

all tables when it deletes table-entries?

rake db:fixtures:load

rake aborted!
Mysql::Error: #42S02Table ‘db_development.works’ doesn’t exist:
DELETE FROM works

Hi Rasmus. Have you grepped through your application for “works”, and
looked for all files named “works”? Eg:

$ grep -rni ‘works’ /path/to/app/
$ find /path/to/app/ -iname ‘works

Hope that helps,
Nick

On Fri, Oct 17, 2008 at 2:46 PM, Rasmus R. [email protected]
wrote:

Something got messed up when I changed a table’s name from ‘works’ to
‘work_periods’. Now the fixture:load thing does not work. Obviously the
old table is still in there in some file.

Dumb question, but did you clone or re-migrate your test database
after you made this change?

This trips me up all the time. I’ll do something clever with the
database, run db:migrate, and totally forget that that doesn’t update
the test environment, just development. Then my specs fail and I
freak out.


Have Fun,
Steve E. ([email protected])
ESCAPE POD - The Science Fiction Podcast Magazine
http://www.escapepod.org

Rasmus R. wrote:

Zach D. wrote:

Do you still have “works.yml” in your fixtures/ directory? If so
you’ll need to rename that to “work_periods.yml”.

Zach, you are right, there is another fixture under “test”. I only
searched in “spec”-dir.

And I am in the wrong forum :slight_smile:

Guess the yaml’s are placed under test because i ran generators with
“model” instead of “spec_model”

this feels like a duplication. If I write rspec-tests I should not do
ordinary tests, because then I need to maintain two fixtures. Right?

On Fri, Oct 17, 2008 at 3:42 PM, Stephen E. [email protected] wrote:

database, run db:migrate, and totally forget that that doesn’t update
the test environment, just development. Then my specs fail and I
freak out.

I use this command line alias after I write a migration:

alias tmig=‘rake db:migrate && rake db:rollback && rake db:migrate
&& rake db:test:prepare’

It makes sure that I can migrate up and down for the migration I just
wrote, and it will make sure the test database is prepared.

Zach

http://rubyforge.org/mailman/listinfo/rspec-users


Zach D.
http://www.continuousthinking.com

On Fri, Oct 17, 2008 at 3:28 PM, Rasmus R. [email protected]
wrote:

this feels like a duplication. If I write rspec-tests I should not do
ordinary tests, because then I need to maintain two fixtures. Right?

Correct. You don’t need it. But the standard Rails generator doesn’t
know that you’re sneaking around on it with RSpec, so it keeps putting
boxes of chocolates in your /test directory hoping you’ll pay more
attention to it and never knowing why you don’t come home. It’s quite
touching, really. Maybe even a little poignant.


Have Fun,
Steve E. ([email protected])
ESCAPE POD - The Science Fiction Podcast Magazine
http://www.escapepod.org

Stephen E. wrote:

On Fri, Oct 17, 2008 at 3:28 PM, Rasmus R. [email protected]
wrote:

this feels like a duplication. If I write rspec-tests I should not do
ordinary tests, because then I need to maintain two fixtures. Right?

Correct. You don’t need it. But the standard Rails generator doesn’t
know that you’re sneaking around on it with RSpec, so it keeps putting
boxes of chocolates in your /test directory hoping you’ll pay more
attention to it and never knowing why you don’t come home. It’s quite
touching, really. Maybe even a little poignant.


Have Fun,
Steve E. ([email protected])
ESCAPE POD - The Science Fiction Podcast Magazine
http://www.escapepod.org

That is a very nice way of putting it. Guess I still got some pending
feelings for rails. Those scripts are evil! :slight_smile: Also, they are no good
when practicing TDD IMO. Again, only rookie impressions…

On Fri, Oct 17, 2008 at 12:51 PM, Zach D. [email protected]
wrote:

alias tmig=‘rake db:migrate && rake db:rollback && rake db:migrate
&& rake db:test:prepare’

Sounds good. Nice to see someone paying attention to their downs as well
as
their ups.

rake db:migrate:redo will do the rollback + the re-migration in one
step,
saving some time.

///ar