Permalink
Browse files

Add test verifying that you can only sort ARs of the same type

  • Loading branch information...
1 parent 430b252 commit c59e902671ebf8443a90a2dbed08e98e1a642ebb @dhh dhh committed Nov 3, 2013
Showing with 7 additions and 1 deletion.
  1. +7 −1 activerecord/test/cases/base_test.rb
@@ -554,13 +554,19 @@ def test_hashing
assert_equal [ Topic.find(1) ], [ Topic.find(2).topic ] & [ Topic.find(1) ]
end
- def test_comparison
+ def test_successful_comparison_of_like_class_records
topic_1 = Topic.create!
topic_2 = Topic.create!
assert_equal [topic_2, topic_1].sort, [topic_1, topic_2]
end
+ def test_failed_comparison_of_unlike_class_records
+ assert_raises ArgumentError do
+ [ topics(:first), posts(:welcome) ].sort
+ end
+ end
+
def test_create_without_prepared_statement
topic = Topic.connection.unprepared_statement do
Topic.create(:title => 'foo')

0 comments on commit c59e902

Please sign in to comment.