diff options
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/relation/where_test.rb | 6 | ||||
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/test/cases/relation/where_test.rb b/activerecord/test/cases/relation/where_test.rb index c3a1471205..399a4dbbf1 100644 --- a/activerecord/test/cases/relation/where_test.rb +++ b/activerecord/test/cases/relation/where_test.rb @@ -302,5 +302,11 @@ module ActiveRecord assert_raises(ActiveModel::ForbiddenAttributesError) { Author.where(params) } assert_equal author, Author.where(params.permit!).first end + + def test_where_with_unsupported_arguments + author = authors(:david) + + assert_raises(ArgumentError) { Author.where(42) } + end end end diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 8256762f96..7521f0573a 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -1541,6 +1541,13 @@ class RelationTest < ActiveRecord::TestCase assert_equal 'David', topic2.reload.author_name end + def test_update_on_relation_passing_active_record_object_is_deprecated + topic = Topic.create!(title: 'Foo', author_name: nil) + assert_deprecated(/update/) do + Topic.where(id: topic.id).update(topic, title: 'Bar') + end + end + def test_distinct tag1 = Tag.create(:name => 'Foo') tag2 = Tag.create(:name => 'Foo') |