Ah, yes, that's the problem. I assumed that all the generated fixtures would be empty but I see now that Rails created some test data. And this data was from when I originally generated my models (since changed).
And I see now that, according to my Rails Unit Testing Guide: "Rails by default automatically loads all fixtures from the test/fixtures folder for your unit and functional test" So I see it was trying to populate the db with the old table. On Mar 29, 2:34 pm, Frederick Cheung <[email protected]> wrote: > On 29 Mar 2011, at 19:06, LennonR <[email protected]> wrote: > > > > > > > > > > > Hello, I'm new to Rails 3 and its unit testing capabilities. > > > I've created a simple unit test just to see if I could get it to run > > correctly: > > > class CaseTest < ActiveSupport::TestCase > > # Replace this with your real tests. > > test "the truth" do > > assert_equal 2,2 > > end > > end > > > But when I run that test with: ruby -I test test/unit/case_test.rb, it > > appears to be calling that unit test but is getting a Postgres > > insertion error on a model that I've changed awhile ago (I removed the > > column 'title' awhile ago and migrated which has been working fine for > > me in my development environment): > > > 1.) Error: > > test_the_truth(CaseTest): > > ActiveRecord::StatementInvalid: PGError: ERROR: column "title" of > > relation "questions" does not exist > > LINE 1: INSERT INTO "questions" ("title", "body", "created_at", > > "upd... > > > I have two questions. > > > First, why is it even attempting to insert a new question when I'm > > just trying to test if 2 is the same as 2? > > Second, given that it is trying to insert a question for some reason, > > why is it using outdated model info? > > > Thanks for any help you can give. > > Do you have a fixtures file that is being loaded automatically? > > Fred > > > > > > > > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Ruby on Rails: Talk" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group > > athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

