Sha256: 6f211ad25cc5b70d27dc511e335cefe9539038542741baa32b999e93d1adf247

Contents?: true

Size: 1.4 KB

Versions: 17

Compression:

Stored size: 1.4 KB

Contents

require 'spec_helper'

describe 'curation_concerns/base/_attributes.html.erb' do
  let(:creator)     { 'Bilbo' }
  let(:contributor) { 'Frodo' }
  let(:subject)     { 'history' }
  let(:description) { ['Lorem ipsum < lorem ipsum. http://my.link.com'] }

  let(:solr_document) { SolrDocument.new(attributes) }
  let(:attributes) do
    {
      Solrizer.solr_name('has_model', :symbol) => ["GenericWork"],
      subject_tesim: subject,
      contributor_tesim: contributor,
      creator_tesim: creator,
      description_tesim: description
    }
  end
  let(:ability) { nil }
  let(:presenter) do
    CurationConcerns::WorkShowPresenter.new(solr_document, ability)
  end
  let(:doc) { Nokogiri::HTML(rendered) }

  before do
    allow(view).to receive(:dom_class) { '' }

    render 'curation_concerns/base/attributes', presenter: presenter
  end

  it 'has links to search for other objects with the same metadata' do
    expect(rendered).to have_link(creator, href: search_catalog_path(search_field: 'creator', q: creator))
    expect(rendered).to have_link(contributor, href: search_catalog_path(search_field: 'contributor', q: contributor))
    expect(rendered).to have_link(subject, href: search_catalog_path(search_field: 'subject', q: subject))
  end
  it 'shows links in the description' do
    a1 = doc.xpath("//li[@class='attribute description']/span/a").text
    expect(a1).to start_with 'http://my.link.com'
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
curation_concerns-1.7.8 spec/views/curation_concerns/base/_attributes.html.erb_spec.rb
curation_concerns-1.7.7 spec/views/curation_concerns/base/_attributes.html.erb_spec.rb
curation_concerns-2.0.0 spec/views/curation_concerns/base/_attributes.html.erb_spec.rb
curation_concerns-2.0.0.rc2 spec/views/curation_concerns/base/_attributes.html.erb_spec.rb
curation_concerns-1.7.6 spec/views/curation_concerns/base/_attributes.html.erb_spec.rb
curation_concerns-1.7.5 spec/views/curation_concerns/base/_attributes.html.erb_spec.rb
curation_concerns-1.7.4 spec/views/curation_concerns/base/_attributes.html.erb_spec.rb
curation_concerns-1.7.3 spec/views/curation_concerns/base/_attributes.html.erb_spec.rb
curation_concerns-1.7.2 spec/views/curation_concerns/base/_attributes.html.erb_spec.rb
curation_concerns-2.0.0.rc1 spec/views/curation_concerns/base/_attributes.html.erb_spec.rb
curation_concerns-1.7.1 spec/views/curation_concerns/base/_attributes.html.erb_spec.rb
curation_concerns-1.7.0 spec/views/curation_concerns/base/_attributes.html.erb_spec.rb
curation_concerns-1.7.0.beta1 spec/views/curation_concerns/base/_attributes.html.erb_spec.rb
curation_concerns-1.6.3 spec/views/curation_concerns/base/_attributes.html.erb_spec.rb
curation_concerns-1.6.2 spec/views/curation_concerns/base/_attributes.html.erb_spec.rb
curation_concerns-1.6.1 spec/views/curation_concerns/base/_attributes.html.erb_spec.rb
curation_concerns-1.6.0 spec/views/curation_concerns/base/_attributes.html.erb_spec.rb