Sha256: e8419d84a6d1bee2b7b78aa8d9575784880906a2471c7405d95ff93578599394
Contents?: true
Size: 1.19 KB
Versions: 18
Compression:
Stored size: 1.19 KB
Contents
require 'spec_helper' describe SolrWrapper::Client do subject { described_class.new('http://localhost:8983/solr/') } describe '#exists?' do it 'checks if a solrcloud collection exists' do stub_request(:get, 'http://localhost:8983/solr/admin/collections?action=LIST&wt=json').to_return(body: '{ "collections": ["x", "y", "z"]}') stub_request(:get, 'http://localhost:8983/solr/admin/cores?action=STATUS&wt=json&core=a').to_return(body: '{ "status": { "a": {} } }') expect(subject.exists?('x')).to eq true expect(subject.exists?('a')).to eq false end it 'checks if a solr core exists' do stub_request(:get, 'http://localhost:8983/solr/admin/collections?action=LIST&wt=json').to_return(body: '{ "error": { "msg": "Solr instance is not running in SolrCloud mode."} }') stub_request(:get, 'http://localhost:8983/solr/admin/cores?action=STATUS&wt=json&core=x').to_return(body: '{ "status": { "x": { "name": "x" } } }') stub_request(:get, 'http://localhost:8983/solr/admin/cores?action=STATUS&wt=json&core=a').to_return(body: '{ "status": { "a": {} } }') expect(subject.exists?('x')).to eq true expect(subject.exists?('a')).to eq false end end end
Version data entries
18 entries across 18 versions & 2 rubygems