spec/fields/note_spec.rb in mods_display-0.0.1.beta6 vs spec/fields/note_spec.rb in mods_display-0.0.1

- old
+ new

@@ -7,25 +7,26 @@ describe ModsDisplay::Note do before(:all) do @note = Stanford::Mods::Record.new.from_str("<mods><note>Note Field</note></mods>", false).note @display_label = Stanford::Mods::Record.new.from_str("<mods><note displayLabel='Special Label'>Note Field</note></mods>", false).note @sor_label = Stanford::Mods::Record.new.from_str("<mods><note type='statement of responsibility'>Note Field</note></mods>", false).note - @type_label = Stanford::Mods::Record.new.from_str("<mods><note type='Some other Type'>Note Field</note></mods>", false).note + @contact_note = Stanford::Mods::Record.new.from_str("<mods><note type='contact'>jdoe@example.com</note><note>Note Field</note></mods>", false).note + @type_label = Stanford::Mods::Record.new.from_str("<mods><note type='some other Type'>Note Field</note></mods>", false).note @complex_label = Stanford::Mods::Record.new.from_str("<mods><note>Note Field</note><note>2nd Note Field</note><note type='statement of responsibility'>SoR</note><note>Another Note</note></mods>", false).note end describe "label" do it "should have a default label" do mods_display_note(@note).fields.first.label.should == "Note" end it "should use the displayLabel attribute when one is available" do mods_display_note(@display_label).fields.first.label.should == "Special Label" end it "should use get a label from a list of translations" do - mods_display_note(@sor_label).fields.first.label.should == "Statement of Responsibility" + mods_display_note(@sor_label).fields.first.label.should == "Statement of responsibility" end - it "should use use the raw type attribute if one is present" do - mods_display_note(@type_label).fields.first.label.should == "Some other Type" + it "should use use the capitalized type attribute if one is present" do + mods_display_note(@type_label).fields.first.label.should == "Some other type" end end describe "fields" do it "should handle single values" do @@ -38,16 +39,21 @@ fields.length.should == 3 fields.first.label.should == "Note" fields.first.values.length == 2 fields.first.values.should == ["Note Field", "2nd Note Field"] - fields[1].label == "Statement of Responsibility" + fields[1].label == "Statement of responsibility" fields[1].values.length == 1 fields[1].values.should == ["SoR"] fields.last.label.should == "Note" fields.last.values.length == 1 fields.last.values.should == ["Another Note"] + end + it "should not include any contact fields" do + fields = mods_display_note(@contact_note).fields + fields.length.should == 1 + fields.first.values.should == ["Note Field"] end end end \ No newline at end of file