diff --git a/test/ddl_test.rb b/test/ddl_test.rb index d716b864..94f76775 100644 --- a/test/ddl_test.rb +++ b/test/ddl_test.rb @@ -197,7 +197,17 @@ def test_create_point_geometry_using_shortcut assert_equal RGeo::Feature::Point, klass.columns.last.geometric_type end - def test_create_geometry_with_options + def test_create_geometry_using_shortcut_with_srid + klass.connection.create_table(:spatial_models, force: true) do |t| + t.geometry 'latlon', srid: 4326 + end + klass.reset_column_information + col = klass.columns.last + assert_equal RGeo::Feature::Geometry, col.geometric_type + assert_equal({ srid: 4326, type: 'geometry' }, col.limit) + end + + def test_create_polygon_with_options klass.connection.create_table(:spatial_models, force: true) do |t| t.column 'region', :st_polygon, has_m: true, srid: 3785 end diff --git a/test/tasks_test.rb b/test/tasks_test.rb index db50e438..c8f406b2 100644 --- a/test/tasks_test.rb +++ b/test/tasks_test.rb @@ -35,10 +35,12 @@ def test_basic_geography_sql_dump setup_database_tasks connection.create_table(:spatial_test, force: true) do |t| t.st_point "latlon", geographic: true + t.geometry "geo_col", srid: 4326 end ActiveRecord::Tasks::DatabaseTasks.structure_dump(NEW_CONNECTION, tmp_sql_filename) data = File.read(tmp_sql_filename) assert(data.index('latlon geography(Point,4326)')) + assert(data.index('geo_col geometry(Geometry,4326)'), data) end def test_index_sql_dump