diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2018-02-12 15:15:16 -0500 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2018-02-12 15:15:16 -0500 |
commit | 4c615a53e0409ddddf13d48cbc328a22d0026ed2 (patch) | |
tree | b09ead2e0832f564028c4289b3c1cab0b87d97a6 /activerecord/test | |
parent | 18b13d768fc1ecb8a209c9b1d3c1ddcfe27e3737 (diff) | |
download | rails-4c615a53e0409ddddf13d48cbc328a22d0026ed2.tar.gz rails-4c615a53e0409ddddf13d48cbc328a22d0026ed2.tar.bz2 rails-4c615a53e0409ddddf13d48cbc328a22d0026ed2.zip |
Add test to make sure pick works in a NullRelation
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/calculations_test.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb index ec8bc913a1..0828d6b58f 100644 --- a/activerecord/test/cases/calculations_test.rb +++ b/activerecord/test/cases/calculations_test.rb @@ -795,11 +795,13 @@ class CalculationsTest < ActiveRecord::TestCase def test_pick_one assert_equal "The First Topic", Topic.order(:id).pick(:heading) + assert_nil Topic.none.pick(:heading) assert_nil Topic.where("1=0").pick(:heading) end def test_pick_two assert_equal ["David", "david@loudthinking.com"], Topic.order(:id).pick(:author_name, :author_email_address) + assert_nil Topic.none.pick(:author_name, :author_email_address) assert_nil Topic.where("1=0").pick(:author_name, :author_email_address) end |