Added transactional fixtures that uses rollback to undo changes to fixtures instead of DELETE/INSERT -- it's much faster. See documentation under Fixtures #760 [bitsweat]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@846 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson
2005-03-06 13:51:55 +00:00
parent 0ceab8114c
commit 903ef71b99
3 changed files with 139 additions and 29 deletions

View File

@@ -105,5 +105,34 @@ class FixturesTest < Test::Unit::TestCase
def test_empty_csv_fixtures
assert_not_nil Fixtures.new( Account.connection, "accounts", File.dirname(__FILE__) + "/fixtures/naked/csv/accounts")
end
end
class FixturesWithoutInstantiationTest < Test::Unit::TestCase
self.use_instantiated_fixtures = false
fixtures :topics, :developers, :accounts
def test_without_complete_instantiation
assert_nil @topics
assert_nil @first
end
def test_fixtures_from_root_yml_without_instantiation
assert_nil @unknown
end
end
class TransactionalFixturesTest < Test::Unit::TestCase
self.use_transactional_fixtures = true
fixtures :topics
def test_destroy
assert_not_nil @first
@first.destroy
end
def test_destroy_just_kidding
assert_not_nil @first
end
end