aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/finder_test.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-01-29 07:15:55 +0900
committerRyuta Kamizono <kamipo@gmail.com>2018-01-29 07:16:28 +0900
commit1c239df3deb349650be9b305b2c8980d6659ab3e (patch)
tree6da86dcf44b0fceb8697294639e7faa982e4e6a3 /activerecord/test/cases/finder_test.rb
parent970b5e150c5beb523a475cdc2b3cb218edfc771d (diff)
parent41d34ae68fc09474d88ed286890f4e73e815fb66 (diff)
downloadrails-1c239df3deb349650be9b305b2c8980d6659ab3e.tar.gz
rails-1c239df3deb349650be9b305b2c8980d6659ab3e.tar.bz2
rails-1c239df3deb349650be9b305b2c8980d6659ab3e.zip
Merge pull request #31724 from orekyuu/fix-expand-composed-object-array
Fix not expanded problem when passing an Array object as argument to the where method using composed_of column.
Diffstat (limited to 'activerecord/test/cases/finder_test.rb')
-rw-r--r--activerecord/test/cases/finder_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb
index c78c13ece3..fabfc4574c 100644
--- a/activerecord/test/cases/finder_test.rb
+++ b/activerecord/test/cases/finder_test.rb
@@ -868,6 +868,24 @@ class FinderTest < ActiveRecord::TestCase
assert_equal customers(:david), found_customer
end
+ def test_hash_condition_find_with_aggregate_having_three_mapping_array
+ david_address = customers(:david).address
+ zaphod_address = customers(:zaphod).address
+ assert_kind_of Address, david_address
+ assert_kind_of Address, zaphod_address
+ found_customers = Customer.where(address: [david_address, zaphod_address])
+ assert_equal [customers(:david), customers(:zaphod)], found_customers
+ end
+
+ def test_hash_condition_find_with_aggregate_having_one_mapping_array
+ david_balance = customers(:david).balance
+ zaphod_balance = customers(:zaphod).balance
+ assert_kind_of Money, david_balance
+ assert_kind_of Money, zaphod_balance
+ found_customers = Customer.where(balance: [david_balance, zaphod_balance])
+ assert_equal [customers(:david), customers(:zaphod)], found_customers
+ end
+
def test_hash_condition_find_with_aggregate_attribute_having_same_name_as_field_and_key_value_being_aggregate
gps_location = customers(:david).gps_location
assert_kind_of GpsLocation, gps_location