Permalink
Browse files

Add km when no result.

Signed-off-by: Laurent Arnoud <laurent@spkdev.net>
  • Loading branch information...
1 parent a957aab commit a1b507de8bc5c04f3459ca1745c3fd565f49c3ea @spk spk committed Oct 25, 2011
Showing with 6 additions and 1 deletion.
  1. +1 −1 lib/google_directions.rb
  2. +5 −0 test/unit/google_directions_test.rb
View
@@ -58,7 +58,7 @@ def distance
def distance_text
return @distance_text if @distance_text
unless @status == 'OK'
- @distance_text = "0"
+ @distance_text = "0 km"
else
@distance_text = @doc.css("distance text").last.text
end
@@ -49,4 +49,9 @@ def test_distance_text
assert_equal String, directions.distance_text.class
assert_equal "6.7 km", directions.distance_text
end
+
+ def test_zero_distance_text
+ directions = GoogleDirections.new("27 Beemdenlaan, 2550 Kontich", "499 Gordonsville Highway, 38563")
+ assert_equal "0 km", directions.distance_text
+ end
end

0 comments on commit a1b507d

Please sign in to comment.