Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added unit test for the error handling in Index#retrieve

Related: #929
  • Loading branch information...
commit 3805ff0a50eb31954ec5eada62884b884789cb0d 1 parent 197325b
@karmi authored
Showing with 9 additions and 0 deletions.
  1. +9 −0 test/unit/index_test.rb
View
9 test/unit/index_test.rb
@@ -442,6 +442,15 @@ def id; ID.new; end
assert_equal nil, article
end
+ should "raise an error for server errors" do
+ Configuration.client.expects(:get).with("#{@index.url}/article/id-1").
+ returns(mock_response('BOOM', 500))
+ assert_raise RuntimeError do
+ article = @index.retrieve :article, 'id-1'
+ assert_equal nil, article
+ end
+ end
+
should "raise error when no ID passed" do
assert_raise ArgumentError do
@index.retrieve 'article', nil
Please sign in to comment.
Something went wrong with that request. Please try again.