Sha256: 5179745e4ce8d526dd5a05d6c7aafb62f4749b0ad080ce40ae53acce8b7d24c4

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

# -*- coding: binary -*-

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe GeoRuby::SimpleFeatures::Geometry do

  it "should instantiate" do
    violated unless subject
  end

  it "should have a default srid" do
    subject.srid.should eql(4326) #Geometry.default_srid)
  end

  it "should change srid" do
    geo = GeoRuby::SimpleFeatures::Geometry.new(225)
    geo.srid.should eql(225)
  end

  it "should instantiate from hex ewkb" do
    point = GeoRuby::SimpleFeatures::Geometry.from_hex_ewkb("01010000207B000000CDCCCCCCCCCC28406666666666A64640")
    point.class.should == GeoRuby::SimpleFeatures::Point
    point.x.should be_within(0.1).of(12.4)
  end

  it "should output as_ewkb" do
    subject.stub(:binary_geometry_type).and_return(1)
    subject.stub(:binary_representation).and_return(1)
    subject.as_ewkb.should eql("\001\001\000\000 \346\020\000\000\001")
  end

  it "should output as_ewkb (utf8 issue)" do
    subject.stub(:binary_geometry_type).and_return(1)
    subject.stub(:binary_representation).and_return(1)
    subject.as_ewkb.should eql("\x01\x01\x00\x00 \xE6\x10\x00\x00\x01")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
georuby-2.2.1 spec/geo_ruby/simple_features/geometry_spec.rb
georuby-2.2.0 spec/geo_ruby/simple_features/geometry_spec.rb