From 4c2f7ee36a623090d276ef811d959adb0ecff743 Mon Sep 17 00:00:00 2001 From: nanaya Date: Thu, 18 Aug 2016 21:56:15 +0900 Subject: Fix case insensitive check for text column in pg There's no 'text to text' casting in the cast table so the feature detection fails. --- .../adapters/postgresql/case_insensitive_test.rb | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 activerecord/test/cases/adapters/postgresql/case_insensitive_test.rb (limited to 'activerecord/test/cases') diff --git a/activerecord/test/cases/adapters/postgresql/case_insensitive_test.rb b/activerecord/test/cases/adapters/postgresql/case_insensitive_test.rb new file mode 100644 index 0000000000..d04e55f5bf --- /dev/null +++ b/activerecord/test/cases/adapters/postgresql/case_insensitive_test.rb @@ -0,0 +1,26 @@ +require "cases/helper" + +class PostgresqlCaseInsensitiveTest < ActiveRecord::PostgreSQLTestCase + class Default < ActiveRecord::Base; end + + def test_case_insensitiveness + connection = ActiveRecord::Base.connection + table = Default.arel_table + + column = Default.columns_hash["char1"] + comparison = connection.case_insensitive_comparison table, :char1, column, nil + assert_match /lower/i, comparison.to_sql + + column = Default.columns_hash["char2"] + comparison = connection.case_insensitive_comparison table, :char2, column, nil + assert_match /lower/i, comparison.to_sql + + column = Default.columns_hash["char3"] + comparison = connection.case_insensitive_comparison table, :char3, column, nil + assert_match /lower/i, comparison.to_sql + + column = Default.columns_hash["multiline_default"] + comparison = connection.case_insensitive_comparison table, :multiline_default, column, nil + assert_match /lower/i, comparison.to_sql + end +end -- cgit v1.2.3