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:
parent
18b13d768f
commit
4c615a53e0
1 changed files with 2 additions and 0 deletions
|
@ -795,11 +795,13 @@ class CalculationsTest < ActiveRecord::TestCase
|
||||||
|
|
||||||
def test_pick_one
|
def test_pick_one
|
||||||
assert_equal "The First Topic", Topic.order(:id).pick(:heading)
|
assert_equal "The First Topic", Topic.order(:id).pick(:heading)
|
||||||
|
assert_nil Topic.none.pick(:heading)
|
||||||
assert_nil Topic.where("1=0").pick(:heading)
|
assert_nil Topic.where("1=0").pick(:heading)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_pick_two
|
def test_pick_two
|
||||||
assert_equal ["David", "david@loudthinking.com"], Topic.order(:id).pick(:author_name, :author_email_address)
|
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)
|
assert_nil Topic.where("1=0").pick(:author_name, :author_email_address)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue