Commit 6fc4f28b
Changed files (2)
app
services
infrastructure
spec
services
infrastructure
app/services/infrastructure/exif_parser.rb
@@ -2,8 +2,8 @@ class ExifParser
def parse_geolocation_from(file)
exif = EXIFR::JPEG.new(file)
return [exif.gps.latitude, exif.gps.longitude] if exif.gps.present?
- [0, 0]
+ [nil, nil]
rescue EXIFR::MalformedJPEG
- [0, 0]
+ [nil, nil]
end
end
spec/services/infrastructure/exif_parser_spec.rb
@@ -13,13 +13,13 @@ describe ExifParser do
it "ignores png files" do
latitude, longitude = subject.parse_geolocation_from(png_file)
- latitude.should == 0
- longitude.should == 0
+ latitude.should be_nil
+ longitude.should be_nil
end
it "ignores jpg files with no gps info" do
latitude, longitude = subject.parse_geolocation_from(jpg_no_gps)
- latitude.should == 0
- longitude.should == 0
+ latitude.should be_nil
+ longitude.should be_nil
end
end