My test are not resetting for each method in the test class.
It was promised to me on page 146 of Agile Web Development on Rails that
it would.
Am I doing something wrong? The "@delete_victim = User.find(4)" bust
the setup class each time it comes around, even though that is in my
users.yml
class UserTest < Test::Unit::TestCase
fixtures :users
def setup
@chris_logged_in = User.new({:username =>
''cwinslett'', :password
=> ''testpassword''})
@chris_logged_in = @chris_logged_in.try_to_login
@sherri = User.find(2)
@delete_victim = User.find(4)
end
# Replace this with your real tests.
def test_truth
assert_kind_of User, @chris_logged_in
assert_kind_of User, @sherri
assert_kind_of User, @investor
end
def test_destroy
@delete_victim.destroy
assert_raise(ActiveRecord::RecordNotFound){User.find(@delete_victim.id)}
end
def test_create_user
@tom_lawyer = User.new
@tom_lawyer.username = "tlawyer"
@tom_lawyer.password = "i<3lawyers"
@tom_lawyer.email = "tlawyer@harbert.net"
@tom_lawyer.first_name = "Tom"
@tom_lawyer.last_name = "Lawyer"
assert @tom_lawyer.save, @tom_lawyer.errors.full_messages.join(";
")
@tom_lawyer = User.new({:username => "tlawyer",
:password
=> "i<3lawyers"})
@tom_lawyer = @tom_lawyer.try_to_login
assert_equal "a6e29adca96aac7c85275792c7562e85",
@tom_lawyer.hashed_password
end
end
--
Posted via http://www.ruby-forum.com/.