Skip to content
This repository was archived by the owner on Jun 30, 2018. It is now read-only.

Commit 3805ff0

Browse files
committed
Added unit test for the error handling in Index#retrieve
Related: #929
1 parent 197325b commit 3805ff0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/unit/index_test.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,15 @@ def id; ID.new; end
442442
assert_equal nil, article
443443
end
444444

445+
should "raise an error for server errors" do
446+
Configuration.client.expects(:get).with("#{@index.url}/article/id-1").
447+
returns(mock_response('BOOM', 500))
448+
assert_raise RuntimeError do
449+
article = @index.retrieve :article, 'id-1'
450+
assert_equal nil, article
451+
end
452+
end
453+
445454
should "raise error when no ID passed" do
446455
assert_raise ArgumentError do
447456
@index.retrieve 'article', nil

0 commit comments

Comments
 (0)