Permalink
Browse files

Make sure ActiveRecord tests can run individually. Closes #11425 [the…

…chrisoshow, h-lame]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9109 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
lifo committed Mar 28, 2008
1 parent c62db05 commit 533da24bbce5c6eeb23ff372fa0b65911fc138d0
@@ -25,7 +25,7 @@ Rake can be found at http://rake.rubyforge.org
Unit tests are located in test/cases directory. If you only want to run a single test suite,
you can do so with:
- rake test_mysql TEST=base_test.rb
+ rake test_mysql TEST=test/cases/base_test.rb
That'll run the base suite using the MySQL-Ruby adapter.
@@ -13,7 +13,7 @@
class EagerAssociationTest < ActiveRecord::TestCase
fixtures :posts, :comments, :authors, :categories, :categories_posts,
:companies, :accounts, :tags, :taggings, :people, :readers,
- :owners, :pets
+ :owners, :pets, :author_favorites
def test_loading_with_one_association
posts = Post.find(:all, :include => :comments)
@@ -1328,7 +1328,7 @@ def test_find_all_include_over_the_same_table_for_through
class BelongsToAssociationsTest < ActiveRecord::TestCase
fixtures :accounts, :companies, :developers, :projects, :topics,
- :developers_projects, :computers, :authors, :posts, :tags, :taggings
+ :developers_projects, :computers, :authors, :posts, :tags, :taggings, :comments
def test_belongs_to
Client.find(3).firm.name
@@ -1,6 +1,8 @@
require "cases/helper"
+require 'models/author'
require 'models/topic'
require 'models/reply'
+require 'models/category'
require 'models/company'
require 'models/customer'
require 'models/developer'
@@ -11,6 +13,7 @@
require 'models/subscriber'
require 'models/keyboard'
require 'models/post'
+require 'models/comment'
require 'models/minimalistic'
require 'models/warehouse_thing'
require 'rexml/document'
@@ -72,7 +75,7 @@ class TopicWithProtectedContentAndAccessibleAuthorName < ActiveRecord::Base
end
class BasicsTest < ActiveRecord::TestCase
- fixtures :topics, :companies, :developers, :projects, :computers, :accounts, :minimalistics, 'warehouse-things'
+ fixtures :topics, :companies, :developers, :projects, :computers, :accounts, :minimalistics, 'warehouse-things', :authors
def test_table_exists
assert !NonExistentTable.table_exists?
@@ -358,6 +358,9 @@ def test_number2
class SetTableNameFixturesTest < ActiveRecord::TestCase
set_fixture_class :funny_jokes => 'Joke'
fixtures :funny_jokes
+ # Set to false to blow away fixtures cache and ensure our fixtures are loaded
+ # and thus takes into account our set_fixture_class
+ self.use_transactional_fixtures = false
def test_table_method
assert_kind_of Joke, funny_jokes(:a_joke)
@@ -367,6 +370,9 @@ def test_table_method
class CustomConnectionFixturesTest < ActiveRecord::TestCase
set_fixture_class :courses => Course
fixtures :courses
+ # Set to false to blow away fixtures cache and ensure our fixtures are loaded
+ # and thus takes into account our set_fixture_class
+ self.use_transactional_fixtures = false
def test_connection
assert_kind_of Course, courses(:ruby)
@@ -376,6 +382,9 @@ def test_connection
class InvalidTableNameFixturesTest < ActiveRecord::TestCase
fixtures :funny_jokes
+ # Set to false to blow away fixtures cache and ensure our fixtures are loaded
+ # and thus takes into account our lack of set_fixture_class
+ self.use_transactional_fixtures = false
def test_raises_error
assert_raises FixtureClassNotFound do
@@ -387,6 +396,9 @@ def test_raises_error
class CheckEscapedYamlFixturesTest < ActiveRecord::TestCase
set_fixture_class :funny_jokes => 'Joke'
fixtures :funny_jokes
+ # Set to false to blow away fixtures cache and ensure our fixtures are loaded
+ # and thus takes into account our set_fixture_class
+ self.use_transactional_fixtures = false
def test_proper_escaped_fixture
assert_equal "The \\n Aristocrats\nAte the candy\n", funny_jokes(:another_joke).name

0 comments on commit 533da24

Please sign in to comment.