mirror of
https://github.com/apache/lucene.git
synced 2025-02-13 05:25:50 +00:00
git-svn-id: https://svn.apache.org/repos/asf/incubator/solr/trunk@496870 13f79535-47bb-0310-9956-ffa450edef68
30 lines
762 B
Ruby
30 lines
762 B
Ruby
require 'solr_mock_base'
|
|
|
|
class CommitTest < SolrMockBaseTestCase
|
|
|
|
def test_commit
|
|
xml = '<result status="0"></result>'
|
|
conn = Solr::Connection.new('http://localhost:9999/solr')
|
|
set_post_return(xml)
|
|
response = conn.send(Solr::Request::Commit.new)
|
|
assert_kind_of Solr::Response::Commit, response
|
|
assert true, response.ok?
|
|
|
|
# test shorthand
|
|
assert_equal true, conn.commit
|
|
end
|
|
|
|
def test_invalid_commit
|
|
xml = '<foo>bar</foo>'
|
|
conn = Solr::Connection.new('http://localhost:9999/solr')
|
|
set_post_return(xml)
|
|
response = conn.send(Solr::Request::Commit.new)
|
|
assert_kind_of Solr::Response::Commit, response
|
|
assert_equal false, response.ok?
|
|
|
|
# test shorthand
|
|
assert_equal false, conn.commit
|
|
end
|
|
|
|
end
|