Skip to content

Commit

Permalink
Add exists call
Browse files Browse the repository at this point in the history
  • Loading branch information
skade committed Apr 10, 2012
1 parent 14a6ed2 commit 085fad9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/eson-http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@
require 'eson/http/indices/put_template'
require 'eson/http/indices/get_template'
require 'eson/http/indices/delete_template'
require 'eson/http/indices/update_settings'
require 'eson/http/indices/update_settings'
require 'eson/http/indices/exists'
14 changes: 14 additions & 0 deletions lib/eson/http/indices/exists.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module Eson
module HTTP
module IndexExists
include Shared::IndexExists
extend API

request_method :head

def path
"/{-list|,|indices}"
end
end
end
end
2 changes: 1 addition & 1 deletion test/http/index_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
client.mget(:index => "mget_test", :ids => [1,2])
end

asserts("number of docs") { topic[:docs].length }.equals(2)
asserts("number of docs") { topic["docs"].length }.equals(2)
end

context "delete_by_query" do
Expand Down
8 changes: 8 additions & 0 deletions test/http/indices/basics_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,12 @@
end.equals(false)
end

context "exists?" do
setup do
client.exists? :index => 'does_not_exist_at_all'
end

asserts { topic }.equals(false)
end

end

0 comments on commit 085fad9

Please sign in to comment.