Sha256: ae1d39a03d1f78fc5aa4003719dd25f3e5b9587a8b7e326de3327a4e5c6a3ddb

Contents?: true

Size: 1.93 KB

Versions: 1

Compression:

Stored size: 1.93 KB

Contents

require "spec_helper"

describe RGeo::Geos::PointImpl do

  subject { rgeo_point }

  describe "#to_georuby" do

    it "should return a GeoRuby::SimpleFeatures::Point" do
      subject.to_georuby.should be_instance_of(GeoRuby::SimpleFeatures::Point)
    end

    it "should have the same x" do
      subject.to_georuby.x.should == subject.x
    end

    it "should have the same y" do
      subject.to_georuby.y.should == subject.y
    end

    it "should have the same srid" do
      subject.to_georuby.srid.should == subject.srid
    end

  end

end

describe RGeo::Geos::LineImpl do

  subject { rgeometry("LINESTRING(0 0, 1 1)") }

  describe "#to_georuby" do
    
    it "should return a GeoRuby::SimpleFeatures::LineString" do
      subject.to_georuby.should be_instance_of(GeoRuby::SimpleFeatures::LineString)
    end

    it "should return a LineString with the same information" do
      subject.to_georuby.should == geometry("LINESTRING(0 0, 1 1)")
    end

  end

end

describe RGeo::Geos::PolygonImpl do

  subject { rgeometry("POLYGON((0 0,1 0,0 1,0 0))") }

  describe "#to_georuby" do
    
    it "should return a GeoRuby::SimpleFeatures::Polygon" do
      subject.to_georuby.should be_instance_of(GeoRuby::SimpleFeatures::Polygon)
    end

    it "should return a Polygon with the same information" do
      subject.to_georuby.should == geometry("POLYGON((0 0,1 0,0 1,0 0))")
    end

  end

end

describe RGeo::Geos::MultiPolygonImpl do

  subject { rgeometry("MULTIPOLYGON (((30 20, 10 40, 45 40, 30 20)), ((15 5, 40 10, 10 20, 5 10, 15 5)))") }

  describe "#to_georuby" do
    
    it "should return a GeoRuby::SimpleFeatures::MultiPolygon" do
      subject.to_georuby.should be_instance_of(GeoRuby::SimpleFeatures::MultiPolygon)
    end

    it "should return a MultiPolygon with the same information" do
      subject.to_georuby.should == geometry("MULTIPOLYGON (((30 20, 10 40, 45 40, 30 20)), ((15 5, 40 10, 10 20, 5 10, 15 5)))")
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
georuby-ext-0.0.1 spec/rgeo_spec.rb