aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorwangjohn <wangjohn@mit.edu>2013-02-19 14:36:42 -0500
committerwangjohn <wangjohn@mit.edu>2013-02-20 10:53:25 -0500
commitd49f862b9a6877f02d6fbf90f276a345abfa4372 (patch)
tree446855c56bbebc67ee9e812ceb4c44e447be63e8 /activerecord/test
parent3a0b6c8e135e268c1550f93db1b63ba27457dec2 (diff)
downloadrails-d49f862b9a6877f02d6fbf90f276a345abfa4372.tar.gz
rails-d49f862b9a6877f02d6fbf90f276a345abfa4372.tar.bz2
rails-d49f862b9a6877f02d6fbf90f276a345abfa4372.zip
Added comments about the check_empty_arguments method which is called
for query methods in a where_clause. Also, modified the CHANGELOG entry because it had false information and added tests.
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/relations_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb
index 379c0c0758..8298d7534c 100644
--- a/activerecord/test/cases/relations_test.rb
+++ b/activerecord/test/cases/relations_test.rb
@@ -321,6 +321,22 @@ class RelationTest < ActiveRecord::TestCase
assert_equal 1, person_with_reader_and_post.size
end
+ def test_no_arguments_to_query_methods_raise_errors
+ assert_raises(ArgumentError) { Topic.references() }
+ assert_raises(ArgumentError) { Topic.includes() }
+ assert_raises(ArgumentError) { Topic.preload() }
+ assert_raises(ArgumentError) { Topic.group() }
+ assert_raises(ArgumentError) { Topic.reorder() }
+ end
+
+ def test_blank_like_arguments_to_query_methods_dont_raise_errors
+ assert_nothing_raised { Topic.references([]) }
+ assert_nothing_raised { Topic.includes([]) }
+ assert_nothing_raised { Topic.preload([]) }
+ assert_nothing_raised { Topic.group([]) }
+ assert_nothing_raised { Topic.reorder([]) }
+ end
+
def test_scoped_responds_to_delegated_methods
relation = Topic.all