1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add test to make sure pick works in a NullRelation

This commit is contained in:
Rafael Mendonça França 2018-02-12 15:15:16 -05:00
parent 18b13d768f
commit 4c615a53e0

View file

@ -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