Sha256: aaa0fdac9149489ea57c25be252fbfc8ad6fcc517f5af8389892317e9ef1eab2

Contents?: true

Size: 1.48 KB

Versions: 5

Compression:

Stored size: 1.48 KB

Contents

describe 'collections/show.html.erb', type: :view do
  let(:document) { SolrDocument.new(id: 'xyz123z4',
                                    'title_tesim' => ['Make Collections Great Again']) }
  let(:ability) { double }
  let(:presenter) { Sufia::CollectionPresenter.new(document, ability) }
  let(:blacklight_config) { CatalogController.blacklight_config }
  let(:blacklight_configuration_context) do
    Blacklight::Configuration::Context.new(controller)
  end

  before do
    allow(view).to receive(:blacklight_config).and_return(blacklight_config)
    allow(view).to receive(:blacklight_configuration_context).and_return(blacklight_configuration_context)
    allow(document).to receive(:hydra_model).and_return(::Collection)
    allow(controller).to receive(:current_user).and_return(stub_model(User))
    allow(view).to receive(:can?).with(:edit, document).and_return(true)
    allow(view).to receive(:can?).with(:destroy, document).and_return(true)
    assign(:presenter, presenter)
    stub_template '_search_form.html.erb' => 'search form'
    stub_template 'collections/_sort_and_per_page.html.erb' => 'sort and per page'
    stub_template 'collections/_document_list.html.erb' => 'document list'
    stub_template 'collections/_paginate.html.erb' => 'paginate'
    render
  end

  it 'draws the page' do
    expect(rendered).to have_selector 'h2', text: 'Actions'
    expect(rendered).to have_link 'Edit'
    expect(rendered).to have_link 'Delete'
    expect(rendered).to have_link 'Add works'
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sufia-7.1.0 spec/views/collections/show.html.erb_spec.rb
sufia-7.0.0 spec/views/collections/show.html.erb_spec.rb
sufia-7.0.0.rc2 spec/views/collections/show.html.erb_spec.rb
sufia-7.0.0.rc1 spec/views/collections/show.html.erb_spec.rb
sufia-7.0.0.beta4 spec/views/collections/show.html.erb_spec.rb