Forum: Ruby on Rails Test not Reseting

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Chris W. (Guest)
on 2006-05-04 02:10
My test are not resetting for each method in the test class.

It was promised to me on page 146 of Agile Web D. 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

class UserTest < Test::Unit::TestCase
  fixtures :users

  def setup
    @chris_logged_in    ={:username => 'cwinslett', :password
=> 'testpassword'})
    @chris_logged_in    = @chris_logged_in.try_to_login
    @sherri             = User.find(2)
    @delete_victim      = User.find(4)

  # 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

  def test_destroy

  def test_create_user
    @tom_lawyer            =
    @tom_lawyer.username   = "tlawyer"
    @tom_lawyer.password   = "i<3lawyers"      = "removed_email_address@domain.invalid"
    @tom_lawyer.first_name = "Tom"
    @tom_lawyer.last_name  = "Lawyer"
    assert, @tom_lawyer.errors.full_messages.join("; ")
    @tom_lawyer            ={:username => "tlawyer", :password
=> "i<3lawyers"})
    @tom_lawyer            = @tom_lawyer.try_to_login
    assert_equal "a6e29adca96aac7c85275792c7562e85",
Jakob S. (Guest)
on 2006-05-05 16:11
(Received via mailing list)
Chris W. wrote:
> My test are not resetting for each method in the test class.

You're probably running a DB without transaction support, let me
guess... MySQL on MyISAM tables?

Either move to a DB/table-engine that supports transactions or turn off
transaction-based testing in test/test_helper.rb.
This topic is locked and can not be replied to.