-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #449 from cul/2.6.x-HYACINTH-1054
HYACINTH-1054 (2.6.x branch): Add ability to search by DOI value (as part of Identifiers search dropdown field)
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
spec/models/concerns/digital_object/index_and_search/index_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require 'rails_helper' | ||
|
||
describe DigitalObject::IndexAndSearch::Index do | ||
let(:pid) { 'cul:12345' } | ||
let(:identifiers) { ['id1', 'id2'] } | ||
let(:doi) { 'doi:10.7916/sa43-bk43' } | ||
let(:doi_without_prefix) { doi.gsub(/^doi:/, '') } | ||
let(:project) { Project.new(display_label: 'Sample Project') } | ||
let(:digital_object) { | ||
DigitalObject::Item.new.tap do |obj| | ||
obj.identifiers = identifiers | ||
obj.doi = doi | ||
allow(obj).to receive(:pid).and_return(pid) | ||
allow(obj).to receive(:project).and_return(project) | ||
end | ||
} | ||
|
||
let(:solr_doc) { digital_object.to_solr } | ||
|
||
describe '#to_solr' do | ||
context 'search_identifier_sim field' do | ||
it 'sets the expected values' do | ||
expect(solr_doc[:search_identifier_sim]).to eq([pid] + identifiers + [doi_without_prefix]) | ||
end | ||
end | ||
end | ||
end |