diff options
author | Agis- <corestudiosinc@gmail.com> | 2014-08-23 00:26:16 +0300 |
---|---|---|
committer | Agis- <corestudiosinc@gmail.com> | 2014-08-24 04:35:05 +0300 |
commit | 291fece47a954eb986816a89164bda599d54db46 (patch) | |
tree | a31fdefdf8b02c81eb29cc82ccaf198084ed3d6d /activerecord/test/cases/adapters | |
parent | 33c05363e2ed52aa8bdbf5ebf9ee5226ab85ecbc (diff) | |
download | rails-291fece47a954eb986816a89164bda599d54db46.tar.gz rails-291fece47a954eb986816a89164bda599d54db46.tar.bz2 rails-291fece47a954eb986816a89164bda599d54db46.zip |
Don't trim excess whitespace in pg #columns_for_distinct
Fixes #16623 introduced by https://github.com/rails/rails/commit/3d5a2019bcccc6fb01bee4811ca669f4383edb51
Diffstat (limited to 'activerecord/test/cases/adapters')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb index cfff1f980b..01b3f350b5 100644 --- a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb +++ b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb @@ -334,6 +334,14 @@ module ActiveRecord @connection.columns_for_distinct("posts.id", ["posts.created_at desc", "posts.position asc"]) end + def test_columns_for_distinct_with_case + assert_equal( + 'posts.id, CASE WHEN author.is_active THEN UPPER(author.name) ELSE UPPER(author.email) END AS alias_0', + @connection.columns_for_distinct('posts.id', + ["CASE WHEN author.is_active THEN UPPER(author.name) ELSE UPPER(author.email) END"]) + ) + end + def test_columns_for_distinct_blank_not_nil_orders assert_equal "posts.id, posts.created_at AS alias_0", @connection.columns_for_distinct("posts.id", ["posts.created_at desc", "", " "]) |