Skip to content

Commit

Permalink
Add tests for #168
Browse files Browse the repository at this point in the history
  • Loading branch information
teeparham committed Mar 22, 2015
1 parent 3782c4b commit 5ac8fb5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/ddl_test.rb
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions test/tasks_test.rb
Expand Up @@ -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
Expand Down

0 comments on commit 5ac8fb5

Please sign in to comment.