Sha256: a599f416fb9e42e87aada408539f177a0c5946ccd631de781260e05548def364

Contents?: true

Size: 1.6 KB

Versions: 5

Compression:

Stored size: 1.6 KB

Contents

require 'spec_helper'

describe 'curation_concerns/file_sets/show.html.erb', type: :view do
  before do
    allow(view).to receive(:parent).and_return(parent)
  end

  let(:parent) { stub_model(GenericWork) }

  let(:depositor) do
    stub_model(User,
               user_key: 'bob',
               twitter_handle: 'bot4lib')
  end

  let(:content) do
    double('content', versions: [], mimeType: 'application/pdf')
  end

  let(:file_set) do
    stub_model(FileSet, id: '123',
                        depositor: depositor.user_key,
                        audit_stat: 1,
                        title: ['My Title'],
                        description: ['Lorem ipsum lorem ipsum. http://my.link.com']
              )
  end

  let(:ability) { double }
  let(:solr_doc) { SolrDocument.new(file_set.to_solr) }
  let(:presenter) { CurationConcerns::FileSetPresenter.new(solr_doc, ability) }

  before do
    view.lookup_context.view_paths.push CurationConcerns::Engine.root + 'app/views/curation_concerns/base'
    allow(view).to receive(:can?).with(:edit, String).and_return(true)
    assign(:presenter, presenter)
  end

  describe 'title heading' do
    before do
      stub_template 'shared/_title_bar.html.erb' => 'Title Bar'
      render template: 'curation_concerns/file_sets/show.html.erb', layout: 'layouts/curation_concerns'
    end
    it 'shows the title' do
      expect(rendered).to have_selector 'h1 > small', text: 'My Title'
    end
  end

  describe 'attributes' do
    before { render }

    it 'shows the description' do
      expect(rendered).to have_selector '.attribute.description', text: 'Lorem ipsum'
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
curation_concerns-0.8.0 spec/views/curation_concerns/file_sets/show.html.erb_spec.rb
curation_concerns-0.7.0 spec/views/curation_concerns/file_sets/show.html.erb_spec.rb
curation_concerns-0.6.0 spec/views/curation_concerns/file_sets/show.html.erb_spec.rb
curation_concerns-0.5.0 spec/views/curation_concerns/file_sets/show.html.erb_spec.rb
curation_concerns-0.4.0 spec/views/curation_concerns/file_sets/show.html.erb_spec.rb