In my efforts to upgrade our site from 2.1.0 to 3.0.x, I have upgraded to 2.2.2 and the site works, but I am working on understanding tests, fixtures and the whole deal. So realizing that upgrading really means testing, what I actually did was look the schema.rb file for our 2.1.0 site and then created a blank Rails 2.2.2 site and used scaffold (gasp) to generate a fully baked model, controller, view, and tests that had the same fields. My table is job_posts and the corresponding unit test was job_post_test.rb
So, two questions. When I compare the two I see differences in the structure. Our current 2.1.0 site test had the following: require File.dirname(__FILE__) + '/../test_helper'
class JobPostTest < Test::Unit::TestCase fixtures :job_posts
# Replace this with your real tests. def test_truth assert true end end
So, I go over the freshly minted, empty 2.2.2 app and look at the test created when I scaffolded and saw: require 'test_helper'
class JobPostTest < ActiveSupport::TestCase # Replace this with your real tests. test "the truth" do assert true end end
Is some of this because the default test syntax has changed? Is there a way to re-create the unit tests in my older app? Basically, tell Rails to overwrite the older unit tests and create new ones that match the tables in the schema.rb? I understand the default tests don't do much, but I would like to start with a clean slate since I don't think our sites tests have much in them anyway.