Skip to content
This repository has been archived by the owner on Mar 24, 2020. It is now read-only.

Commit

Permalink
Merge pull request #104 from ucsdlib/feature/testfix
Browse files Browse the repository at this point in the history
Fixing a few tests
  • Loading branch information
mcritchlow committed May 19, 2015
2 parents 3b7ce5c + fa73d1f commit 95432db
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
29 changes: 25 additions & 4 deletions spec/features/catalog_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,18 +215,39 @@
end

feature 'Visitor wants to see collection info in the search results view' do
before(:all) do
@acol = DamsAssembledCollection.create( titleValue: 'Sample Assembled Collection',
subtitle: 'Subtitle', titleNonSort: 'The', titlePartName: 'Allegro', titlePartNumber: '1',
visibility: 'public' )
@part = DamsProvenanceCollectionPart.create( titleValue: 'Sample Provenance Part',
subtitle: 'Subtitle', titleNonSort: 'The', titlePartName: 'Allegro', titlePartNumber: '1',
visibility: 'public' )
@unit = DamsUnit.create( name: 'Test Unit', description: 'Test Description', code: 'tu',
group: 'dams-curator', uri: 'http://example.com/' )
@obj = DamsObject.create( titleValue: 'Sample Image Component',
assembledCollectionURI: [ @acol.pid ], provenanceCollectionPartURI: [ @part.pid ],
unit_attributes: [{ id: RDF::URI.new("#{Rails.configuration.id_namespace}#{@unit.pid}") }],
copyright_attributes: [{status: 'Public domain'}] )
solr_index @obj.pid
end
after(:all) do
@obj.delete
@acol.delete
@part.delete
@unit.delete
end
scenario 'should see the results page with collection info' do
visit catalog_index_path( {:q => 'sample'} )
expect(page).to have_selector('h3', :text => 'Sample Image Component')
expect(page).to have_selector("span.dams-search-results-fields-label:first", :text => 'Collection:')
end

scenario 'should see the results page with multiple collection display' do
visit catalog_index_path( {:q => 'The Sample Simple Object: An Image Object'} )
expect(page).to have_selector('h3', :text => 'The Sample Simple Object: An Image Object')
visit catalog_index_path( {:q => 'Sample Image Component'} )
expect(page).to have_selector('h3', :text => 'Sample Image Component')
expect(page).to have_selector("span.dams-search-results-fields-label:first", :text => 'Collection:')
expect(page).to have_selector("ul.dams-search-results-fields:first li span[2]", :text => 'Sample Assembled Collection, The: Subtitle, Allegro, 1')
expect(page).to have_selector("ul.dams-search-results-fields:first li span[2]", :text => 'Sample Provenance Part, The: Subtitle, Allegro, 1')
expect(page).to have_selector("ul.dams-search-results-fields:first li span[2]", :text => 'The Sample Assembled Collection: Subtitle, Allegro, 1')
expect(page).to have_selector("ul.dams-search-results-fields:first li span[2]", :text => 'The Sample Provenance Part: Subtitle, Allegro, 1')
end

scenario 'should see the collection info before other fields in single object viewer' do
Expand Down
5 changes: 4 additions & 1 deletion spec/features/dams_object_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,8 @@
before do
@otherRights = DamsOtherRight.create pid: 'zz58718348', permissionType: "metadataDisplay", basis: "fair use",
note: "Please contact Mandeville Special Collections & Archives at spcoll@ucsd.edu or (858) 534-2533 for more information about this object."
@damsUnit = DamsUnit.create( pid: 'zz48484848', name: 'Test Unit', description: 'Test Description',
code: 'tu', group: 'dams-curator', uri: 'http://example.com/' )
@damsEmbObj = DamsObject.new(pid: "zz2765588d")
@damsEmbObj.damsMetadata.content = File.new('spec/fixtures/embargoedObject.rdf.xml').read
@damsEmbObj.save!
Expand All @@ -525,6 +527,7 @@
after do
@damsEmbObj.delete
@otherRights.delete
@damsUnit.delete
end

it "should see the view content button and click on the button to see the download button" do
Expand Down Expand Up @@ -555,4 +558,4 @@
expect(page).to have_selector('section#metadata-fold dl dt[5]',:text=>'Note')
expect(page).to have_selector('section#metadata-fold dl dt[7]',:text=>'Preferred Citation')
end
end
end
2 changes: 1 addition & 1 deletion spec/fixtures/embargoedObject.rdf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:dams="http://library.ucsd.edu/ontology/dams#">
<dams:Object rdf:about="http://library.ucsd.edu/ark:/20775/zz2765588d">
<dams:unit rdf:resource="http://library.ucsd.edu/ark:/20775/bb48484848"/>
<dams:unit rdf:resource="http://library.ucsd.edu/ark:/20775/zz48484848"/>
<dams:otherRights rdf:resource="http://library.ucsd.edu/ark:/20775/zz58718348"/>
<dams:copyright>
<dams:Copyright>
Expand Down

0 comments on commit 95432db

Please sign in to comment.