aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-09-12 20:53:05 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-09-12 20:53:05 -0300
commit33ae757376f6d97f5580bfa6f03ce8da09d7780a (patch)
tree56c7b9ce9599149f4cd8a0eaaea968e338b8dbca /activerecord/test
parente1154a694d861abbcc1f8f1c8d557d2e349ba9c2 (diff)
parent8875e28a50b117aa862c8563c49f7e3a6ee7deff (diff)
downloadrails-33ae757376f6d97f5580bfa6f03ce8da09d7780a.tar.gz
rails-33ae757376f6d97f5580bfa6f03ce8da09d7780a.tar.bz2
rails-33ae757376f6d97f5580bfa6f03ce8da09d7780a.zip
Merge pull request #12137 from lann/fix_association_first_last
Make CollectionAssociation first/last with integer fetch with query Conflicts: activerecord/CHANGELOG.md
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/associations/has_many_associations_test.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb
index 4c0fa88917..ebeead0dc2 100644
--- a/activerecord/test/cases/associations/has_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_associations_test.rb
@@ -1414,15 +1414,17 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
end
end
- def test_calling_first_or_last_with_integer_on_association_should_load_association
+ def test_calling_first_or_last_with_integer_on_association_should_not_load_association
firm = companies(:first_firm)
+ firm.clients.create(:name => 'Foo')
+ assert !firm.clients.loaded?
- assert_queries 1 do
+ assert_queries 2 do
firm.clients.first(2)
firm.clients.last(2)
end
- assert firm.clients.loaded?
+ assert !firm.clients.loaded?
end
def test_calling_many_should_count_instead_of_loading_association