aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/associations_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-05-18 02:11:43 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-05-18 02:11:43 +0000
commite48b062eed430eea43ca94630310e9a7d663cf03 (patch)
tree75070ecf9f9c8b7bdc6372ca1cd386fb8c228023 /activerecord/test/associations_test.rb
parenta56081d99ab056859679a92fb8f4a95e02bb6b5c (diff)
downloadrails-e48b062eed430eea43ca94630310e9a7d663cf03.tar.gz
rails-e48b062eed430eea43ca94630310e9a7d663cf03.tar.bz2
rails-e48b062eed430eea43ca94630310e9a7d663cf03.zip
Sanitize Base#inspect. Closes #8392.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6761 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/associations_test.rb')
-rwxr-xr-xactiverecord/test/associations_test.rb33
1 files changed, 1 insertions, 32 deletions
diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb
index aec6a47583..8f60fc95f1 100755
--- a/activerecord/test/associations_test.rb
+++ b/activerecord/test/associations_test.rb
@@ -93,43 +93,12 @@ class AssociationProxyTest < Test::Unit::TestCase
def test_push_does_not_load_target
david = authors(:david)
- not_loaded_string = '<categories not loaded yet>'
- not_loaded_re = Regexp.new(not_loaded_string)
david.categories << categories(:technology)
- assert_match not_loaded_re, david.inspect
- assert_equal not_loaded_string, david.categories.inspect
+ assert !david.categories.loaded?
assert david.categories.include?(categories(:technology))
end
- def test_inspect_does_not_load_target
- david = authors(:david)
- not_loaded_string = '<posts not loaded yet>'
- not_loaded_re = Regexp.new(not_loaded_string)
-
- 2.times do
- assert !david.posts.loaded?, "Posts should not be loaded yet"
- assert_match not_loaded_re, david.inspect
- assert_equal not_loaded_string, david.posts.inspect
-
- assert !david.posts.empty?, "There should be more than one post"
- assert !david.posts.loaded?, "Posts should still not be loaded yet"
- assert_match not_loaded_re, david.inspect
- assert_equal not_loaded_string, david.posts.inspect
-
- assert !david.posts.find(:all).empty?, "There should be more than one post"
- assert !david.posts.loaded?, "Posts should still not be loaded yet"
- assert_match not_loaded_re, david.inspect
- assert_equal not_loaded_string, david.posts.inspect
-
- assert !david.posts(true).empty?, "There should be more than one post"
- assert david.posts.loaded?, "Posts should be loaded now"
- assert_no_match not_loaded_re, david.inspect
- assert_not_equal not_loaded_string, david.posts.inspect
-
- david.reload
- end
- end
end
class HasOneAssociationsTest < Test::Unit::TestCase