Sha256: f98a3a49ebae621559a351dc43c8089c46e017f31e0631817a5485a74795b860
Contents?: true
Size: 1.29 KB
Versions: 42
Compression:
Stored size: 1.29 KB
Contents
# frozen_string_literal: true require 'spec_helper' RSpec.describe Blacklight::Document::ActionComponent, type: :component do subject(:component) { described_class.new(document: document, action: action, **attr) } let(:action) { Blacklight::Configuration::ToolConfig.new(key: 'some_tool', name: 'some_tool', component: true) } let(:attr) { {} } let(:view_context) { controller.view_context } let(:render) do component.render_in(view_context) end let(:rendered) do Capybara::Node::Simple.new(render) end let(:document) do SolrDocument.new( id: 'x' ) end it 'renders an action link' do if Rails.version >= '6' allow(view_context).to receive(:some_tool_solr_document_path).with(document, { only_path: true }).and_return('/asdf') else allow(view_context).to receive(:some_tool_solr_document_path).with(document).and_return('/asdf') end expect(rendered).to have_link 'Some tool', href: '/asdf' end context 'with a partial configured' do let(:action) { Blacklight::Configuration::ToolConfig.new(name: '', partial: '/some/tool') } it 'render the partial' do allow(view_context).to receive(:render).with(hash_including(partial: '/some/tool')).and_return('tool') expect(rendered).to have_content 'tool' end end end
Version data entries
42 entries across 41 versions & 2 rubygems