georuby 2.2.1 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -8
  3. data/lib/geo_ruby/geojson.rb +8 -6
  4. data/lib/geo_ruby/simple_features/geometry.rb +11 -0
  5. data/lib/geo_ruby/simple_features/geometry_collection.rb +1 -9
  6. data/lib/geo_ruby/simple_features/line_string.rb +8 -13
  7. data/lib/geo_ruby/simple_features/multi_line_string.rb +2 -10
  8. data/lib/geo_ruby/simple_features/multi_point.rb +1 -9
  9. data/lib/geo_ruby/simple_features/multi_polygon.rb +0 -7
  10. data/lib/geo_ruby/simple_features/point.rb +11 -14
  11. data/lib/geo_ruby/simple_features/polygon.rb +1 -9
  12. data/lib/geo_ruby/version.rb +1 -1
  13. data/spec/geo_ruby/geojson_spec.rb +25 -25
  14. data/spec/geo_ruby/georss_spec.rb +63 -63
  15. data/spec/geo_ruby/gpx4r/gpx_spec.rb +34 -34
  16. data/spec/geo_ruby/kml_spec.rb +27 -27
  17. data/spec/geo_ruby/shp4r/shp_spec.rb +46 -46
  18. data/spec/geo_ruby/simple_features/circle_spec.rb +1 -1
  19. data/spec/geo_ruby/simple_features/envelope_spec.rb +15 -15
  20. data/spec/geo_ruby/simple_features/ewkb_parser_spec.rb +56 -56
  21. data/spec/geo_ruby/simple_features/ewkt_parser_spec.rb +68 -68
  22. data/spec/geo_ruby/simple_features/geometry_collection_spec.rb +18 -18
  23. data/spec/geo_ruby/simple_features/geometry_spec.rb +10 -10
  24. data/spec/geo_ruby/simple_features/line_string_spec.rb +80 -71
  25. data/spec/geo_ruby/simple_features/linear_ring_spec.rb +3 -3
  26. data/spec/geo_ruby/simple_features/multi_line_string_spec.rb +15 -15
  27. data/spec/geo_ruby/simple_features/multi_point_spec.rb +10 -10
  28. data/spec/geo_ruby/simple_features/multi_polygon_spec.rb +13 -13
  29. data/spec/geo_ruby/simple_features/point_spec.rb +139 -131
  30. data/spec/geo_ruby/simple_features/polygon_spec.rb +36 -36
  31. data/spec/geo_ruby_spec.rb +3 -3
  32. data/spec/spec_helper.rb +4 -4
  33. metadata +52 -52
@@ -4,32 +4,32 @@ describe GeoRuby::SimpleFeatures::MultiPoint do
4
4
 
5
5
  it "test_multi_point_creation" do
6
6
  multi_point = GeoRuby::SimpleFeatures::MultiPoint.from_coordinates([[12.4,-123.3],[-65.1,123.4],[123.55555555,123]],444)
7
- multi_point.should be_instance_of(GeoRuby::SimpleFeatures::MultiPoint)
8
- multi_point.length.should eql(3)
9
- multi_point[0].should == GeoRuby::SimpleFeatures::Point.from_x_y(12.4,-123.3,444)
10
- multi_point[2].should == GeoRuby::SimpleFeatures::Point.from_x_y(123.55555555,123,444)
7
+ expect(multi_point).to be_instance_of(GeoRuby::SimpleFeatures::MultiPoint)
8
+ expect(multi_point.length).to eql(3)
9
+ expect(multi_point[0]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y(12.4,-123.3,444))
10
+ expect(multi_point[2]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y(123.55555555,123,444))
11
11
  end
12
12
 
13
13
  it "test_multi_point_binary" do
14
14
  multi_point = GeoRuby::SimpleFeatures::MultiPoint.from_coordinates([[12.4,-123.3],[-65.1,123.4],[123.55555555,123]],444)
15
- multi_point.as_hex_ewkb.should eql("0104000020BC010000030000000101000000CDCCCCCCCCCC28403333333333D35EC0010100000066666666664650C09A99999999D95E4001010000001F97DD388EE35E400000000000C05E40")
15
+ expect(multi_point.as_hex_ewkb).to eql("0104000020BC010000030000000101000000CDCCCCCCCCCC28403333333333D35EC0010100000066666666664650C09A99999999D95E4001010000001F97DD388EE35E400000000000C05E40")
16
16
 
17
17
  multi_point = GeoRuby::SimpleFeatures::MultiPoint.from_coordinates([[12.4,-123.3,4.5],[-65.1,123.4,1.2],[123.55555555,123,2.3]],444,true)
18
- multi_point.as_hex_ewkb.should eql("01040000A0BC010000030000000101000080CDCCCCCCCCCC28403333333333D35EC00000000000001240010100008066666666664650C09A99999999D95E40333333333333F33F01010000801F97DD388EE35E400000000000C05E406666666666660240")
18
+ expect(multi_point.as_hex_ewkb).to eql("01040000A0BC010000030000000101000080CDCCCCCCCCCC28403333333333D35EC00000000000001240010100008066666666664650C09A99999999D95E40333333333333F33F01010000801F97DD388EE35E400000000000C05E406666666666660240")
19
19
  end
20
20
 
21
21
  it "test_multi_point_text" do
22
22
  multi_point = GeoRuby::SimpleFeatures::MultiPoint.from_coordinates([[12.4,-123.3],[-65.1,123.4],[123.55555555,123]],444)
23
- multi_point.as_ewkt.should eql("SRID=444;MULTIPOINT((12.4 -123.3),(-65.1 123.4),(123.55555555 123))")
23
+ expect(multi_point.as_ewkt).to eql("SRID=444;MULTIPOINT((12.4 -123.3),(-65.1 123.4),(123.55555555 123))")
24
24
 
25
25
  multi_point = GeoRuby::SimpleFeatures::MultiPoint.from_coordinates([[12.4,-123.3,4.5],[-65.1,123.4,6.7],[123.55555555,123,7.8]],444,true)
26
- multi_point.as_ewkt.should eql("SRID=444;MULTIPOINT((12.4 -123.3 4.5),(-65.1 123.4 6.7),(123.55555555 123 7.8))")
26
+ expect(multi_point.as_ewkt).to eql("SRID=444;MULTIPOINT((12.4 -123.3 4.5),(-65.1 123.4 6.7),(123.55555555 123 7.8))")
27
27
  end
28
28
 
29
29
  it "should respond to points" do
30
30
  mp = GeoRuby::SimpleFeatures::MultiPoint.from_coordinates([[12.4,-123.3],[-65.1,123.4],[123.55555555,123]],444)
31
- mp.should have(3).geometries
32
- mp.should have(3).points
31
+ expect(mp.geometries.size).to eq(3)
32
+ expect(mp.size).to eq(3)
33
33
  end
34
34
 
35
35
  end
@@ -4,32 +4,32 @@ describe GeoRuby::SimpleFeatures::MultiPolygon do
4
4
 
5
5
  it "test_multi_polygon_creation" do
6
6
  multi_polygon1 = GeoRuby::SimpleFeatures::MultiPolygon.from_polygons([GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256),GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[0,0],[4,0],[4,4],[0,4],[0,0]],[[1,1],[3,1],[3,3],[1,3],[1,1]]],256)],256)
7
- multi_polygon1.should be_instance_of(GeoRuby::SimpleFeatures::MultiPolygon)
8
- multi_polygon1.length.should eql(2)
9
- multi_polygon1[0].should == GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256)
7
+ expect(multi_polygon1).to be_instance_of(GeoRuby::SimpleFeatures::MultiPolygon)
8
+ expect(multi_polygon1.length).to eql(2)
9
+ expect(multi_polygon1[0]).to eq(GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256))
10
10
 
11
11
  multi_polygon2 = GeoRuby::SimpleFeatures::MultiPolygon.from_coordinates([[[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],[[[0,0],[4,0],[4,4],[0,4],[0,0]],[[1,1],[3,1],[3,3],[1,3],[1,1]]]],256)
12
- multi_polygon1.should be_instance_of(GeoRuby::SimpleFeatures::MultiPolygon)
13
- multi_polygon1.length.should eql(2)
12
+ expect(multi_polygon1).to be_instance_of(GeoRuby::SimpleFeatures::MultiPolygon)
13
+ expect(multi_polygon1.length).to eql(2)
14
14
 
15
- multi_polygon2[0].should == GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256)
16
- multi_polygon1.should == multi_polygon2
15
+ expect(multi_polygon2[0]).to eq(GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256))
16
+ expect(multi_polygon1).to eq(multi_polygon2)
17
17
  end
18
18
 
19
19
  it "test_multi_polygon_binary" do
20
20
  multi_polygon = GeoRuby::SimpleFeatures::MultiPolygon.from_polygons([GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256),GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[0,0],[4,0],[4,4],[0,4],[0,0]],[[1,1],[3,1],[3,3],[1,3],[1,1]]],256)],256)
21
- multi_polygon.as_hex_ewkb.should eql("0106000020000100000200000001030000000200000004000000CDCCCCCCCCCC28406666666666A646C03333333333B34640CDCCCCCCCCCC44406DE7FBA9F1D211403D2CD49AE61DF13FCDCCCCCCCCCC28406666666666A646C004000000333333333333034033333333333315409A999999999915408A8EE4F21FD2F63FEC51B81E85EB2C40F6285C8FC2F5F03F3333333333330340333333333333154001030000000200000005000000000000000000000000000000000000000000000000001040000000000000000000000000000010400000000000001040000000000000000000000000000010400000000000000000000000000000000005000000000000000000F03F000000000000F03F0000000000000840000000000000F03F00000000000008400000000000000840000000000000F03F0000000000000840000000000000F03F000000000000F03F")
21
+ expect(multi_polygon.as_hex_ewkb).to eql("0106000020000100000200000001030000000200000004000000CDCCCCCCCCCC28406666666666A646C03333333333B34640CDCCCCCCCCCC44406DE7FBA9F1D211403D2CD49AE61DF13FCDCCCCCCCCCC28406666666666A646C004000000333333333333034033333333333315409A999999999915408A8EE4F21FD2F63FEC51B81E85EB2C40F6285C8FC2F5F03F3333333333330340333333333333154001030000000200000005000000000000000000000000000000000000000000000000001040000000000000000000000000000010400000000000001040000000000000000000000000000010400000000000000000000000000000000005000000000000000000F03F000000000000F03F0000000000000840000000000000F03F00000000000008400000000000000840000000000000F03F0000000000000840000000000000F03F000000000000F03F")
22
22
 
23
23
  multi_polygon = GeoRuby::SimpleFeatures::MultiPolygon.from_polygons([GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4,-45.3,1.2],[45.4,41.6,1.2],[4.456,1.0698,1.2],[12.4,-45.3,1.2]],[[2.4,5.3,1.2],[5.4,1.4263,1.2],[14.46,1.06,1.2],[2.4,5.3,1.2]]],256,false,true),GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[0,0,1.2],[4,0,1.2],[4,4,2.3],[0,4,1.2],[0,0,1.2]],[[1,1,2.2],[3,1,3.3],[3,3,1.1],[1,3,2.4],[1,1,2.2]]],256,false,true)],256,false,true)
24
- multi_polygon.as_hex_ewkb.should eql("0106000020000100000200000001030000400200000004000000CDCCCCCCCCCC28406666666666A646C0333333333333F33F3333333333B34640CDCCCCCCCCCC4440333333333333F33F6DE7FBA9F1D211403D2CD49AE61DF13F333333333333F33FCDCCCCCCCCCC28406666666666A646C0333333333333F33F0400000033333333333303403333333333331540333333333333F33F9A999999999915408A8EE4F21FD2F63F333333333333F33FEC51B81E85EB2C40F6285C8FC2F5F03F333333333333F33F33333333333303403333333333331540333333333333F33F0103000040020000000500000000000000000000000000000000000000333333333333F33F00000000000010400000000000000000333333333333F33F00000000000010400000000000001040666666666666024000000000000000000000000000001040333333333333F33F00000000000000000000000000000000333333333333F33F05000000000000000000F03F000000000000F03F9A999999999901400000000000000840000000000000F03F6666666666660A40000000000000084000000000000008409A9999999999F13F000000000000F03F00000000000008403333333333330340000000000000F03F000000000000F03F9A99999999990140")
24
+ expect(multi_polygon.as_hex_ewkb).to eql("0106000020000100000200000001030000400200000004000000CDCCCCCCCCCC28406666666666A646C0333333333333F33F3333333333B34640CDCCCCCCCCCC4440333333333333F33F6DE7FBA9F1D211403D2CD49AE61DF13F333333333333F33FCDCCCCCCCCCC28406666666666A646C0333333333333F33F0400000033333333333303403333333333331540333333333333F33F9A999999999915408A8EE4F21FD2F63F333333333333F33FEC51B81E85EB2C40F6285C8FC2F5F03F333333333333F33F33333333333303403333333333331540333333333333F33F0103000040020000000500000000000000000000000000000000000000333333333333F33F00000000000010400000000000000000333333333333F33F00000000000010400000000000001040666666666666024000000000000000000000000000001040333333333333F33F00000000000000000000000000000000333333333333F33F05000000000000000000F03F000000000000F03F9A999999999901400000000000000840000000000000F03F6666666666660A40000000000000084000000000000008409A9999999999F13F000000000000F03F00000000000008403333333333330340000000000000F03F000000000000F03F9A99999999990140")
25
25
  end
26
26
 
27
27
  it "test_multi_polygon_text" do
28
28
  multi_polygon = GeoRuby::SimpleFeatures::MultiPolygon.from_polygons([GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256),GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[0,0],[4,0],[4,4],[0,4],[0,0]],[[1,1],[3,1],[3,3],[1,3],[1,1]]],256)],256)
29
- multi_polygon.as_ewkt.should eql("SRID=256;MULTIPOLYGON(((12.4 -45.3,45.4 41.6,4.456 1.0698,12.4 -45.3),(2.4 5.3,5.4 1.4263,14.46 1.06,2.4 5.3)),((0 0,4 0,4 4,0 4,0 0),(1 1,3 1,3 3,1 3,1 1)))")
29
+ expect(multi_polygon.as_ewkt).to eql("SRID=256;MULTIPOLYGON(((12.4 -45.3,45.4 41.6,4.456 1.0698,12.4 -45.3),(2.4 5.3,5.4 1.4263,14.46 1.06,2.4 5.3)),((0 0,4 0,4 4,0 4,0 0),(1 1,3 1,3 3,1 3,1 1)))")
30
30
 
31
31
  multi_polygon = GeoRuby::SimpleFeatures::MultiPolygon.from_polygons([GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[12.4,-45.3,2],[45.4,41.6,3],[4.456,1.0698,4],[12.4,-45.3,2]],[[2.4,5.3,1],[5.4,1.4263,3.44],[14.46,1.06,4.5],[2.4,5.3,1]]],4326,true),GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[0,0,5.6],[4,0,5.4],[4,4,1],[0,4,23],[0,0,5.6]],[[1,1,2.3],[3,1,4],[3,3,5],[1,3,6],[1,1,2.3]]],4326,true)],4326,true)
32
- multi_polygon.as_ewkt.should eql("SRID=4326;MULTIPOLYGON(((12.4 -45.3 2,45.4 41.6 3,4.456 1.0698 4,12.4 -45.3 2),(2.4 5.3 1,5.4 1.4263 3.44,14.46 1.06 4.5,2.4 5.3 1)),((0 0 5.6,4 0 5.4,4 4 1,0 4 23,0 0 5.6),(1 1 2.3,3 1 4,3 3 5,1 3 6,1 1 2.3)))")
32
+ expect(multi_polygon.as_ewkt).to eql("SRID=4326;MULTIPOLYGON(((12.4 -45.3 2,45.4 41.6 3,4.456 1.0698 4,12.4 -45.3 2),(2.4 5.3 1,5.4 1.4263 3.44,14.46 1.06 4.5,2.4 5.3 1)),((0 0 5.6,4 0 5.4,4 4 1,0 4 23,0 0 5.6),(1 1 2.3,3 1 4,3 3 5,1 3 6,1 1 2.3)))")
33
33
  end
34
34
 
35
35
  describe "Counting" do
@@ -39,11 +39,11 @@ describe GeoRuby::SimpleFeatures::MultiPolygon do
39
39
  end
40
40
 
41
41
  it "should have a points method" do
42
- @mp.points[0].should be_instance_of(GeoRuby::SimpleFeatures::Point)
42
+ expect(@mp.points[0]).to be_instance_of(GeoRuby::SimpleFeatures::Point)
43
43
  end
44
44
 
45
45
  it "should flatten it right" do
46
- @mp.should have(18).points
46
+ expect(@mp.points.size).to eq(18)
47
47
  end
48
48
 
49
49
  end
@@ -6,55 +6,55 @@ describe GeoRuby::SimpleFeatures::Point do
6
6
 
7
7
  it "should instantiatember" do
8
8
  violated unless point
9
- point.should be_instance_of(GeoRuby::SimpleFeatures::Point)
9
+ expect(point).to be_instance_of(GeoRuby::SimpleFeatures::Point)
10
10
  end
11
11
 
12
12
  it "should have a nice matcher" do
13
- point.should be_a_point
13
+ expect(point).to be_a_point
14
14
  end
15
15
 
16
16
  it "should have a text geometry type" do
17
- point.text_geometry_type.should eq("POINT")
17
+ expect(point.text_geometry_type).to eq("POINT")
18
18
  end
19
19
 
20
20
  it "should have a very nice matcher" do
21
- point.should be_a_point(0.0, 0.0)
21
+ expect(point).to be_a_point(0.0, 0.0)
22
22
  end
23
23
 
24
24
  it "should have a very nice matcher" do
25
- GeoRuby::SimpleFeatures::Point.from_x_y_z_m(1,2,3.33,"t").should be_a_point(1, 2, 3.33, "t")
25
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y_z_m(1,2,3.33,"t")).to be_a_point(1, 2, 3.33, "t")
26
26
  end
27
27
 
28
28
  it "should have a dumb matcher" do
29
- GeoRuby::SimpleFeatures::Point.should be_geometric
29
+ expect(GeoRuby::SimpleFeatures::Point).to be_geometric
30
30
  end
31
31
 
32
32
  it "should be subclassable" do
33
33
  place = Class.new(GeoRuby::SimpleFeatures::Point)
34
34
  p = place.from_x_y(1,2)
35
- p.should be_a place
35
+ expect(p).to be_a place
36
36
  end
37
37
 
38
38
  it "should have binary_geometry_type 2" do
39
- point.binary_geometry_type.should eql(1)
39
+ expect(point.binary_geometry_type).to eql(1)
40
40
  end
41
41
 
42
42
  it "should have the correct srid" do
43
- point.srid.should eql(4326)
43
+ expect(point.srid).to eql(4326)
44
44
  end
45
45
 
46
46
  it "should not have z or m" do
47
- point.with_z.should be_false
48
- point.should_not be_with_z
49
- point.with_m.should be_false
50
- point.should_not be_with_m
47
+ expect(point.with_z).to be_falsey
48
+ expect(point).not_to be_with_z
49
+ expect(point.with_m).to be_falsey
50
+ expect(point).not_to be_with_m
51
51
  end
52
52
 
53
53
  it "should set params to 0.0" do
54
- point.x.should eql(0.0)
55
- point.y.should eql(0.0)
56
- point.z.should eql(0.0)
57
- point.m.should eql(0.0)
54
+ expect(point.x).to eql(0.0)
55
+ expect(point.y).to eql(0.0)
56
+ expect(point.z).to eql(0.0)
57
+ expect(point.m).to eql(0.0)
58
58
  end
59
59
 
60
60
  it "should compare ok" do
@@ -71,176 +71,176 @@ describe GeoRuby::SimpleFeatures::Point do
71
71
  point5.m=15
72
72
  geometry= GeoRuby::SimpleFeatures::Geometry::new
73
73
 
74
- point1.should == point2
75
- point1.should_not == point3
76
- point1.should_not == point4
77
- point1.should_not == point5
78
- point1.should_not == geometry
74
+ expect(point1).to eq(point2)
75
+ expect(point1).not_to eq(point3)
76
+ expect(point1).not_to eq(point4)
77
+ expect(point1).not_to eq(point5)
78
+ expect(point1).not_to eq(geometry)
79
79
  end
80
80
 
81
81
  describe "> Instantiation" do
82
82
 
83
83
  it "should instantiate a 2d point" do
84
84
  point = GeoRuby::SimpleFeatures::Point.from_x_y(10,20,123)
85
- point.x.should eql(10)
86
- point.y.should eql(20)
87
- point.srid.should eql(123)
88
- point.z.should eql(0.0)
85
+ expect(point.x).to eql(10)
86
+ expect(point.y).to eql(20)
87
+ expect(point.srid).to eql(123)
88
+ expect(point.z).to eql(0.0)
89
89
  end
90
90
 
91
91
  it "should instantiate a 2d easily" do
92
92
  point = GeoRuby::SimpleFeatures::Point.xy(10,20,123)
93
- point.x.should eql(10)
94
- point.y.should eql(20)
95
- point.srid.should eql(123)
93
+ expect(point.x).to eql(10)
94
+ expect(point.y).to eql(20)
95
+ expect(point.srid).to eql(123)
96
96
  end
97
97
 
98
98
  it "should instantiate a 3d point" do
99
99
  point = GeoRuby::SimpleFeatures::Point.from_x_y_z(-10,-20,-30)
100
- point.x.should eql(-10)
101
- point.y.should eql(-20)
102
- point.z.should eql(-30)
100
+ expect(point.x).to eql(-10)
101
+ expect(point.y).to eql(-20)
102
+ expect(point.z).to eql(-30)
103
103
  end
104
104
 
105
105
  it "should store correctly a 3d point" do
106
106
  point = GeoRuby::SimpleFeatures::Point.from_x_y_z(-10,-20,-30)
107
- point.to_coordinates.should eq([-10, -20, -30])
107
+ expect(point.to_coordinates).to eq([-10, -20, -30])
108
108
  end
109
109
 
110
110
  it "should instantiate a 3d(m) point" do
111
111
  point = GeoRuby::SimpleFeatures::Point.from_x_y_m(10,20,30)
112
- point.x.should eql(10)
113
- point.y.should eql(20)
114
- point.m.should eql(30)
115
- point.z.should eql(0.0)
112
+ expect(point.x).to eql(10)
113
+ expect(point.y).to eql(20)
114
+ expect(point.m).to eql(30)
115
+ expect(point.z).to eql(0.0)
116
116
  end
117
117
 
118
118
  it "should instantiate a 4d point" do
119
119
  point = GeoRuby::SimpleFeatures::Point.from_x_y_z_m(10,20,30,40,123)
120
- point.x.should eql(10)
121
- point.y.should eql(20)
122
- point.z.should eql(30)
123
- point.m.should eql(40)
124
- point.srid.should eql(123)
120
+ expect(point.x).to eql(10)
121
+ expect(point.y).to eql(20)
122
+ expect(point.z).to eql(30)
123
+ expect(point.m).to eql(40)
124
+ expect(point.srid).to eql(123)
125
125
  end
126
126
 
127
127
  it "should store correctly a 4d point" do
128
128
  point = GeoRuby::SimpleFeatures::Point.from_x_y_z_m(-10,-20,-30, 1)
129
- point.m.should eql(1)
130
- point.to_coordinates.should eq([-10, -20, -30])
129
+ expect(point.m).to eql(1)
130
+ expect(point.to_coordinates).to eq([-10, -20, -30])
131
131
  end
132
132
 
133
133
  it "should instantiate a point from polar coordinates" do
134
134
  point = GeoRuby::SimpleFeatures::Point.from_r_t(1.4142,45)
135
- point.y.should be_within(0.1).of(1)
136
- point.x.should be_within(0.1).of(1)
135
+ expect(point.y).to be_within(0.1).of(1)
136
+ expect(point.x).to be_within(0.1).of(1)
137
137
  end
138
138
 
139
139
  it "should instantiate from coordinates x,y" do
140
140
  point = GeoRuby::SimpleFeatures::Point.from_coordinates([1.6,2.8],123)
141
- point.x.should eql(1.6)
142
- point.y.should eql(2.8)
143
- point.should_not be_with_z
144
- point.z.should eql(0.0)
145
- point.srid.should eql(123)
141
+ expect(point.x).to eql(1.6)
142
+ expect(point.y).to eql(2.8)
143
+ expect(point).not_to be_with_z
144
+ expect(point.z).to eql(0.0)
145
+ expect(point.srid).to eql(123)
146
146
  end
147
147
 
148
148
  it "should instantiate from coordinates x,y,z" do
149
149
  point = GeoRuby::SimpleFeatures::Point.from_coordinates([1.6,2.8,3.4],123, true)
150
- point.x.should eql(1.6)
151
- point.y.should eql(2.8)
152
- point.z.should eql(3.4)
153
- point.should be_with_z
154
- point.srid.should eql(123)
150
+ expect(point.x).to eql(1.6)
151
+ expect(point.y).to eql(2.8)
152
+ expect(point.z).to eql(3.4)
153
+ expect(point).to be_with_z
154
+ expect(point.srid).to eql(123)
155
155
  end
156
156
 
157
157
  it "should instantiate from coordinates x,y,z,m" do
158
158
  point = GeoRuby::SimpleFeatures::Point.from_coordinates([1.6,2.8,3.4,15],123, true, true)
159
- point.x.should eql(1.6)
160
- point.y.should eql(2.8)
161
- point.z.should eql(3.4)
162
- point.m.should eql(15)
163
- point.should be_with_z
164
- point.should be_with_m
165
- point.srid.should eql(123)
159
+ expect(point.x).to eql(1.6)
160
+ expect(point.y).to eql(2.8)
161
+ expect(point.z).to eql(3.4)
162
+ expect(point.m).to eql(15)
163
+ expect(point).to be_with_z
164
+ expect(point).to be_with_m
165
+ expect(point.srid).to eql(123)
166
166
  end
167
167
 
168
168
  it "should have a bbox" do
169
169
  bbox = GeoRuby::SimpleFeatures::Point.from_x_y_z_m(-1.6,2.8,-3.4,15,123).bounding_box
170
- bbox.length.should eql(2)
171
- bbox[0].should == GeoRuby::SimpleFeatures::Point.from_x_y_z(-1.6,2.8,-3.4)
172
- bbox[1].should == GeoRuby::SimpleFeatures::Point.from_x_y_z(-1.6,2.8,-3.4)
170
+ expect(bbox.length).to eql(2)
171
+ expect(bbox[0]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y_z(-1.6,2.8,-3.4))
172
+ expect(bbox[1]).to eq(GeoRuby::SimpleFeatures::Point.from_x_y_z(-1.6,2.8,-3.4))
173
173
  end
174
174
 
175
175
  it "should parse lat long" do
176
- GeoRuby::SimpleFeatures::Point.from_latlong("-20° 47' 26.37","-20° 47' 26.37").x.should be_within(0.00001).of(-20.790658)
177
- GeoRuby::SimpleFeatures::Point.from_latlong("20° 47' 26.378","20° 47' 26.378").y.should be_within(0.00001).of(20.790658)
176
+ expect(GeoRuby::SimpleFeatures::Point.from_latlong("-20° 47' 26.37","-20° 47' 26.37").x).to be_within(0.00001).of(-20.790658)
177
+ expect(GeoRuby::SimpleFeatures::Point.from_latlong("20° 47' 26.378","20° 47' 26.378").y).to be_within(0.00001).of(20.790658)
178
178
  end
179
179
 
180
180
  it "should parse lat long w/o sec" do
181
- GeoRuby::SimpleFeatures::Point.from_latlong("-20°47′26″","-20°47′26″").x.should be_within(0.00001).of(-20.790555)
182
- GeoRuby::SimpleFeatures::Point.from_latlong("20°47′26″","20°47′26″").y.should be_within(0.00001).of(20.790555)
181
+ expect(GeoRuby::SimpleFeatures::Point.from_latlong("-20°47′26″","-20°47′26″").x).to be_within(0.00001).of(-20.790555)
182
+ expect(GeoRuby::SimpleFeatures::Point.from_latlong("20°47′26″","20°47′26″").y).to be_within(0.00001).of(20.790555)
183
183
  end
184
184
 
185
185
  it "should accept with W or S notation" do
186
- GeoRuby::SimpleFeatures::Point.from_latlong("20° 47' 26.37 W","20° 47' 26.37 S").x.should be_within(0.00001).of(-20.790658)
187
- GeoRuby::SimpleFeatures::Point.from_latlong("20° 47' 26.37 W","20° 47' 26.37 S").y.should be_within(0.00001).of(-20.790658)
186
+ expect(GeoRuby::SimpleFeatures::Point.from_latlong("20° 47' 26.37 W","20° 47' 26.37 S").x).to be_within(0.00001).of(-20.790658)
187
+ expect(GeoRuby::SimpleFeatures::Point.from_latlong("20° 47' 26.37 W","20° 47' 26.37 S").y).to be_within(0.00001).of(-20.790658)
188
188
  end
189
189
 
190
190
  it "should instantiate a point from positive degrees" do
191
191
  point = GeoRuby::SimpleFeatures::Point.from_latlong('47`20 06.09E','22`50 77.35N')
192
- point.y.should be_within(0.000001).of(22.8548194)
193
- point.x.should be_within(0.000001).of(47.335025)
192
+ expect(point.y).to be_within(0.000001).of(22.8548194)
193
+ expect(point.x).to be_within(0.000001).of(47.335025)
194
194
  end
195
195
 
196
196
  it "should instantiate a point from negative degrees" do
197
197
  point = GeoRuby::SimpleFeatures::Point.from_latlong('47`20 06.09W','22`50 77.35S')
198
- point.y.should be_within(0.000001).of(-22.8548194)
199
- point.x.should be_within(0.000001).of(-47.335025)
198
+ expect(point.y).to be_within(0.000001).of(-22.8548194)
199
+ expect(point.x).to be_within(0.000001).of(-47.335025)
200
200
  end
201
201
 
202
202
  it "should print out nicely" do
203
- GeoRuby::SimpleFeatures::Point.from_x_y(47.88, -20.1).as_latlong.should eql("47°52′48″, -20°06′00″")
203
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(47.88, -20.1).as_latlong).to eql("47°52′48″, -20°06′00″")
204
204
  end
205
205
 
206
206
  it "should print out nicely latlong" do
207
- GeoRuby::SimpleFeatures::Point.from_x_y(-20.78, 20.78).as_latlong(:full => true).should eql("-20°46′48.00″, 20°46′48.00″")
207
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(-20.78, 20.78).as_latlong(:full => true)).to eql("-20°46′48.00″, 20°46′48.00″")
208
208
  end
209
209
 
210
210
  it "should print out nicely latlong" do
211
- GeoRuby::SimpleFeatures::Point.from_x_y(47.11, -20.2).as_latlong(:full => true).should eql("47°06′36.00″, -20°11′60.00″")
211
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(47.11, -20.2).as_latlong(:full => true)).to eql("47°06′36.00″, -20°11′60.00″")
212
212
  end
213
213
 
214
214
  it "should print out nicely latlong" do
215
- GeoRuby::SimpleFeatures::Point.from_x_y(47.11, -20.2).as_latlong(:coord => true).should eql("47°06′36″N, 20°11′60″W")
215
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(47.11, -20.2).as_latlong(:coord => true)).to eql("47°06′36″N, 20°11′60″W")
216
216
  end
217
217
 
218
218
  it "should print out nicely latlong" do
219
- GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_latlong(:full => true,:coord => true).should eql("47°06′36.00″S, 20°11′60.00″E")
219
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_latlong(:full => true,:coord => true)).to eql("47°06′36.00″S, 20°11′60.00″E")
220
220
  end
221
221
 
222
222
  it "should print out nicely lat" do
223
- GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_lat.should eql("-47°06′36″")
223
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_lat).to eql("-47°06′36″")
224
224
  end
225
225
 
226
226
  it "should print out nicely lat with opts" do
227
- GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_lat(:full => true).should eql("-47°06′36.00″")
227
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_lat(:full => true)).to eql("-47°06′36.00″")
228
228
  end
229
229
 
230
230
  it "should print out nicely lat with opts" do
231
- GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_lat(:full => true,:coord => true).should eql("47°06′36.00″S")
231
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_lat(:full => true,:coord => true)).to eql("47°06′36.00″S")
232
232
  end
233
233
 
234
234
  it "should print out nicely long" do
235
- GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_long.should eql("20°11′60″")
235
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_long).to eql("20°11′60″")
236
236
  end
237
237
 
238
238
  it "should print out nicely long with opts" do
239
- GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_long(:full => true).should eql("20°11′60.00″")
239
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_long(:full => true)).to eql("20°11′60.00″")
240
240
  end
241
241
 
242
242
  it "should print out nicely long with opts" do
243
- GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_long(:full => true,:coord => true).should eql("20°11′60.00″E")
243
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_long(:full => true,:coord => true)).to eql("20°11′60.00″E")
244
244
  end
245
245
 
246
246
  end
@@ -251,18 +251,18 @@ describe GeoRuby::SimpleFeatures::Point do
251
251
  let(:p2) { GeoRuby::SimpleFeatures::Point.from_x_y(2,2) }
252
252
 
253
253
  it "and a 3th grade child should calculate euclidian distance" do
254
- p1.euclidian_distance(p2).
255
- should be_within(0.00000001).of(1.4142135623731)
254
+ expect(p1.euclidian_distance(p2)).
255
+ to be_within(0.00000001).of(1.4142135623731)
256
256
  end
257
257
 
258
258
  it "should calculate spherical distance" do
259
- p1.spherical_distance(p2).
260
- should be_within(0.00000001).of(157225.358003181)
259
+ expect(p1.spherical_distance(p2)).
260
+ to be_within(0.00000001).of(157225.358003181)
261
261
  end
262
262
 
263
263
  it "should calculate ellipsoidal distance" do
264
- p1.ellipsoidal_distance(p2).
265
- should be_within(0.00000001).of(156876.149400742)
264
+ expect(p1.ellipsoidal_distance(p2)).
265
+ to be_within(0.00000001).of(156876.149400742)
266
266
  end
267
267
 
268
268
  describe "Orthogonal Distance" do
@@ -270,62 +270,62 @@ describe GeoRuby::SimpleFeatures::Point do
270
270
  let(:line2) { GeoRuby::SimpleFeatures::LineString.from_coordinates([[1,1],[1,2]], 4326) }
271
271
 
272
272
  it "should calcula orthogonal distance from a line (90 deg)" do
273
- p1.orthogonal_distance(line).should be_within(0.001).of(1.414)
273
+ expect(p1.orthogonal_distance(line)).to be_within(0.001).of(1.414)
274
274
  end
275
275
 
276
276
  it "should calcula orthogonal distance very close..." do
277
- p1.orthogonal_distance(line2).should be_zero
277
+ expect(p1.orthogonal_distance(line2)).to be_zero
278
278
  end
279
279
 
280
280
  it "should calcula orthogonal distance from a line (90 deg)" do
281
- p2.orthogonal_distance(line).should be_within(0.001).of(2.828)
281
+ expect(p2.orthogonal_distance(line)).to be_within(0.001).of(2.828)
282
282
  end
283
283
 
284
284
  it "should calcula orthogonal distance from a line (0 deg)" do
285
- p2.orthogonal_distance(line2).should be_within(0.1).of(1.0)
285
+ expect(p2.orthogonal_distance(line2)).to be_within(0.1).of(1.0)
286
286
  end
287
287
 
288
288
  it "should calcula orthogonal distance from a line (0 deg)" do
289
- p2.orthogonal_distance(line2).should be_within(0.1).of(1.0)
289
+ expect(p2.orthogonal_distance(line2)).to be_within(0.1).of(1.0)
290
290
  end
291
291
 
292
292
  end
293
293
 
294
294
  it "should calculate the bearing from apoint to another in degrees" do
295
- p1.bearing_to(p2).should be_within(0.01).of(45.0)
295
+ expect(p1.bearing_to(p2)).to be_within(0.01).of(45.0)
296
296
  end
297
297
 
298
298
  it "should calculate the bearing from apoint to another in degrees" do
299
299
  p3 = GeoRuby::SimpleFeatures::Point.from_x_y(1,-1)
300
- p1.bearing_to(p3).should be_within(0.01).of(180.0)
300
+ expect(p1.bearing_to(p3)).to be_within(0.01).of(180.0)
301
301
  end
302
302
 
303
303
  it "should calculate the bearing from apoint to another in degrees" do
304
304
  p3 = GeoRuby::SimpleFeatures::Point.from_x_y(-1,-1)
305
- p1.bearing_to(p3).should be_within(0.01).of(225.0)
305
+ expect(p1.bearing_to(p3)).to be_within(0.01).of(225.0)
306
306
  end
307
307
 
308
308
  it "should calculate the bearing from apoint to another in degrees" do
309
309
  p3 = GeoRuby::SimpleFeatures::Point.from_x_y(-1,1)
310
- p1.bearing_to(p3).should be_within(0.01).of(270.0)
310
+ expect(p1.bearing_to(p3)).to be_within(0.01).of(270.0)
311
311
  end
312
312
 
313
313
  it "should calculate the bearing from apoint to another in degrees" do
314
314
  p3 = GeoRuby::SimpleFeatures::Point.from_x_y(2,-1)
315
- p1.bearing_to(p3).should be_within(0.0001).of(153.4349488)
315
+ expect(p1.bearing_to(p3)).to be_within(0.0001).of(153.4349488)
316
316
  end
317
317
 
318
318
  it "should calculate a clone point bearing to 0" do
319
- p1.bearing_to(p1).should eql(0)
319
+ expect(p1.bearing_to(p1)).to eql(0)
320
320
  end
321
321
 
322
322
  it "should calculate the bearing from apoint to another in degrees" do
323
- p1.bearing_text(p2).should eql(:ne)
323
+ expect(p1.bearing_text(p2)).to eql(:ne)
324
324
  end
325
325
 
326
326
  it "should calculate the bearing from apoint to another in degrees" do
327
327
  p3 = GeoRuby::SimpleFeatures::Point.from_x_y(-1,1)
328
- p1.bearing_text(p3).should eql(:w)
328
+ expect(p1.bearing_text(p3)).to eql(:w)
329
329
  end
330
330
 
331
331
  end
@@ -339,80 +339,88 @@ describe GeoRuby::SimpleFeatures::Point do
339
339
  end
340
340
 
341
341
  it "should print nicely" do
342
- point.text_representation.should eql("-11.2431 32.3141")
342
+ expect(point.text_representation).to eql("-11.2431 32.3141")
343
343
  end
344
344
 
345
345
  it "should printoout as binary" do
346
- GeoRuby::SimpleFeatures::Point.from_x_y(12.4,45.3,123).as_hex_ewkb.should eql("01010000207B000000CDCCCCCCCCCC28406666666666A64640")
346
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(12.4,45.3,123).as_hex_ewkb).to eql("01010000207B000000CDCCCCCCCCCC28406666666666A64640")
347
347
  point = GeoRuby::SimpleFeatures::Point.from_x_y_z_m(12.4,45.3,-3.5,15,123)
348
- point.as_hex_ewkb.should eql("01010000E07B000000CDCCCCCCCCCC28406666666666A646400000000000000CC00000000000002E40")
349
- point.as_hex_wkb.should eql("0101000000CDCCCCCCCCCC28406666666666A64640")
348
+ expect(point.as_hex_ewkb).to eql("01010000E07B000000CDCCCCCCCCCC28406666666666A646400000000000000CC00000000000002E40")
349
+ expect(point.as_hex_wkb).to eql("0101000000CDCCCCCCCCCC28406666666666A64640")
350
350
  end
351
351
 
352
352
  it "should printoout as text" do
353
- GeoRuby::SimpleFeatures::Point.from_x_y(12.4,45.3,123).as_ewkt.should eql("SRID=123;POINT(12.4 45.3)")
353
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(12.4,45.3,123).as_ewkt).to eql("SRID=123;POINT(12.4 45.3)")
354
354
  point = GeoRuby::SimpleFeatures::Point.from_x_y_z(12.4,45.3,-3.5,123)
355
- point.as_ewkt.should eql("SRID=123;POINT(12.4 45.3 -3.5)")
356
- point.as_wkt.should eql("POINT(12.4 45.3)")
357
- point.as_ewkt(false,true).should eql("POINT(12.4 45.3 -3.5)")
355
+ expect(point.as_ewkt).to eql("SRID=123;POINT(12.4 45.3 -3.5)")
356
+ expect(point.as_wkt).to eql("POINT(12.4 45.3)")
357
+ expect(point.as_ewkt(false,true)).to eql("POINT(12.4 45.3 -3.5)")
358
358
  point = GeoRuby::SimpleFeatures::Point.from_x_y_m(12.4,45.3,-3.5,123)
359
- point.as_ewkt.should eql("SRID=123;POINTM(12.4 45.3 -3.5)")
360
- point.as_ewkt(true,true,false).should eql("SRID=123;POINT(12.4 45.3)")
359
+ expect(point.as_ewkt).to eql("SRID=123;POINTM(12.4 45.3 -3.5)")
360
+ expect(point.as_ewkt(true,true,false)).to eql("SRID=123;POINT(12.4 45.3)")
361
361
  end
362
362
 
363
363
  it "should have a nice bounding box" do
364
- point.should have(2).bounding_box
364
+ expect(point.bounding_box.size).to eq(2)
365
365
  point.bounding_box.each do |point|
366
- point.x.should eql(point.x)
367
- point.y.should eql(point.y)
366
+ expect(point.x).to eql(point.x)
367
+ expect(point.y).to eql(point.y)
368
368
  end
369
369
  end
370
370
 
371
371
  it "should print as kml too" do
372
- point.kml_representation.should eql("<Point>\n<coordinates>-11.2431,32.3141</coordinates>\n</Point>\n")
372
+ expect(point.kml_representation).to eql("<Point>\n<coordinates>-11.2431,32.3141</coordinates>\n</Point>\n")
373
373
  end
374
374
 
375
375
  it "should print as html too" do
376
- point.html_representation.should eql("<span class='geo'><abbr class='latitude' title='-11.2431'>11°14′35″S</abbr><abbr class='longitude' title='32.3141'>32°18′51″E</abbr></span>")
376
+ expect(point.html_representation).to eql("<span class='geo'><abbr class='latitude' title='-11.2431'>11°14′35″S</abbr><abbr class='longitude' title='32.3141'>32°18′51″E</abbr></span>")
377
377
  end
378
378
 
379
379
  it "should print as html too with opts" do
380
- point.html_representation(coord: false).should eql("<span class='geo'><abbr class='latitude' title='-11.2431'>-11°14′35″</abbr><abbr class='longitude' title='32.3141'>32°18′51″</abbr></span>")
380
+ expect(point.html_representation(coord: false)).to eql("<span class='geo'><abbr class='latitude' title='-11.2431'>-11°14′35″</abbr><abbr class='longitude' title='32.3141'>32°18′51″</abbr></span>")
381
381
  end
382
382
 
383
383
  it "should print as html too with opts" do
384
- point.html_representation(full: true).should eql("<span class='geo'><abbr class='latitude' title='-11.2431'>11°14′35.16″S</abbr><abbr class='longitude' title='32.3141'>32°18′50.76″E</abbr></span>")
384
+ expect(point.html_representation(full: true)).to eql("<span class='geo'><abbr class='latitude' title='-11.2431'>11°14′35.16″S</abbr><abbr class='longitude' title='32.3141'>32°18′50.76″E</abbr></span>")
385
385
  end
386
386
 
387
387
  it "should print as georss" do
388
- point.georss_simple_representation(:georss_ns => 'hey').should eql("<hey:point>32.3141 -11.2431</hey:point>\n")
388
+ expect(point.georss_simple_representation(:georss_ns => 'hey')).to eql("<hey:point>32.3141 -11.2431</hey:point>\n")
389
389
  end
390
390
 
391
391
  it "should print r (polar coords)" do
392
- point.r.should be_within(0.000001).of(34.214154)
392
+ expect(point.r).to be_within(0.000001).of(34.214154)
393
393
  end
394
394
 
395
395
  it "should print theta as degrees" do
396
- point.theta_deg.should be_within(0.0001).of(289.184406352127)
396
+ expect(point.theta_deg).to be_within(0.0001).of(289.184406352127)
397
397
  end
398
398
 
399
399
  it "should print theta as radians" do
400
- point.theta_rad.should be_within(0.0001).of(5.04722003626982)
400
+ expect(point.theta_rad).to be_within(0.0001).of(5.04722003626982)
401
401
  end
402
402
 
403
403
  it "should print theta when x is zero y > 0" do
404
404
  pt = GeoRuby::SimpleFeatures::Point.from_x_y(0.0, 32.3141)
405
- pt.theta_rad.should be_within(0.0001).of(1.5707963267948966)
405
+ expect(pt.theta_rad).to be_within(0.0001).of(1.5707963267948966)
406
406
  end
407
407
 
408
408
  it "should print theta when x is zero y < 0" do
409
409
  pt = GeoRuby::SimpleFeatures::Point.from_x_y(0.0, -32.3141)
410
- pt.theta_rad.should be_within(0.0001).of(4.71238898038469)
410
+ expect(pt.theta_rad).to be_within(0.0001).of(4.71238898038469)
411
411
  end
412
412
 
413
413
  it "should output as polar" do
414
- point.as_polar.should be_instance_of(Array)
415
- point.should have(2).as_polar #.length.should eql(2)
414
+ expect(point.as_polar).to be_instance_of(Array)
415
+ expect(point.as_polar.size).to eq(2) #.length.should eql(2)
416
+ end
417
+
418
+ it "should print out nicely as json/geojson" do
419
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).as_json).to eql({:type=>"Point", :coordinates=>[-47.11, 20.2]})
420
+ end
421
+
422
+ it "should print out nicely to json/geojson" do
423
+ expect(GeoRuby::SimpleFeatures::Point.from_x_y(-47.11, 20.2).to_json).to eql("{\"type\":\"Point\",\"coordinates\":[-47.11,20.2]}")
416
424
  end
417
425
 
418
426
  end