aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/reflection_test.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2010-10-31 11:21:28 +0000
committerJon Leighton <j@jonathanleighton.com>2010-10-31 11:21:28 +0000
commit9a1a32ac2b8a526f543367bc7e8258bbd7e6a164 (patch)
treea14e5d2b8d0b9f34766a91d3bac9bf78b445eb51 /activerecord/test/cases/reflection_test.rb
parentd010fb13ef622bdb781e3134005fc849db4c9bea (diff)
downloadrails-9a1a32ac2b8a526f543367bc7e8258bbd7e6a164.tar.gz
rails-9a1a32ac2b8a526f543367bc7e8258bbd7e6a164.tar.bz2
rails-9a1a32ac2b8a526f543367bc7e8258bbd7e6a164.zip
Fix naughty trailing whitespace
Diffstat (limited to 'activerecord/test/cases/reflection_test.rb')
-rw-r--r--activerecord/test/cases/reflection_test.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/activerecord/test/cases/reflection_test.rb b/activerecord/test/cases/reflection_test.rb
index a85ba623e1..66fe754046 100644
--- a/activerecord/test/cases/reflection_test.rb
+++ b/activerecord/test/cases/reflection_test.rb
@@ -200,7 +200,7 @@ class ReflectionTest < ActiveRecord::TestCase
def test_has_many_through_reflection
assert_kind_of ThroughReflection, Subscriber.reflect_on_association(:books)
end
-
+
def test_through_reflection_chain
expected = [
Author.reflect_on_association(:essay_categories),
@@ -208,10 +208,10 @@ class ReflectionTest < ActiveRecord::TestCase
Organization.reflect_on_association(:authors)
]
actual = Organization.reflect_on_association(:author_essay_categories).through_reflection_chain
-
+
assert_equal expected, actual
end
-
+
def test_through_conditions
expected = [
["tags.name = 'Blue'"],
@@ -220,7 +220,7 @@ class ReflectionTest < ActiveRecord::TestCase
]
actual = Author.reflect_on_association(:misc_post_first_blue_tags).through_conditions
assert_equal expected, actual
-
+
expected = [
["tags.name = 'Blue'", "taggings.comment = 'first'", "posts.title LIKE 'misc post%'"],
[],
@@ -229,27 +229,27 @@ class ReflectionTest < ActiveRecord::TestCase
actual = Author.reflect_on_association(:misc_post_first_blue_tags_2).through_conditions
assert_equal expected, actual
end
-
+
def test_nested?
assert !Author.reflect_on_association(:comments).nested?
assert Author.reflect_on_association(:tags).nested?
-
+
# Only goes :through once, but the through_reflection is a has_and_belongs_to_many, so this is
# a nested through association
assert Category.reflect_on_association(:post_comments).nested?
end
-
+
def test_association_primary_key
# Normal association
assert_equal "id", Author.reflect_on_association(:posts).association_primary_key.to_s
assert_equal "name", Author.reflect_on_association(:essay).association_primary_key.to_s
-
+
# Through association (uses the :primary_key option from the source reflection)
assert_equal "nick", Author.reflect_on_association(:subscribers).association_primary_key.to_s
assert_equal "name", Author.reflect_on_association(:essay_category).association_primary_key.to_s
assert_equal "custom_primary_key", Author.reflect_on_association(:tags_with_primary_key).association_primary_key.to_s # nested
end
-
+
def test_active_record_primary_key
assert_equal "nick", Subscriber.reflect_on_association(:subscriptions).active_record_primary_key.to_s
assert_equal "name", Author.reflect_on_association(:essay).active_record_primary_key.to_s