Skip to content

Commit

Permalink
エラー処理を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
nayutaya committed Mar 20, 2010
1 parent 02278a8 commit 368a3bc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/googlemaps_polyline/encoder.rb
Expand Up @@ -49,6 +49,7 @@ def pack_level(level)
when 1 then return "@"
when 2 then return "A"
when 3 then return "B"
else raise(ArgumentError)
end
end
end
Expand Down
6 changes: 6 additions & 0 deletions test/encoder_test.rb
Expand Up @@ -77,6 +77,12 @@ def test_pack_level
assert_equal("B", pack_level[3])
end

def test_pack_level__invalid
assert_raise(ArgumentError) {
@encoder.instance_eval { pack_level(-1) }
}
end

private

def sio(string = nil)
Expand Down

0 comments on commit 368a3bc

Please sign in to comment.