From c59e902671ebf8443a90a2dbed08e98e1a642ebb Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 2 Nov 2013 20:05:23 -0700 Subject: Add test verifying that you can only sort ARs of the same type --- activerecord/test/cases/base_test.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index d598eac26a..cdcc0062b1 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -554,13 +554,19 @@ class BasicsTest < ActiveRecord::TestCase 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') -- cgit v1.2.3