Sha256: 362e303973b92aebdfed178c1abc66eced414e1a45d99e3cd331f700bfffdd56
Contents?: true
Size: 1.73 KB
Versions: 2
Compression:
Stored size: 1.73 KB
Contents
require 'test_helper' module Elasticsearch module Test class GetTest < ::Test::Unit::TestCase context "Get document" do subject { FakeClient.new } should "require the :index argument" do assert_raise ArgumentError do subject.get :type => 'bar', :id => '1' end end should "NOT require the :type argument" do assert_nothing_raised do subject.get :index => 'foo', :id => '1' end end should "require the :id argument" do assert_raise ArgumentError do subject.get :index => 'foo', :type => 'bar' end end should "perform correct request" do subject.expects(:perform_request).with do |method, url, params, body| assert_equal 'GET', method assert_equal 'foo/bar/1', url assert_equal Hash.new, params assert_nil body true end.returns(FakeResponse.new) subject.get :index => 'foo', :type => 'bar', :id => '1' end should "pass the URL parameters" do subject.expects(:perform_request).with do |method, url, params, body| assert_equal 'foo/bar/1', url assert_equal 'abc123', params[:routing] true end.returns(FakeResponse.new) subject.get :index => 'foo', :type => 'bar', :id => '1', :routing => 'abc123' end should "catch a NotFound exception with the ignore parameter" do subject.expects(:perform_request).raises(NotFound) assert_nothing_raised do subject.get :index => 'foo', :type => 'bar', :id => 'XXX', ignore: 404 end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
elasticsearch-api-0.4.0 | test/unit/get_document_test.rb |
elasticsearch-api-0.0.2 | test/unit/get_document_test.rb |