Sha256: 8a024be3b10d52c3039c9b0f7c4c0fc691d3ffd699f6369540304dac1ff5c3f2
Contents?: true
Size: 1.5 KB
Versions: 3
Compression:
Stored size: 1.5 KB
Contents
require 'spec_helper' describe Krikri::ValidationReport do include_context 'with indexed item' # @todo: need more tests for ValidationReport#all describe `#all` do it 'returns facet for each required field' do count = described_class::REQUIRED_FIELDS.count facet_field_const = Blacklight::SolrResponse::Facets::FacetField fields = Array.new(count, an_instance_of(facet_field_const)) expect(subject.all).to contain_exactly(*fields) end end # @todo: need more tests for ValidationReport#find describe `#find` do it 'gives a blacklight solr response' do expect(subject.find('sourceResource_title')) .to be_a Blacklight::SolrResponse end it 'raises an error for invalid fields' do expect { subject.find('notA_field') } .to raise_error RSolr::Error::Http end it 'gets by provider_id' do provider_uri = RDF::URI(Krikri::Settings.prov.provider_base) / '123' params = { :qt => 'standard', :q => '-sourceResource_title:[* TO *]', :rows => '10', :fq => "provider_id:\"#{provider_uri}\"" } response = double('solr response') allow(Krikri::SolrResponseBuilder).to receive(:new).with(params) .and_return(response) allow(response).to receive(:response).and_return(:result) result = subject.find('sourceResource_title') do self.provider_id = '123' end expect(result).to eq :result end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
krikri-0.5.2 | spec/models/validation_report_spec.rb |
krikri-0.5.1 | spec/models/validation_report_spec.rb |
krikri-0.5.0 | spec/models/validation_report_spec.rb |