class PostgresqlFullTextTest

Public Instance Methods

test_schema_dump_with_shorthand() click to toggle source
# File activerecord/test/cases/adapters/postgresql/full_text_test.rb, line 42
def test_schema_dump_with_shorthand
  output = dump_table_schema("tsvectors")
  assert_match %r{t\.tsvector "text_vector"}, output
end
test_tsvector_column() click to toggle source
# File activerecord/test/cases/adapters/postgresql/full_text_test.rb, line 21
def test_tsvector_column
  column = Tsvector.columns_hash["text_vector"]
  assert_equal :tsvector, column.type
  assert_equal "tsvector", column.sql_type
  assert_not column.array?

  type = Tsvector.type_for_attribute("text_vector")
  assert_not type.binary?
end
test_update_tsvector() click to toggle source
# File activerecord/test/cases/adapters/postgresql/full_text_test.rb, line 31
def test_update_tsvector
  Tsvector.create text_vector: "'text' 'vector'"
  tsvector = Tsvector.first
  assert_equal "'text' 'vector'", tsvector.text_vector

  tsvector.text_vector = "'new' 'text' 'vector'"
  tsvector.save!
  assert tsvector.reload
  assert_equal "'new' 'text' 'vector'", tsvector.text_vector
end