aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2014-06-03 13:56:21 +0200
committerYves Senn <yves.senn@gmail.com>2014-06-03 13:56:21 +0200
commit098bb63ae4acc349826ab84b3e1dff985e38609c (patch)
treeaecd8f4d2e38812e421ad60a70ebcc204d62d9d9 /activerecord/test/cases
parented1b747b85876122e0b7b11aaabcc877c6f819b9 (diff)
downloadrails-098bb63ae4acc349826ab84b3e1dff985e38609c.tar.gz
rails-098bb63ae4acc349826ab84b3e1dff985e38609c.tar.bz2
rails-098bb63ae4acc349826ab84b3e1dff985e38609c.zip
pg, preserve point type when schema dumping.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/adapters/postgresql/geometric_test.rb16
-rw-r--r--activerecord/test/cases/schema_dumper_test.rb2
2 files changed, 9 insertions, 9 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/geometric_test.rb b/activerecord/test/cases/adapters/postgresql/geometric_test.rb
index 89a72f08b4..46c7662879 100644
--- a/activerecord/test/cases/adapters/postgresql/geometric_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/geometric_test.rb
@@ -15,9 +15,9 @@ class PostgresqlPointTest < ActiveRecord::TestCase
@connection = ActiveRecord::Base.connection
@connection.transaction do
@connection.create_table('postgresql_points') do |t|
- t.column :x, :point
- t.column :y, :point, default: [12.2, 13.3]
- t.column :z, :point, default: "(14.4,15.5)"
+ t.point :x
+ t.point :y, default: [12.2, 13.3]
+ t.point :z, default: "(14.4,15.5)"
end
end
end
@@ -28,9 +28,9 @@ class PostgresqlPointTest < ActiveRecord::TestCase
def test_column
column = PostgresqlPoint.columns_hash["x"]
- assert_equal :string, column.type
+ assert_equal :point, column.type
assert_equal "point", column.sql_type
- assert column.text?
+ assert_not column.text?
assert_not column.number?
assert_not column.binary?
assert_not column.array
@@ -48,9 +48,9 @@ class PostgresqlPointTest < ActiveRecord::TestCase
def test_schema_dumping
output = dump_table_schema("postgresql_points")
- assert_match %r{t\.string\s+"x"$}, output
- assert_match %r{t\.string\s+"y",\s+default: \[12\.2, 13\.3\]$}, output
- assert_match %r{t\.string\s+"z",\s+default: \[14\.4, 15\.5\]$}, output
+ assert_match %r{t\.point\s+"x"$}, output
+ assert_match %r{t\.point\s+"y",\s+default: \[12\.2, 13\.3\]$}, output
+ assert_match %r{t\.point\s+"z",\s+default: \[14\.4, 15\.5\]$}, output
end
def test_roundtrip
diff --git a/activerecord/test/cases/schema_dumper_test.rb b/activerecord/test/cases/schema_dumper_test.rb
index 9602252b2e..ce2b06430b 100644
--- a/activerecord/test/cases/schema_dumper_test.rb
+++ b/activerecord/test/cases/schema_dumper_test.rb
@@ -62,7 +62,7 @@ class SchemaDumperTest < ActiveRecord::TestCase
next if column_set.empty?
lengths = column_set.map do |column|
- if match = column.match(/t\.(?:integer|decimal|float|datetime|timestamp|time|date|text|binary|string|boolean|uuid)\s+"/)
+ if match = column.match(/t\.(?:integer|decimal|float|datetime|timestamp|time|date|text|binary|string|boolean|uuid|point)\s+"/)
match[0].length
end
end