spec/support/database.rb in pg_search-2.1.3 vs spec/support/database.rb in pg_search-2.1.4
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
if defined? JRUBY_VERSION
require "activerecord-jdbc-adapter"
error_classes = [ActiveRecord::JDBCError]
else
require "pg"
@@ -52,10 +54,10 @@
raise exception
end
def install_extension_if_missing(name, query, expected_result)
result = ActiveRecord::Base.connection.select_value(query)
- raise "Unexpected output for #{query}: #{result.inspect}" unless result.downcase == expected_result.downcase
+ raise "Unexpected output for #{query}: #{result.inspect}" unless result.casecmp(expected_result).zero?
rescue StandardError
install_extension(name)
end
install_extension_if_missing("pg_trgm", "SELECT 'abcdef' % 'cdef'", "t")