Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test RGeo3 Compatibility #59

Merged
merged 6 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Tests
on: [push, pull_request]

jobs:
tests:
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
ruby:
- head
- "3.0"
- "2.7"
- "2.6"
- "jruby-9.3.7.0"
os:
- ubuntu
- macos
steps:
- name: Set Up Gems
uses: actions/checkout@v2
- name: Install Geos (Linux)
if: matrix.os == 'ubuntu'
run: |
sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get install -yqq libgeos-dev
- name: Install Geos (Mac)
if: matrix.os == 'macos'
run: HOMEBREW_NO_INSTALL_CLEANUP=1 brew install geos
- name: Set Up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Test
run: bundle exec rake
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ source "https://rubygems.org"
gemspec

gem "ffi-geos", ">= 0.0.4"

gem "rgeo", "~> 3.0.0.pre.rc.3"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# rgeo-geojson

[![Gem Version](https://badge.fury.io/rb/rgeo-geojson.svg)](http://badge.fury.io/rb/rgeo-geojson)
[![Build Status](https://travis-ci.org/rgeo/rgeo-geojson.svg?branch=master)](https://travis-ci.org/rgeo/rgeo-geojson)
[![CI](https://github.com/rgeo/rgeo-geojson/workflows/CI/badge.svg)](https://github.com/rgeo/rgeo-geojson/actions?query=workflow%3ACI+branch%3Amaster+event%3Apush)

`rgeo-geojson` is an extension to [RGeo](https://github.com/rgeo/rgeo)
that provides GeoJSON encoding and decoding.
Expand Down
15 changes: 8 additions & 7 deletions test/basic_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
require_relative "../lib/rgeo-geojson"
class BasicTest < Minitest::Test # :nodoc:
def setup
@geo_factory = RGeo::Cartesian.simple_factory(srid: 4326)
ruby_wkt_opts = { convert_case: :upper }
@geo_factory = RGeo::Cartesian.simple_factory(srid: 4326, wkt_generator: ruby_wkt_opts)
@geo_factory_z = RGeo::Cartesian.simple_factory(srid: 4326, has_z_coordinate: true)
@geo_factory_m = RGeo::Cartesian.simple_factory(srid: 4326, has_m_coordinate: true)
@geo_factory_zm = RGeo::Cartesian.simple_factory(srid: 4326, has_z_coordinate: true, has_m_coordinate: true)
Expand All @@ -22,13 +23,13 @@ def test_nil

def test_decode_simple_point
json = %({"type":"Point","coordinates":[1,2]})
point = RGeo::GeoJSON.decode(json)
point = RGeo::GeoJSON.decode(json, geo_factory: @geo_factory)
assert_equal "POINT (1.0 2.0)", point.as_text
end

def test_decode_point
json = '{"type":"Feature","geometry":{"type":"Point","coordinates":[2.5,4.0]},"properties":{"color":"red"}}'
feature = RGeo::GeoJSON.decode(json)
feature = RGeo::GeoJSON.decode(json, geo_factory: @geo_factory)
assert_equal "red", feature["color"]
assert_equal "POINT (2.5 4.0)", feature.geometry.as_text
end
Expand Down Expand Up @@ -223,10 +224,10 @@ def test_feature_collection
@geo_factory.point(10, 20)
]
object = @entity_factory.feature_collection([
@entity_factory.feature(geometries[0]),
@entity_factory.feature(geometries[1]),
@entity_factory.feature(geometries[2], 8)
])
@entity_factory.feature(geometries[0]),
@entity_factory.feature(geometries[1]),
@entity_factory.feature(geometries[2], 8)
])
json = {
"type" => "FeatureCollection",
"features" => [
Expand Down