Permalink
Browse files

Add more cases to reproduce #3956

  • Loading branch information...
1 parent a001feb commit 2cbf1133e10bdb56e1df0f630fcfc051a64cd6cc @rafaelfranca committed Sep 17, 2012
Showing with 20 additions and 0 deletions.
  1. +20 −0 activerecord/test/cases/associations/has_many_associations_test.rb
@@ -51,6 +51,8 @@ class Invoice < ActiveRecord::Base
ActiveSupport::Deprecation.silence do
has_many :custom_line_items, :class_name => 'LineItem', :finder_sql => "SELECT DISTINCT line_items.amount from line_items"
has_many :custom_full_line_items, :class_name => 'LineItem', :finder_sql => "SELECT line_items.invoice_id, line_items.amount from line_items"
+ has_many :custom_star_line_items, :class_name => 'LineItem', :finder_sql => "SELECT * from line_items"
+ has_many :custom_qualified_star_line_items, :class_name => 'LineItem', :finder_sql => "SELECT line_items.* from line_items"
end
end
@@ -71,6 +73,24 @@ def test_should_count_results_with_multiple_fields
assert_equal 2, invoice.custom_full_line_items.count
end
+
+ def test_should_count_results_with_star
+ invoice = Invoice.new
+ invoice.custom_star_line_items << LineItem.new(:amount => 0)
+ invoice.custom_star_line_items << LineItem.new(:amount => 0)
+ invoice.save!
+
+ assert_equal 2, invoice.custom_star_line_items.count
+ end
+
+ def test_should_count_results_with_qualified_star
+ invoice = Invoice.new
+ invoice.custom_qualified_star_line_items << LineItem.new(:amount => 0)
+ invoice.custom_qualified_star_line_items << LineItem.new(:amount => 0)
+ invoice.save!
+
+ assert_equal 2, invoice.custom_qualified_star_line_items.count
+ end
end
class HasManyAssociationsTestForReorderWithJoinDependency < ActiveRecord::TestCase

0 comments on commit 2cbf113

Please sign in to comment.