Sha256: 6199d8c6ad4cb4968261c4fc4d566ecf6a03fcc604085b2dd6456cdd676a5bed
Contents?: true
Size: 1.42 KB
Versions: 13
Compression:
Stored size: 1.42 KB
Contents
# frozen_string_literal: true RSpec.describe "catalog/_show_tools.html.erb" do let(:document) { SolrDocument.new id: 'xyz', format: 'a' } let(:blacklight_config) { Blacklight::Configuration.new } let(:component) { instance_double(Blacklight::Document::ShowToolsComponent) } before do allow(Blacklight::Document::ShowToolsComponent).to receive(:new).and_return(component) allow(view).to receive(:render).with(component) allow(view).to receive(:render).with('catalog/show_tools', { document: document }).and_call_original allow(view).to receive_messages(blacklight_config: blacklight_config, has_user_authentication_provider?: false) end describe "document actions" do let(:document_actions) { blacklight_config.show.document_actions } it "renders a document action" do allow(view).to receive(:some_action_solr_document_path).with(document, any_args).and_return 'x' document_actions[:some_action] = Blacklight::Configuration::ToolConfig.new key: :some_action, name: :some_action, partial: 'document_action' render 'catalog/show_tools', document: document expect(view).to have_received(:render).with(component) end context 'without any document actions defined' do before do document_actions.clear end it 'does not display the tools' do render 'catalog/show_tools', document: document expect(rendered).to be_blank end end end end
Version data entries
13 entries across 13 versions & 2 rubygems