test/terraformer_spec.rb in terraformer-0.0.8 vs test/terraformer_spec.rb in terraformer-0.0.9

- old
+ new

@@ -52,9 +52,28 @@ p.coordinates[1].must_be_instance_of Array p.coordinates[1][0].must_equal Terraformer::Coordinate.new 102, 2 p.coordinates[1][1].must_equal Terraformer::Coordinate.new 103, 3 end + it 'parses geojson files' do + file = File.open('test/examples/point.geojson') + p = Terraformer.parse file + p.dont_be_terrible_ok + p.type.must_equal 'Point' + p.coordinates.must_be_instance_of Terraformer::Coordinate + p.coordinates.must_equal Terraformer::Coordinate.new 100, 0 + end + + it 'parses the target of a Pathname' do + require "pathname" + path = Pathname.new('test/examples/point.geojson') + p = Terraformer.parse path + p.dont_be_terrible_ok + p.type.must_equal 'Point' + p.coordinates.must_be_instance_of Terraformer::Coordinate + p.coordinates.must_equal Terraformer::Coordinate.new 100, 0 + end + it 'parses polygons' do p = Terraformer.parse EXAMPLES[:polygon] p.dont_be_terrible_ok p.type.must_equal 'Polygon' p.coordinates.must_be_instance_of Array