diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2011-05-24 03:05:06 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-05-24 23:25:21 +0100 |
commit | f1f1ab77df4ecfc122ab10c095a1e4e4c8b52353 (patch) | |
tree | 2c43a56e3c6472712b388008c4a161aff5b8ead3 /activerecord/test/cases | |
parent | 90f59b24dc994b0edca22dbed30846738ddcc41d (diff) | |
download | rails-f1f1ab77df4ecfc122ab10c095a1e4e4c8b52353.tar.gz rails-f1f1ab77df4ecfc122ab10c095a1e4e4c8b52353.tar.bz2 rails-f1f1ab77df4ecfc122ab10c095a1e4e4c8b52353.zip |
Failing tests for #1233.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/associations/eager_test.rb | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb index 3e92a77830..e12a3e074c 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -675,6 +675,46 @@ class EagerAssociationTest < ActiveRecord::TestCase } end + def test_eager_with_default_scope + developer = EagerDeveloperWithDefaultScope.where(:name => 'David').first + projects = Project.order(:id).all + assert_no_queries do + assert_equal(projects, developer.projects) + end + end + + def test_eager_with_default_scope_as_class_method + developer = EagerDeveloperWithClassMethodDefaultScope.where(:name => 'David').first + projects = Project.order(:id).all + assert_no_queries do + assert_equal(projects, developer.projects) + end + end + + def test_eager_with_default_scope_as_lambda + developer = EagerDeveloperWithLambdaDefaultScope.where(:name => 'David').first + projects = Project.order(:id).all + assert_no_queries do + assert_equal(projects, developer.projects) + end + end + + def test_eager_with_default_scope_as_block + developer = EagerDeveloperWithBlockDefaultScope.where(:name => 'David').first + projects = Project.order(:id).all + assert_no_queries do + assert_equal(projects, developer.projects) + end + end + + def test_eager_with_default_scope_as_callable + developer = EagerDeveloperWithCallableDefaultScope.where(:name => 'David').first + projects = Project.order(:id).all + assert_no_queries do + assert_equal(projects, developer.projects) + end + end + def find_all_ordered(className, include=nil) className.find(:all, :order=>"#{className.table_name}.#{className.primary_key}", :include=>include) end |