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
@@ -3,10 +3,10 @@ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
3
3
  describe GeoRuby::Gpx4r do
4
4
 
5
5
  it "should add gpx extension and raise if doesn't exists" do
6
- lambda do
7
- File.should_receive(:exists?).with("short.gpx").and_return(false)
8
- GeoRuby::Gpx4r::GpxFile.open('short').should be_true
9
- end.should raise_error GeoRuby::Gpx4r::MalformedGpxException
6
+ expect do
7
+ expect(File).to receive(:exists?).with("short.gpx").and_return(false)
8
+ expect(GeoRuby::Gpx4r::GpxFile.open('short')).to be_truthy
9
+ end.to raise_error GeoRuby::Gpx4r::MalformedGpxException
10
10
  end
11
11
 
12
12
  describe "Waypoints" do
@@ -18,75 +18,75 @@ describe GeoRuby::Gpx4r do
18
18
  end
19
19
 
20
20
  it "should open and parse" do
21
- @gpxfile.record_count.should eql(2724)
21
+ expect(@gpxfile.record_count).to eql(2724)
22
22
  end
23
23
 
24
24
  it "should open and parse no trkpt one" do
25
- @gpxfile2.record_count.should eql(86)
25
+ expect(@gpxfile2.record_count).to eql(86)
26
26
  end
27
27
 
28
28
  it "should open and parse 3" do
29
- @gpxfile3.record_count.should eql(225)
29
+ expect(@gpxfile3.record_count).to eql(225)
30
30
  end
31
31
 
32
32
  it "should read X and Y" do
33
- @gpxfile[0].x.should be_within(0.0001).of(9.093942)
34
- @gpxfile[0].y.should be_within(0.0001).of(48.731813)
33
+ expect(@gpxfile[0].x).to be_within(0.0001).of(9.093942)
34
+ expect(@gpxfile[0].y).to be_within(0.0001).of(48.731813)
35
35
  end
36
36
 
37
37
  it "should read Z and M" do
38
- @gpxfile[0].z.should eql(468.0)
39
- @gpxfile[0].m.should eql("2008-09-07T17:36:57Z")
38
+ expect(@gpxfile[0].z).to eql(468.0)
39
+ expect(@gpxfile[0].m).to eql("2008-09-07T17:36:57Z")
40
40
  end
41
41
 
42
42
  it "should read X and Y 2" do
43
- @gpxfile2[0].x.should be_within(0.0001).of(-71.119277)
44
- @gpxfile2[0].y.should be_within(0.0001).of(42.438878)
43
+ expect(@gpxfile2[0].x).to be_within(0.0001).of(-71.119277)
44
+ expect(@gpxfile2[0].y).to be_within(0.0001).of(42.438878)
45
45
  end
46
46
 
47
47
  it "should read Z and M 2" do
48
- @gpxfile2[0].z.should eql(44.586548)
49
- @gpxfile2[0].m.should eql("2001-11-28T21:05:28Z")
48
+ expect(@gpxfile2[0].z).to eql(44.586548)
49
+ expect(@gpxfile2[0].m).to eql("2001-11-28T21:05:28Z")
50
50
  end
51
51
 
52
52
  it "should read X and Y 3" do
53
- @gpxfile3[0].x.should be_within(0.0001).of(-149.8358011)
54
- @gpxfile3[0].y.should be_within(0.0001).of(-17.5326508)
53
+ expect(@gpxfile3[0].x).to be_within(0.0001).of(-149.8358011)
54
+ expect(@gpxfile3[0].y).to be_within(0.0001).of(-17.5326508)
55
55
  end
56
56
 
57
57
  it "should read Z and M 3" do
58
- @gpxfile3[0].z.should eql(88.5787354)
59
- @gpxfile3[0].m.should eql(0.0)
58
+ expect(@gpxfile3[0].z).to eql(88.5787354)
59
+ expect(@gpxfile3[0].m).to eql(0.0)
60
60
  end
61
61
 
62
62
  it "should return it as a linestring" do
63
- @gpxfile.as_line_string.should be_instance_of GeoRuby::SimpleFeatures::LineString
64
- @gpxfile.as_polyline.should be_instance_of GeoRuby::SimpleFeatures::LineString
63
+ expect(@gpxfile.as_line_string).to be_instance_of GeoRuby::SimpleFeatures::LineString
64
+ expect(@gpxfile.as_polyline).to be_instance_of GeoRuby::SimpleFeatures::LineString
65
65
  end
66
66
 
67
67
  it "should return it as a linestring 3" do
68
- @gpxfile3.as_line_string.should be_instance_of GeoRuby::SimpleFeatures::LineString
69
- @gpxfile3.as_polyline.should be_instance_of GeoRuby::SimpleFeatures::LineString
68
+ expect(@gpxfile3.as_line_string).to be_instance_of GeoRuby::SimpleFeatures::LineString
69
+ expect(@gpxfile3.as_polyline).to be_instance_of GeoRuby::SimpleFeatures::LineString
70
70
  end
71
71
 
72
72
  it "should return a envelope" do
73
- @gpxfile.envelope.should be_instance_of GeoRuby::SimpleFeatures::Envelope
74
- @gpxfile.envelope.lower_corner.x.should be_within(0.001).of(9.08128)
75
- @gpxfile.envelope.lower_corner.y.should be_within(0.001).of(48.7169)
73
+ expect(@gpxfile.envelope).to be_instance_of GeoRuby::SimpleFeatures::Envelope
74
+ expect(@gpxfile.envelope.lower_corner.x).to be_within(0.001).of(9.08128)
75
+ expect(@gpxfile.envelope.lower_corner.y).to be_within(0.001).of(48.7169)
76
76
  end
77
77
 
78
78
  it "should return a envelope 3" do
79
- @gpxfile3.envelope.should be_instance_of GeoRuby::SimpleFeatures::Envelope
80
- @gpxfile3.envelope.lower_corner.x.should be_within(0.001).of(-149.8422613)
81
- @gpxfile3.envelope.lower_corner.y.should be_within(0.001).of(-17.547636)
79
+ expect(@gpxfile3.envelope).to be_instance_of GeoRuby::SimpleFeatures::Envelope
80
+ expect(@gpxfile3.envelope.lower_corner.x).to be_within(0.001).of(-149.8422613)
81
+ expect(@gpxfile3.envelope.lower_corner.y).to be_within(0.001).of(-17.547636)
82
82
  end
83
83
 
84
84
  it "should return it as a polygon" do
85
85
  [@gpxfile, @gpxfile2, @gpxfile3].each do |g|
86
- g.as_polygon.should be_instance_of GeoRuby::SimpleFeatures::Polygon
87
- g.as_polygon[0].should be_instance_of GeoRuby::SimpleFeatures::LinearRing
88
- g.as_polygon[0].should be_closed
89
- g.as_polygon[1].should be_nil
86
+ expect(g.as_polygon).to be_instance_of GeoRuby::SimpleFeatures::Polygon
87
+ expect(g.as_polygon[0]).to be_instance_of GeoRuby::SimpleFeatures::LinearRing
88
+ expect(g.as_polygon[0]).to be_closed
89
+ expect(g.as_polygon[1]).to be_nil
90
90
  end
91
91
  end
92
92
 
@@ -96,7 +96,7 @@ describe GeoRuby::Gpx4r do
96
96
  nw = GeoRuby::SimpleFeatures::Point.from_x_y(-42, -25)
97
97
  ne = GeoRuby::SimpleFeatures::Point.from_x_y(-44, -21)
98
98
  @gpxfile.instance_variable_set(:@points, [se,sw,nw,ne])
99
- @gpxfile.as_polygon.should == GeoRuby::SimpleFeatures::Polygon.from_points([[se,sw,nw,ne,se]])
99
+ expect(@gpxfile.as_polygon).to eq(GeoRuby::SimpleFeatures::Polygon.from_points([[se,sw,nw,ne,se]]))
100
100
  end
101
101
  end
102
102
 
@@ -20,59 +20,59 @@ describe GeoRuby::KmlParser do
20
20
  it "should parse a GeoRuby::SimpleFeatures::Point correctly" do
21
21
  @kml_parser.parse(POINT)
22
22
  g = @factory.geometry
23
- g.should_not eql(nil)
24
- g.should be_an_instance_of(GeoRuby::SimpleFeatures::Point)
25
- g.as_kml.gsub(/\n/,'').should eql(POINT)
23
+ expect(g).not_to eql(nil)
24
+ expect(g).to be_an_instance_of(GeoRuby::SimpleFeatures::Point)
25
+ expect(g.as_kml.gsub(/\n/,'')).to eql(POINT)
26
26
  end
27
27
 
28
28
  it "should parse a GeoRuby::SimpleFeatures::LineString correctly" do
29
29
  @kml_parser.parse(LINESTRING)
30
30
  g = @factory.geometry
31
- g.should_not eql(nil)
32
- g.should be_an_instance_of(GeoRuby::SimpleFeatures::LineString)
33
- g.as_kml.gsub(/\n/,'').should eql(LINESTRING)
31
+ expect(g).not_to eql(nil)
32
+ expect(g).to be_an_instance_of(GeoRuby::SimpleFeatures::LineString)
33
+ expect(g.as_kml.gsub(/\n/,'')).to eql(LINESTRING)
34
34
 
35
35
  @kml_parser.parse(LINEARRING)
36
36
  g = @factory.geometry
37
- g.should_not eql(nil)
38
- g.should be_an_instance_of(GeoRuby::SimpleFeatures::LinearRing)
39
- g.as_kml.gsub(/\n/,'').should eql(LINEARRING)
37
+ expect(g).not_to eql(nil)
38
+ expect(g).to be_an_instance_of(GeoRuby::SimpleFeatures::LinearRing)
39
+ expect(g.as_kml.gsub(/\n/,'')).to eql(LINEARRING)
40
40
  end
41
41
 
42
42
  it "should parse a GeoRuby::SimpleFeatures::Polygon correctly" do
43
43
  @kml_parser.parse(POLYGON)
44
44
  g = @factory.geometry
45
- g.should_not eql(nil)
46
- g.should be_an_instance_of(GeoRuby::SimpleFeatures::Polygon)
47
- g.as_kml.gsub(/\n/,'').should eql(POLYGON)
45
+ expect(g).not_to eql(nil)
46
+ expect(g).to be_an_instance_of(GeoRuby::SimpleFeatures::Polygon)
47
+ expect(g.as_kml.gsub(/\n/,'')).to eql(POLYGON)
48
48
 
49
49
  @kml_parser.parse(COMPLEX_POLYGON)
50
50
  g = @factory.geometry
51
- g.should_not eql(nil)
52
- g.should be_an_instance_of(GeoRuby::SimpleFeatures::Polygon)
53
- g.as_kml.gsub(/\n/,'').should eql(COMPLEX_POLYGON)
51
+ expect(g).not_to eql(nil)
52
+ expect(g).to be_an_instance_of(GeoRuby::SimpleFeatures::Polygon)
53
+ expect(g.as_kml.gsub(/\n/,'')).to eql(COMPLEX_POLYGON)
54
54
  end
55
55
 
56
56
  it "should parse a MultiGeometry correctly" do
57
57
  @kml_parser.parse(MULTIGEOMETRY)
58
58
  g = @factory.geometry
59
- g.should_not eql(nil)
60
- g.geometries.length.should eql(2)
61
- g.should be_an_instance_of(GeoRuby::SimpleFeatures::GeometryCollection)
62
- g.as_kml.gsub(/\n/,'').should eql(MULTIGEOMETRY)
59
+ expect(g).not_to eql(nil)
60
+ expect(g.geometries.length).to eql(2)
61
+ expect(g).to be_an_instance_of(GeoRuby::SimpleFeatures::GeometryCollection)
62
+ expect(g.as_kml.gsub(/\n/,'')).to eql(MULTIGEOMETRY)
63
63
  end
64
64
 
65
65
  it "should parse 3D geometries correctly" do
66
66
  # not testing generation because GeoRuby kml generation logic currently requires additional
67
67
  # XML nodes to actually output 3D coordinate information. I might modify that behavior
68
68
  g = @kml_parser.parse(POINT3D)
69
- g.should_not eql(nil)
70
- g.with_z.should eql(true)
69
+ expect(g).not_to eql(nil)
70
+ expect(g.with_z).to eql(true)
71
71
  # g.as_kml(:altitude_mode => "clampToGround").gsub(/\n/,'').should eql(POINT3D)
72
72
 
73
73
  g = @kml_parser.parse(LINESTRING3D)
74
- g.should_not eql(nil)
75
- g.with_z.should eql(true)
74
+ expect(g).not_to eql(nil)
75
+ expect(g.with_z).to eql(true)
76
76
  # g.as_kml(:altitude_mode => "clampToGround").gsub(/\n/,'').should eql(LINESTRING3D)
77
77
  end
78
78
 
@@ -80,9 +80,9 @@ describe GeoRuby::KmlParser do
80
80
  [LINESTRING, LINEARRING, POLYGON, COMPLEX_POLYGON, MULTIGEOMETRY, LINESTRING3D].each do |kml|
81
81
  @kml_parser.parse(kml)
82
82
  g = @factory.geometry
83
- lambda {
83
+ expect {
84
84
  g.bounding_box
85
- }.should_not raise_error
85
+ }.not_to raise_error
86
86
  end
87
87
  end
88
88
 
@@ -90,9 +90,9 @@ describe GeoRuby::KmlParser do
90
90
  [LINESTRING, LINEARRING, POLYGON, COMPLEX_POLYGON, MULTIGEOMETRY, LINESTRING3D].each do |kml|
91
91
  @kml_parser.parse(kml)
92
92
  g = @factory.geometry
93
- lambda {
93
+ expect {
94
94
  g.envelope.center
95
- }.should_not raise_error
95
+ }.not_to raise_error
96
96
  end
97
97
  end
98
98
  end
@@ -8,31 +8,31 @@ describe GeoRuby::Shp4r do
8
8
  end
9
9
 
10
10
  it "should parse ok" do
11
- @shpfile.record_count.should eql(2)
12
- @shpfile.should have(1).fields
13
- @shpfile.shp_type.should eql(GeoRuby::Shp4r::ShpType::POINT)
11
+ expect(@shpfile.record_count).to eql(2)
12
+ expect(@shpfile.fields.size).to eq(1)
13
+ expect(@shpfile.shp_type).to eql(GeoRuby::Shp4r::ShpType::POINT)
14
14
  end
15
15
 
16
16
  it "should parse fields" do
17
17
  field = @shpfile.fields.first
18
- field.name.should eql("Hoyoyo")
19
- field.type.should eql("N")
18
+ expect(field.name).to eql("Hoyoyo")
19
+ expect(field.type).to eql("N")
20
20
  end
21
21
 
22
22
  it "should parse record 1" do
23
23
  rec = @shpfile[0]
24
- rec.geometry.should be_kind_of GeoRuby::SimpleFeatures::Point
25
- rec.geometry.x.should be_within(0.00001).of(-90.08375)
26
- rec.geometry.y.should be_within(0.00001).of(34.39996)
27
- rec.data["Hoyoyo"].should eql(6)
24
+ expect(rec.geometry).to be_kind_of GeoRuby::SimpleFeatures::Point
25
+ expect(rec.geometry.x).to be_within(0.00001).of(-90.08375)
26
+ expect(rec.geometry.y).to be_within(0.00001).of(34.39996)
27
+ expect(rec.data["Hoyoyo"]).to eql(6)
28
28
  end
29
29
 
30
30
  it "should parse record 2" do
31
31
  rec = @shpfile[1]
32
- rec.geometry.should be_kind_of GeoRuby::SimpleFeatures::Point
33
- rec.geometry.x.should be_within(0.00001).of(-87.82580)
34
- rec.geometry.y.should be_within(0.00001).of(33.36416)
35
- rec.data["Hoyoyo"].should eql(9)
32
+ expect(rec.geometry).to be_kind_of GeoRuby::SimpleFeatures::Point
33
+ expect(rec.geometry.x).to be_within(0.00001).of(-87.82580)
34
+ expect(rec.geometry.y).to be_within(0.00001).of(33.36416)
35
+ expect(rec.data["Hoyoyo"]).to eql(9)
36
36
  end
37
37
 
38
38
  end
@@ -43,25 +43,25 @@ describe GeoRuby::Shp4r do
43
43
  end
44
44
 
45
45
  it "should parse ok" do
46
- @shpfile.record_count.should eql(1)
47
- @shpfile.should have(1).fields
48
- @shpfile.shp_type.should eql(GeoRuby::Shp4r::ShpType::POLYLINE)
46
+ expect(@shpfile.record_count).to eql(1)
47
+ expect(@shpfile.fields.size).to eq(1)
48
+ expect(@shpfile.shp_type).to eql(GeoRuby::Shp4r::ShpType::POLYLINE)
49
49
  end
50
50
 
51
51
  it "should parse fields" do
52
52
  field = @shpfile.fields.first
53
- field.name.should eql("Chipoto")
53
+ expect(field.name).to eql("Chipoto")
54
54
  # GeoRuby::Shp4r::Dbf now uses the decimal to choose between int and float
55
55
  # So here is N instead of F
56
- field.type.should eql("N")
56
+ expect(field.type).to eql("N")
57
57
  end
58
58
 
59
59
  it "should parse record 1" do
60
60
  rec = @shpfile[0]
61
- rec.geometry.should be_kind_of GeoRuby::SimpleFeatures::MultiLineString
62
- rec.geometry.length.should eql(1)
63
- rec.geometry[0].length.should eql(6)
64
- rec.data["Chipoto"].should eql(5.678)
61
+ expect(rec.geometry).to be_kind_of GeoRuby::SimpleFeatures::MultiLineString
62
+ expect(rec.geometry.length).to eql(1)
63
+ expect(rec.geometry[0].length).to eql(6)
64
+ expect(rec.data["Chipoto"]).to eql(5.678)
65
65
  end
66
66
 
67
67
  end
@@ -72,24 +72,24 @@ describe GeoRuby::Shp4r do
72
72
  end
73
73
 
74
74
  it "should parse ok" do
75
- @shpfile.record_count.should eql(1)
76
- @shpfile.should have(1).fields
77
- @shpfile.shp_type.should eql(GeoRuby::Shp4r::ShpType::POLYGON)
75
+ expect(@shpfile.record_count).to eql(1)
76
+ expect(@shpfile.fields.size).to eq(1)
77
+ expect(@shpfile.shp_type).to eql(GeoRuby::Shp4r::ShpType::POLYGON)
78
78
  end
79
79
 
80
80
  it "should parse fields" do
81
81
  field = @shpfile.fields.first
82
- field.name.should eql("Hello")
83
- field.type.should eql("C")
82
+ expect(field.name).to eql("Hello")
83
+ expect(field.type).to eql("C")
84
84
  end
85
85
 
86
86
  it "should parse record 1" do
87
87
  rec = @shpfile[0]
88
- rec.geometry.should be_kind_of GeoRuby::SimpleFeatures::MultiPolygon
89
- rec.geometry.length.should eql(1)
90
- rec.geometry[0].length.should eql(1)
91
- rec.geometry[0][0].length.should eql(7)
92
- rec.data["Hello"].should eql("Bouyoul!")
88
+ expect(rec.geometry).to be_kind_of GeoRuby::SimpleFeatures::MultiPolygon
89
+ expect(rec.geometry.length).to eql(1)
90
+ expect(rec.geometry[0].length).to eql(1)
91
+ expect(rec.geometry[0][0].length).to eql(7)
92
+ expect(rec.data["Hello"]).to eql("Bouyoul!")
93
93
  end
94
94
  end
95
95
 
@@ -112,13 +112,13 @@ describe GeoRuby::Shp4r do
112
112
  shpfile = GeoRuby::Shp4r::ShpFile.open(File.dirname(__FILE__) + '/../../data/point2.shp')
113
113
 
114
114
  shpfile.transaction do |tr|
115
- tr.should be_instance_of GeoRuby::Shp4r::ShpTransaction
115
+ expect(tr).to be_instance_of GeoRuby::Shp4r::ShpTransaction
116
116
  tr.add(GeoRuby::Shp4r::ShpRecord.new(GeoRuby::SimpleFeatures::Point.from_x_y(123.4,123.4),'Hoyoyo' => 5))
117
117
  tr.add(GeoRuby::Shp4r::ShpRecord.new(GeoRuby::SimpleFeatures::Point.from_x_y(-16.67,16.41),'Hoyoyo' => -7))
118
118
  tr.delete(1)
119
119
  end
120
120
 
121
- shpfile.record_count.should eql(3)
121
+ expect(shpfile.record_count).to eql(3)
122
122
 
123
123
  shpfile.close
124
124
  rm_all_shp(File.dirname(__FILE__) + '/../../data/point2')
@@ -131,13 +131,13 @@ describe GeoRuby::Shp4r do
131
131
  shpfile = GeoRuby::Shp4r::ShpFile.open(File.dirname(__FILE__) + '/../../data/polyline2.shp')
132
132
 
133
133
  shpfile.transaction do |tr|
134
- tr.should be_instance_of GeoRuby::Shp4r::ShpTransaction
134
+ expect(tr).to be_instance_of GeoRuby::Shp4r::ShpTransaction
135
135
  tr.add(GeoRuby::Shp4r::ShpRecord.new(GeoRuby::SimpleFeatures::LineString.from_coordinates([[123.4,123.4],[45.6,12.3]]),'Chipoto' => 5.6778))
136
136
  tr.add(GeoRuby::Shp4r::ShpRecord.new(GeoRuby::SimpleFeatures::LineString.from_coordinates([[23.4,13.4],[45.6,12.3],[12,-67]]),'Chipoto' => -7.1))
137
137
  tr.delete(0)
138
138
  end
139
139
 
140
- shpfile.record_count.should eql(2)
140
+ expect(shpfile.record_count).to eql(2)
141
141
  shpfile.close
142
142
  rm_all_shp(File.dirname(__FILE__) + '/../../data/polyline2')
143
143
  end
@@ -148,12 +148,12 @@ describe GeoRuby::Shp4r do
148
148
  shpfile = GeoRuby::Shp4r::ShpFile.open(File.dirname(__FILE__) + '/../../data/polygon2.shp')
149
149
 
150
150
  shpfile.transaction do |tr|
151
- tr.should be_instance_of GeoRuby::Shp4r::ShpTransaction
151
+ expect(tr).to be_instance_of GeoRuby::Shp4r::ShpTransaction
152
152
  tr.delete(0)
153
153
  tr.add(GeoRuby::Shp4r::ShpRecord.new(GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[0,0],[40,0],[40,40],[0,40],[0,0]],[[10,10],[10,20],[20,20],[10,10]]]),'Hello' => "oook"))
154
154
  end
155
155
 
156
- shpfile.record_count.should eql(1)
156
+ expect(shpfile.record_count).to eql(1)
157
157
 
158
158
  shpfile.close
159
159
  rm_all_shp(File.dirname(__FILE__) + '/../../data/polygon2')
@@ -165,11 +165,11 @@ describe GeoRuby::Shp4r do
165
165
  shpfile = GeoRuby::Shp4r::ShpFile.open(File.dirname(__FILE__) + '/../../data/multipoint2.shp')
166
166
 
167
167
  shpfile.transaction do |tr|
168
- tr.should be_instance_of GeoRuby::Shp4r::ShpTransaction
168
+ expect(tr).to be_instance_of GeoRuby::Shp4r::ShpTransaction
169
169
  tr.add(GeoRuby::Shp4r::ShpRecord.new(GeoRuby::SimpleFeatures::MultiPoint.from_coordinates([[45.6,-45.1],[12.4,98.2],[51.2,-0.12],[156.12345,56.109]]),'Hello' => 5,"Hoyoyo" => "AEZAE"))
170
170
  end
171
171
 
172
- shpfile.record_count.should eql(2)
172
+ expect(shpfile.record_count).to eql(2)
173
173
 
174
174
  shpfile.close
175
175
  rm_all_shp(File.dirname(__FILE__) + '/../../data/multipoint2')
@@ -182,11 +182,11 @@ describe GeoRuby::Shp4r do
182
182
  shpfile = GeoRuby::Shp4r::ShpFile.open(File.dirname(__FILE__) + '/../../data/polygon4.shp')
183
183
 
184
184
  shpfile.transaction do |tr|
185
- tr.should be_instance_of GeoRuby::Shp4r::ShpTransaction
185
+ expect(tr).to be_instance_of GeoRuby::Shp4r::ShpTransaction
186
186
  tr.add(GeoRuby::Shp4r::ShpRecord.new(GeoRuby::SimpleFeatures::MultiPolygon.from_polygons([GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[0,0],[40,0],[40,40],[0,40],[0,0]],[[10,10],[10,20],[20,20],[10,10]]])]),'Hello' => "oook"))
187
187
  end
188
188
 
189
- shpfile.record_count.should eql(2)
189
+ expect(shpfile.record_count).to eql(2)
190
190
 
191
191
  shpfile.close
192
192
 
@@ -200,11 +200,11 @@ describe GeoRuby::Shp4r do
200
200
  shpfile = GeoRuby::Shp4r::ShpFile.open(File.dirname(__FILE__) + '/../../data/polygon5.shp')
201
201
 
202
202
  shpfile.transaction do |tr|
203
- tr.should be_instance_of GeoRuby::Shp4r::ShpTransaction
203
+ expect(tr).to be_instance_of GeoRuby::Shp4r::ShpTransaction
204
204
  tr.add(GeoRuby::Shp4r::ShpRecord.new(GeoRuby::SimpleFeatures::MultiPolygon.from_polygons([GeoRuby::SimpleFeatures::Polygon.from_coordinates([[[0,0],[40,0],[40,40],[0,40],[0,0]],[[10,10],[10,20],[20,20],[10,10]]])]),'Hello' => "oook"))
205
205
  tr.rollback
206
206
  end
207
- shpfile.record_count.should eql(1)
207
+ expect(shpfile.record_count).to eql(1)
208
208
 
209
209
  shpfile.close
210
210
 
@@ -217,7 +217,7 @@ describe GeoRuby::Shp4r do
217
217
  shpfile.transaction do |tr|
218
218
  tr.add(GeoRuby::Shp4r::ShpRecord.new(GeoRuby::SimpleFeatures::Point.from_x_y(123,123.4),'Hoyoyo' => "HJHJJ"))
219
219
  end
220
- shpfile.record_count.should eql(1)
220
+ expect(shpfile.record_count).to eql(1)
221
221
  shpfile.close
222
222
  rm_all_shp(File.dirname(__FILE__) + '/../../data/point3')
223
223
  end
@@ -227,7 +227,7 @@ describe GeoRuby::Shp4r do
227
227
  shpfile.transaction do |tr|
228
228
  tr.add(GeoRuby::Shp4r::ShpRecord.new(GeoRuby::SimpleFeatures::MultiPoint.from_coordinates([[123,123.4],[345,12.2]]),'Hoyoyo' => "HJHJJ","Hello" => 5))
229
229
  end
230
- shpfile.record_count.should eql(1)
230
+ expect(shpfile.record_count).to eql(1)
231
231
  shpfile.close
232
232
  rm_all_shp(File.dirname(__FILE__) + '/../../data/multipoint3')
233
233
  end