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
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?
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.
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.
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.
That is a very nice way of putting it. Guess I still got some pending
feelings for rails. Those scripts are evil! Also, they are no good
when practicing TDD IMO. Again, only rookie impressions…