diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-11-28 01:48:33 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2018-11-28 01:48:33 +0900 |
commit | ba4e68f577efc76f351d30a2914e29942b97830e (patch) | |
tree | 9e81b17082652ccfff3d1900bcb18025a625b9a1 /activerecord/test/cases/associations/belongs_to_associations_test.rb | |
parent | 93c94973ab574083a8cd1868aae03993ca156c34 (diff) | |
download | rails-ba4e68f577efc76f351d30a2914e29942b97830e.tar.gz rails-ba4e68f577efc76f351d30a2914e29942b97830e.tar.bz2 rails-ba4e68f577efc76f351d30a2914e29942b97830e.zip |
Ensure that singular association should execute limited query
Diffstat (limited to 'activerecord/test/cases/associations/belongs_to_associations_test.rb')
-rw-r--r-- | activerecord/test/cases/associations/belongs_to_associations_test.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb index 93dd427951..c1a335bda8 100644 --- a/activerecord/test/cases/associations/belongs_to_associations_test.rb +++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb @@ -32,9 +32,12 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase :posts, :tags, :taggings, :comments, :sponsors, :members def test_belongs_to - firm = Client.find(3).firm - assert_not_nil firm - assert_equal companies(:first_firm).name, firm.name + client = Client.find(3) + assert_sql(/LIMIT|ROWNUM <=|FETCH FIRST/) do + firm = client.firm + assert_not_nil firm + assert_equal companies(:first_firm).name, firm.name + end end def test_assigning_belongs_to_on_destroyed_object |