aboutsummaryrefslogblamecommitdiffstats
path: root/activerecord/test/cases/adapters/postgresql/utils_test.rb
blob: e6d7868e9a6f34fd68f95b9e354fb56dac8d2a40 (plain) (tree)



















                                                             
require 'cases/helper'

class PostgreSQLUtilsTest < ActiveSupport::TestCase
  include ActiveRecord::ConnectionAdapters::PostgreSQL::Utils

  def test_extract_schema_and_table
    {
      %(table_name)            => [nil,'table_name'],
      %("table.name")          => [nil,'table.name'],
      %(schema.table_name)     => %w{schema table_name},
      %("schema".table_name)   => %w{schema table_name},
      %(schema."table_name")   => %w{schema table_name},
      %("schema"."table_name") => %w{schema table_name},
      %("even spaces".table)   => ['even spaces','table'],
      %(schema."table.name")   => ['schema', 'table.name']
    }.each do |given, expect|
      assert_equal expect, extract_schema_and_table(given)
    end
  end
end