Sha256: 47f8a12a3ce77881b18c3a4d6795eabbe990f803dbc8d874d51f26da40d50cc1
Contents?: true
Size: 1.39 KB
Versions: 3
Compression:
Stored size: 1.39 KB
Contents
require "spec_helper" def mods_display_related_location(mods_record) ModsDisplay::RelatedLocation.new(mods_record, ModsDisplay::Configuration::Base.new, mock("controller")) end describe ModsDisplay::RelatedLocation do before(:all) do @location = Stanford::Mods::Record.new.from_str("<mods><relatedItem><location>The Location</location></relatedItem></mods>", false).related_item @non_location = Stanford::Mods::Record.new.from_str("<mods><relatedItem><title>No Location</title></relatedItem></mods>", false).related_item @display_label = Stanford::Mods::Record.new.from_str("<mods><relatedItem displayLabel='Special Location'><location>The Location</location></relatedItem></mods>", false).related_item end describe "label" do it "should default to Location" do mods_display_related_location(@location).fields.first.label.should == "Location" end it "should get the displayLabel if available" do mods_display_related_location(@display_label).label.should == "Special Location" end end describe "fields" do it "should get a location if it is available" do fields = mods_display_related_location(@location).fields fields.length.should == 1 fields.first.values.should == ["The Location"] end it "should not return any fields if there is no location" do mods_display_related_location(@non_location).fields.should == [] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mods_display-0.0.1.beta3 | spec/fields/related_location_spec.rb |
mods_display-0.0.1.beta2 | spec/fields/related_location_spec.rb |
mods_display-0.0.1.beta1 | spec/fields/related_location_spec.rb |