require 'spec_helper'
require 'stanford-mods/kolb'
describe "Kolb Collection Mods Record" do
before(:all) do
@krec = Stanford::Mods::KolbRecord.new
@krec.from_str('
Edward VI, king of England,
eng
English
still image
1537-1553.
1537
1553
Edward VI , king of England,
Edward VI , king of England, 1537-1553
creator
cre
Holbein, Han, 1497-1543
Holbein, Han, 1497-1543
creator
cre
Sheppard, Robert, 1732-1737
Sheppard, Robert, 1732-1737
Ruler, English.Ruler, English.
0395
')
end
context "for SearchWorks Solr" do
# from https://consul.stanford.edu/display/NGDE/Required+and+Recommended+Solr+Fields+for+SearchWorks+documents
context "required values" do
it "catch all text field" do
pending "to be implemented"
end
it "format" do
# sometimes from contentMetadata, o.w. see mods_mapper.is_a_map/image?
pending "to be implemented"
#still image
end
# FIXME: update per gryphDOR code / searcworks code / new schema
it "collection" do
pending "to be implemented"
# from solr_mapper.rb
# # Special treatment for collection objects
#if is_a_collection?
# solr_doc[:display_type] = "Collection"
# solr_doc[:collection_type] = "Digital Collection"
#else
# solr_doc[:display_type] = display_type
#end
#if collections # An array of the druids of any collections this object is part of
# solr_doc[:collection] = collections
# solr_doc[:collection_with_title] = collections_with_titles
#end
end
it "display_type" do
pending "to be implemented"
end
end
context "strongly recommended" do
it "access_facet" do
@krec.sw_access_facet.should == ['Online']
end
context "title" do
context "for display and searching" do
it "short title" do
@krec.short_titles.should == ['Edward VI, king of England,']
end
it "full title" do
@krec.full_titles.should == ['Edward VI, king of England,']
end
it "alternative titles" do
@krec.alternative_titles.size.should == 0
end
end
it "sortable title" do
@krec.sort_title.should == 'Edward VI, king of England,'
end
end
end
context "recommended" do
context "publication date" do
it "for searching and facet" do
pending "to be implemented"
@krec.pub_date.should include('1537')
@krec.pub_date.should include('1545')
@krec.pub_date.should include('1553')
@krec.pub_date.should_not include('1554')
@krec.pub_date.should_not include('1536')
end
it "for sorting should be dateCreated start date" do
pending "to be implemented"
@krec.pub_date_sort.should == '1537'
end
it "for pub date grouping (hierarchical / date slider?)" do
pending "to be implemented"
@krec.pub_date_group_facet.should == 'More than 50 years ago'
end
end
context "language" do
it "facet should have a text value" do
@krec.sw_language_facet.should == ['English']
end
end
context "authors" do
it "personal_names" do
@krec.personal_names.size.should == 2
@krec.personal_names.should include('Holbein, Han, 1497-1543')
@krec.personal_names.should include('Sheppard, Robert, 1732-1737')
end
it "name object showing creator role" do
pending "to be implemented"
end
it "author sort" do
pending "to be implemented"
end
end
end
end # for SearchWorks Solr
context "abstract" do
# FIXME: move to stanford_mods, not kolb specific
it "should not include empty elements" do
pending "to be implemented"
#
@krec.abstract.size.should == 0
@krec.scope_and_contents_note.size.should == 0
end
end
context "physicalDescription" do
#
# 0395
#
it "should be included in catch all text" do
pending "to be implemented"
end
end
context "subject" do
it "topic" do
@krec.subject.topic.map { |e| e.text }.should == ['Ruler, English.Ruler, English.']
end
it "name" do
pending "to be implemented"
@krec.subject.name.map { |e| e.text }.should == ['Edward VI , king of England, 1537-1553']
end
end
context "kolb record title issue" do
before(:all) do
@krec.from_str('
Elizabeth I, queen of England,
eng
English
still image
1533-1603.
1533
1603
Elizabeth I, Queen of England
Elizabeth I, Queen of England, 1533-1603
creator
cre
Houston, Richard, 1721?-1775
Houston, Richard, 1721?-1775
Ruler, English. W
Elisabetha D.G./Angliae,Franciae & Hiberniae,
Regina,./Printed for E.Bakewell & H.Parker; opposite Birchin Lane
in Cornhill.
0411
')
end
it "should get full title" do
@krec.title_info.full_title.should == ['Elizabeth I, queen of England,']
@krec.full_titles.should == ['Elizabeth I, queen of England,']
end
end
end