aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-03-06 13:51:55 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-03-06 13:51:55 +0000
commit903ef71b9952f4bfaef798bbd93a972fc25010ad (patch)
tree3f9e94b102efbd42ad5ec4f04dafef49deb2116f /activerecord/test
parent0ceab8114cb5d8f38d8d30136eaffdd7bff4ede1 (diff)
downloadrails-903ef71b9952f4bfaef798bbd93a972fc25010ad.tar.gz
rails-903ef71b9952f4bfaef798bbd93a972fc25010ad.tar.bz2
rails-903ef71b9952f4bfaef798bbd93a972fc25010ad.zip
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
Diffstat (limited to 'activerecord/test')
-rwxr-xr-xactiverecord/test/fixtures_test.rb31
1 files changed, 30 insertions, 1 deletions
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