Ruby on Rails Tuesday, March 29, 2011

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.

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment