Sha256: 44c5936b3c758cfb5ece8c478a787df652b3e7cf82fb8ed4e25d3eeef03c5953
Contents?: true
Size: 1.81 KB
Versions: 2
Compression:
Stored size: 1.81 KB
Contents
require 'test_helper' module Elasticsearch module Test class UpdateTest < ::Test::Unit::TestCase context "Update document" do subject { FakeClient.new } should "require the :index argument" do assert_raise ArgumentError do subject.update :type => 'bar', :id => '1' end end should "require the :type argument" do assert_raise ArgumentError do subject.update :index => 'foo', :id => '1' end end should "require the :id argument" do assert_raise ArgumentError do subject.update :index => 'foo', :type => 'bar' end end should "perform correct request" do subject.expects(:perform_request).with do |method, url, params, body| assert_equal 'POST', method assert_equal 'foo/bar/1/_update', url assert_equal Hash.new, params assert_equal Hash.new, body[:doc] true end.returns(FakeResponse.new) subject.update :index => 'foo', :type => 'bar', :id => '1', :body => { :doc => {} } end should "pass the URL parameters" do subject.expects(:perform_request).with do |method, url, params, body| assert_equal 'foo/bar/1/_update', url assert_equal 100, params[:version] true end.returns(FakeResponse.new) subject.update :index => 'foo', :type => 'bar', :id => '1', :version => 100, :body => {} 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/update_document_test.rb |
elasticsearch-api-0.0.2 | test/unit/update_document_test.rb |