Sha256: ee6751dd917085cca8f59e15e95b70c759a76abe4f4fdc9af9d666960ba6248b

Contents?: true

Size: 1.5 KB

Versions: 10

Compression:

Stored size: 1.5 KB

Contents

require 'spec_helper'

describe 'hyrax/file_sets/show.html.erb', type: :view do
  let(:user) { double(user_key: 'sarah', twitter_handle: 'test') }
  let(:file_set) { build(:file_set, id: '123', depositor: user.user_key, title: ['My Title'], user: user, visibility: 'open') }
  let(:ability) { double }
  let(:solr_doc) { SolrDocument.new(file_set.to_solr) }
  let(:presenter) { Hyrax::FileSetPresenter.new(solr_doc, ability) }
  let(:mock_metadata) do
    {
      format: ["Tape"],
      long_term: ["x" * 255],
      multi_term: ["1", "2", "3", "4", "5", "6", "7", "8"],
      string_term: 'oops, I used a string instead of an array',
      logged_audit_status: "Audits have not yet been run on this file"
    }
  end
  before do
    view.lookup_context.prefixes.push 'hyrax/base'
    allow(view).to receive(:can?).with(:edit, SolrDocument).and_return(false)
    allow(ability).to receive(:can?).with(:edit, SolrDocument).and_return(false)
    allow(presenter).to receive(:audit_status).and_return(mock_metadata)
    assign(:presenter, presenter)
    assign(:document, solr_doc)
    assign(:audit_status, "none")
  end

  describe 'title heading' do
    before do
      stub_template 'shared/_title_bar.html.erb' => 'Title Bar'
      stub_template 'shared/_citations.html.erb' => 'Citation'
      render
    end
    it 'shows the title' do
      expect(rendered).to have_selector 'h1', text: 'My Title'
    end
  end

  it "does not render single-use links" do
    expect(rendered).not_to have_selector('table.single-use-links')
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
hyrax-1.1.1 spec/views/hyrax/file_sets/show.html.erb_spec.rb
hyrax-1.1.0 spec/views/hyrax/file_sets/show.html.erb_spec.rb
hyrax-1.0.5 spec/views/hyrax/file_sets/show.html.erb_spec.rb
hyrax-1.0.4 spec/views/hyrax/file_sets/show.html.erb_spec.rb
hyrax-1.0.3 spec/views/hyrax/file_sets/show.html.erb_spec.rb
hyrax-1.0.2 spec/views/hyrax/file_sets/show.html.erb_spec.rb
hyrax-1.0.1 spec/views/hyrax/file_sets/show.html.erb_spec.rb
hyrax-1.0.0.rc2 spec/views/hyrax/file_sets/show.html.erb_spec.rb
hyrax-1.0.0.rc1 spec/views/hyrax/file_sets/show.html.erb_spec.rb
test_hyrax-0.0.1.alpha spec/views/hyrax/file_sets/show.html.erb_spec.rb