aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-02-27 05:14:57 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-02-27 05:14:57 +0000
commit91247b61672c3d136682870558e5068f4c7195f0 (patch)
treed5abf90c733e952af64795e5666783924ca9c037 /activerecord/test
parentadccb319e27190a3a90d321db1141a057aec1d38 (diff)
downloadrails-91247b61672c3d136682870558e5068f4c7195f0.tar.gz
rails-91247b61672c3d136682870558e5068f4c7195f0.tar.bz2
rails-91247b61672c3d136682870558e5068f4c7195f0.zip
Added that fixtures to placed in subdirectories of the main fixture files are also loaded (closes #3937) [dblack@wobblini.net]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3683 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test')
-rwxr-xr-xactiverecord/test/fixtures_test.rb19
-rw-r--r--activerecord/test/method_scoping_test.rb2
2 files changed, 19 insertions, 2 deletions
diff --git a/activerecord/test/fixtures_test.rb b/activerecord/test/fixtures_test.rb
index 19664d2d34..29f7b886a9 100755
--- a/activerecord/test/fixtures_test.rb
+++ b/activerecord/test/fixtures_test.rb
@@ -9,7 +9,7 @@ class FixturesTest < Test::Unit::TestCase
self.use_instantiated_fixtures = true
self.use_transactional_fixtures = false
- fixtures :topics, :developers, :accounts, :tasks
+ fixtures :topics, :developers, :accounts, :tasks, :categories
FIXTURES = %w( accounts companies customers
developers developers_projects entrants
@@ -170,6 +170,23 @@ class FixturesTest < Test::Unit::TestCase
end
end
end
+
+ def test_non_yml_file_in_subdirectory
+ assert_equal(categories(:sub_special_1).name, "A special category")
+ assert_equal(categories(:sub_special_1).class, SpecialCategory)
+ end
+
+ def test_yml_file_in_subdirectory
+ assert_equal(categories(:sub_special_3).name, "A special category in a .yml file")
+ assert_equal(categories(:sub_special_3).class, SpecialCategory)
+ end
+
+ def test_subsubdir_file_with_arbitrary_name
+ assert_equal(categories(:sub_special_5).name, "A special category in an arbitrarily named subsubdir file")
+ assert_equal(categories(:sub_special_5).class, SpecialCategory)
+ end
+
+
end
if Account.connection.respond_to?(:reset_pk_sequence!)
diff --git a/activerecord/test/method_scoping_test.rb b/activerecord/test/method_scoping_test.rb
index 8c547e1435..d95fc1dcc8 100644
--- a/activerecord/test/method_scoping_test.rb
+++ b/activerecord/test/method_scoping_test.rb
@@ -295,7 +295,7 @@ class HasAndBelongsToManyScopingTest< Test::Unit::TestCase
end
def test_forwarding_to_dynamic_finders
- assert_equal 1, Category.find_all_by_type('SpecialCategory').size
+ assert_equal 6, Category.find_all_by_type('SpecialCategory').size
assert_equal 0, @welcome.categories.find_all_by_type('SpecialCategory').size
assert_equal 2, @welcome.categories.find_all_by_type('Category').size
end