mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Make sure ActiveRecord tests can run individually. Closes #11425 [thechrisoshow, h-lame]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9109 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -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 @@ require 'models/pet'
|
||||
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 @@ end
|
||||
|
||||
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/column_name'
|
||||
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 @@ end
|
||||
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 @@ end
|
||||
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 @@ end
|
||||
|
||||
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 @@ end
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user