diff options
author | Dylan Thacker-Smith <Dylan.Smith@shopify.com> | 2019-01-18 10:03:46 -0500 |
---|---|---|
committer | Dylan Thacker-Smith <Dylan.Smith@shopify.com> | 2019-01-18 11:10:10 -0500 |
commit | 592a961f299a672abbf17a9d01dea1ded5c4e35b (patch) | |
tree | 900c5b2763b4811c45f9269b7b13ea4a060cce77 /activerecord/test/cases | |
parent | ff3d1a42d5800c999be7351b72317cefb5961ee8 (diff) | |
download | rails-592a961f299a672abbf17a9d01dea1ded5c4e35b.tar.gz rails-592a961f299a672abbf17a9d01dea1ded5c4e35b.tar.bz2 rails-592a961f299a672abbf17a9d01dea1ded5c4e35b.zip |
activerecord: Fix where nil condition on composed_of attribute
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/finder_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb index 32cf0fb9e7..6af2a43c7f 100644 --- a/activerecord/test/cases/finder_test.rb +++ b/activerecord/test/cases/finder_test.rb @@ -1003,6 +1003,24 @@ class FinderTest < ActiveRecord::TestCase assert_equal customers(:david), found_customer end + def test_hash_condition_find_nil_with_aggregate_having_one_mapping + assert_nil customers(:zaphod).gps_location + found_customer = Customer.where(gps_location: nil, name: customers(:zaphod).name).first + assert_equal customers(:zaphod), found_customer + end + + def test_hash_condition_find_nil_with_aggregate_having_multiple_mappings + customers(:david).update(address: nil) + assert_nil customers(:david).address_street + assert_nil customers(:david).address_city + found_customer = Customer.where(address: nil, name: customers(:david).name).first + assert_equal customers(:david), found_customer + end + + def test_hash_condition_find_empty_array_with_aggregate_having_multiple_mappings + assert_nil Customer.where(address: []).first + end + def test_condition_utc_time_interpolation_with_default_timezone_local with_env_tz "America/New_York" do with_timezone_config default: :local do |