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.