Sha256: 3053381d3ff45e2a9a593bb0a1d4414fcee178687fc3413bc6e90cfeaefd40b4

Contents?: true

Size: 997 Bytes

Versions: 4

Compression:

Stored size: 997 Bytes

Contents

require "spec_helper"

def mods_display_abstract(mods_record)
  ModsDisplay::Abstract.new(mods_record, ModsDisplay::Configuration::Base.new, mock("controller"))
end

describe ModsDisplay::Abstract do
  before(:all) do
    @link = Stanford::Mods::Record.new.from_str("<mods><abstract>A link to the library (http://library.stanford.edu) should appear here</abstract></mods>", false).abstract
    @email = Stanford::Mods::Record.new.from_str("<mods><abstract>A link to an email address jdoe@example.com should appear here</abstract></mods>", false).abstract
  end

  describe "links" do
    it "should turn URLs into links" do
      mods_display_abstract(@link).fields.first.values.first.should match(/\(<a href='http:\/\/library.stanford.edu'>http:\/\/library.stanford.edu<\/a>\)/)
    end
    it "should turn email addresses into mailto links" do
      mods_display_abstract(@email).fields.first.values.first.should match(/<a href='mailto:jdoe@example.com'>jdoe@example.com<\/a>/)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mods_display-0.0.1.beta4 spec/fields/abstract_spec.rb
mods_display-0.0.1.beta3 spec/fields/abstract_spec.rb
mods_display-0.0.1.beta2 spec/fields/abstract_spec.rb
mods_display-0.0.1.beta1 spec/fields/abstract_spec.rb