aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/relations_test.rb
diff options
context:
space:
mode:
authorIain Hecker <iain@iain.nl>2011-03-19 21:53:49 +0100
committerAaron Patterson <aaron.patterson@gmail.com>2011-03-21 10:29:45 -0700
commit96b9fc44000e5f40ba463ff0e893db8c4fd33b85 (patch)
tree6fdf2a555cbd362033e900b01756b03a8ea4261b /activerecord/test/cases/relations_test.rb
parent55bf087da1d93eda93f9b9632fc363fd4788bed2 (diff)
downloadrails-96b9fc44000e5f40ba463ff0e893db8c4fd33b85.tar.gz
rails-96b9fc44000e5f40ba463ff0e893db8c4fd33b85.tar.bz2
rails-96b9fc44000e5f40ba463ff0e893db8c4fd33b85.zip
Reapply extensions when using except and only
Diffstat (limited to 'activerecord/test/cases/relations_test.rb')
-rw-r--r--activerecord/test/cases/relations_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb
index 00b7c26080..f0e483b6bc 100644
--- a/activerecord/test/cases/relations_test.rb
+++ b/activerecord/test/cases/relations_test.rb
@@ -797,6 +797,10 @@ class RelationTest < ActiveRecord::TestCase
assert_equal Post.all, all_posts.all
end
+ def test_extensions_with_except
+ assert_equal 2, Topic.named_extension.order(:author_name).except(:order).two
+ end
+
def test_only
relation = Post.where(:author_id => 1).order('id ASC').limit(1)
assert_equal [posts(:welcome)], relation.all
@@ -808,6 +812,10 @@ class RelationTest < ActiveRecord::TestCase
assert_equal Post.limit(1).all.first, all_posts.first
end
+ def test_extensions_with_only
+ assert_equal 2, Topic.named_extension.order(:author_name).only(:order).two
+ end
+
def test_anonymous_extension
relation = Post.where(:author_id => 1).order('id ASC').extending do
def author