-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
697 additions
and
308 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
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
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,9 @@ | ||
# frozen_string_literal: true | ||
|
||
module ModsDisplay | ||
class CopyrightDate < Field | ||
def fields | ||
date_fields(:copyrightDate) | ||
end | ||
end | ||
end |
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,9 @@ | ||
# frozen_string_literal: true | ||
|
||
module ModsDisplay | ||
class DateCaptured < Field | ||
def fields | ||
date_fields(:dateCaptured) | ||
end | ||
end | ||
end |
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,9 @@ | ||
# frozen_string_literal: true | ||
|
||
module ModsDisplay | ||
class DateCreated < Field | ||
def fields | ||
date_fields(:dateCreated) | ||
end | ||
end | ||
end |
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,9 @@ | ||
# frozen_string_literal: true | ||
|
||
module ModsDisplay | ||
class DateIssued < Field | ||
def fields | ||
date_fields(:dateIssued) | ||
end | ||
end | ||
end |
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,9 @@ | ||
# frozen_string_literal: true | ||
|
||
module ModsDisplay | ||
class DateModified < Field | ||
def fields | ||
date_fields(:dateModified) | ||
end | ||
end | ||
end |
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,9 @@ | ||
# frozen_string_literal: true | ||
|
||
module ModsDisplay | ||
class DateValid < Field | ||
def fields | ||
date_fields(:dateValid) | ||
end | ||
end | ||
end |
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
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
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,38 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'support/origin_info_date_helpers' | ||
|
||
describe ModsDisplay::CopyrightDate do | ||
let(:many_dates) do | ||
<<~XML | ||
<mods xmlns="http://www.loc.gov/mods/v3"> | ||
<originInfo> | ||
<dateCreated>created 1725</dateCreated> | ||
<dateCaptured>captured 1825</dateCaptured> | ||
<copyrightDate>copyright 1925</copyrightDate> | ||
<dateIssued>issued 2025</dateIssued> | ||
<dateModified>modified 2225</dateModified> | ||
<dateValid>valid 2125</dateValid> | ||
</originInfo> | ||
</mods> | ||
XML | ||
end | ||
|
||
it 'gets correct label' do | ||
expect(copyright_date_fields(many_dates).first.label).to eq('Copyright date:') | ||
end | ||
|
||
it 'gets contents of copyrightDate field' do | ||
expect(copyright_date_values(many_dates)).to eq(['copyright 1925']) | ||
end | ||
|
||
describe 'to_html' do | ||
it 'has individual dt/dd pairs for date issued' do | ||
html = described_class.new( | ||
Stanford::Mods::Record.new.from_str(many_dates).origin_info | ||
).to_html | ||
expect(html.scan(%r{<dt>Copyright date</dt>}).length).to eq(1) | ||
expect(html.scan('<dd>').length).to eq(1) | ||
end | ||
end | ||
end |
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,38 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'support/origin_info_date_helpers' | ||
|
||
describe ModsDisplay::DateCaptured do | ||
let(:many_dates) do | ||
<<~XML | ||
<mods xmlns="http://www.loc.gov/mods/v3"> | ||
<originInfo> | ||
<dateCreated>created 1725</dateCreated> | ||
<dateCaptured>captured 1825</dateCaptured> | ||
<copyrightDate>copyright 1925</copyright> | ||
<dateIssued>issued 2025</dateIssued> | ||
<dateModified>modified 2225</dateModified> | ||
<dateValid>valid 2125</dateValid> | ||
</originInfo> | ||
</mods> | ||
XML | ||
end | ||
|
||
it 'gets correct label' do | ||
expect(date_captured_fields(many_dates).first.label).to eq('Date captured:') | ||
end | ||
|
||
it 'gets contents of dateCaptured field' do | ||
expect(date_captured_values(many_dates)).to eq(['captured 1825']) | ||
end | ||
|
||
describe 'to_html' do | ||
it 'has individual dt/dd pairs for capture date' do | ||
html = described_class.new( | ||
Stanford::Mods::Record.new.from_str(many_dates).origin_info | ||
).to_html | ||
expect(html.scan(%r{<dt>Date captured</dt>}).length).to eq(1) | ||
expect(html.scan('<dd>').length).to eq(1) | ||
end | ||
end | ||
end |
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,38 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'support/origin_info_date_helpers' | ||
|
||
describe ModsDisplay::DateCreated do | ||
let(:many_dates) do | ||
<<~XML | ||
<mods xmlns="http://www.loc.gov/mods/v3"> | ||
<originInfo> | ||
<dateCreated>created 1725</dateCreated> | ||
<dateCaptured>captured 1825</dateCaptured> | ||
<copyrightDate>copyright 1925</copyright> | ||
<dateIssued>issued 2025</dateIssued> | ||
<dateModified>modified 2225</dateModified> | ||
<dateValid>valid 2125</dateValid> | ||
</originInfo> | ||
</mods> | ||
XML | ||
end | ||
|
||
it 'gets correct label' do | ||
expect(date_created_fields(many_dates).first.label).to eq('Date created:') | ||
end | ||
|
||
it 'gets contents of dateCreated field' do | ||
expect(date_created_values(many_dates)).to eq(['created 1725']) | ||
end | ||
|
||
describe 'to_html' do | ||
it 'has individual dt/dd pairs for create date' do | ||
html = described_class.new( | ||
Stanford::Mods::Record.new.from_str(many_dates).origin_info | ||
).to_html | ||
expect(html.scan(%r{<dt>Date created</dt>}).length).to eq(1) | ||
expect(html.scan('<dd>').length).to eq(1) | ||
end | ||
end | ||
end |
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,38 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'support/origin_info_date_helpers' | ||
|
||
describe ModsDisplay::DateIssued do | ||
let(:many_dates) do | ||
<<~XML | ||
<mods xmlns="http://www.loc.gov/mods/v3"> | ||
<originInfo> | ||
<dateCreated>created 1725</dateCreated> | ||
<dateCaptured>captured 1825</dateCaptured> | ||
<copyrightDate>copyright 1925</copyright> | ||
<dateIssued>issued 2025</dateIssued> | ||
<dateModified>modified 2225</dateModified> | ||
<dateValid>valid 2125</dateValid> | ||
</originInfo> | ||
</mods> | ||
XML | ||
end | ||
|
||
it 'gets correct label' do | ||
expect(date_issued_fields(many_dates).first.label).to eq('Publication date:') | ||
end | ||
|
||
it 'gets contents of dateIssued field' do | ||
expect(date_issued_values(many_dates)).to eq(['issued 2025']) | ||
end | ||
|
||
describe 'to_html' do | ||
it 'has individual dt/dd pairs for date issued' do | ||
html = described_class.new( | ||
Stanford::Mods::Record.new.from_str(many_dates).origin_info | ||
).to_html | ||
expect(html.scan(%r{<dt>Publication date</dt>}).length).to eq(1) | ||
expect(html.scan('<dd>').length).to eq(1) | ||
end | ||
end | ||
end |
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,38 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'support/origin_info_date_helpers' | ||
|
||
describe ModsDisplay::DateModified do | ||
let(:many_dates) do | ||
<<~XML | ||
<mods xmlns="http://www.loc.gov/mods/v3"> | ||
<originInfo> | ||
<dateCreated>created 1725</dateCreated> | ||
<dateCaptured>captured 1825</dateCaptured> | ||
<copyrightDate>copyright 1925</copyright> | ||
<dateIssued>issued 2025</dateIssued> | ||
<dateModified>modified 2225</dateModified> | ||
<dateValid>valid 2125</dateValid> | ||
</originInfo> | ||
</mods> | ||
XML | ||
end | ||
|
||
it 'gets correct label' do | ||
expect(date_modified_fields(many_dates).first.label).to eq('Date modified:') | ||
end | ||
|
||
it 'gets contents of dateModified field' do | ||
expect(date_modified_values(many_dates)).to eq(['modified 2225']) | ||
end | ||
|
||
describe 'to_html' do | ||
it 'has individual dt/dd pairs for modified date' do | ||
html = described_class.new( | ||
Stanford::Mods::Record.new.from_str(many_dates).origin_info | ||
).to_html | ||
expect(html.scan(%r{<dt>Date modified</dt>}).length).to eq(1) | ||
expect(html.scan('<dd>').length).to eq(1) | ||
end | ||
end | ||
end |
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,37 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'support/origin_info_date_helpers' | ||
|
||
describe ModsDisplay::DateValid do | ||
let(:many_dates) do | ||
<<~XML | ||
<mods xmlns="http://www.loc.gov/mods/v3"> | ||
<originInfo> | ||
<dateCreated>created 1725</dateCreated> | ||
<dateCaptured>captured 1825</dateCaptured> | ||
<copyrightDate>copyright 1925</copyright> | ||
<dateIssued>issued 2025</dateIssued> | ||
<dateValid>valid 2125</dateValid> | ||
</originInfo> | ||
</mods> | ||
XML | ||
end | ||
|
||
it 'gets correct label' do | ||
expect(date_valid_fields(approximate_date).first.label).to eq('Date valid:') | ||
end | ||
|
||
it 'gets contents of dateValid field' do | ||
expect(date_valid_values(many_dates)).to eq(['valid 2125']) | ||
end | ||
|
||
describe 'to_html' do | ||
it 'has individual dt/dd pairs for valid date' do | ||
html = described_class.new( | ||
Stanford::Mods::Record.new.from_str(many_dates).origin_info | ||
).to_html | ||
expect(html.scan(%r{<dt>Date valid</dt>}).length).to eq(1) | ||
expect(html.scan('<dd>').length).to eq(1) | ||
end | ||
end | ||
end |
Oops, something went wrong.