From 903ef71b9952f4bfaef798bbd93a972fc25010ad Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 6 Mar 2005 13:51:55 +0000 Subject: 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 --- activerecord/test/fixtures_test.rb | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'activerecord/test') diff --git a/activerecord/test/fixtures_test.rb b/activerecord/test/fixtures_test.rb index 4c450eb3cf..c83b4babf5 100755 --- a/activerecord/test/fixtures_test.rb +++ b/activerecord/test/fixtures_test.rb @@ -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 -- cgit v1.2.3