aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2010-01-03 19:42:29 +0530
committerPratik Naik <pratiknaik@gmail.com>2010-01-03 19:43:29 +0530
commitaf5e1b4cc6fd3ae5f5e175751373a5e60934385b (patch)
tree3c044df83a27526741ba33084c991ad013f37eb0 /activerecord/test/cases
parent22bfd8b09804db28e05e598e062d58fd2ab36485 (diff)
downloadrails-af5e1b4cc6fd3ae5f5e175751373a5e60934385b.tar.gz
rails-af5e1b4cc6fd3ae5f5e175751373a5e60934385b.tar.bz2
rails-af5e1b4cc6fd3ae5f5e175751373a5e60934385b.zip
Add Relation#except
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/relations_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb
index 7046420ebd..bcecf74737 100644
--- a/activerecord/test/cases/relations_test.rb
+++ b/activerecord/test/cases/relations_test.rb
@@ -539,4 +539,16 @@ class RelationTest < ActiveRecord::TestCase
assert ! hen.new_record?
assert_equal 'hen', hen.name
end
+
+ def test_except
+ relation = Post.where(:author_id => 1).order('id ASC').limit(1)
+ assert_equal [posts(:welcome)], relation.all
+
+ author_posts = relation.except(:order, :limit)
+ assert_equal Post.where(:author_id => 1).all, author_posts.all
+
+ all_posts = relation.except(:where, :order, :limit)
+ assert_equal Post.all, all_posts.all
+ end
+
end