Sha256: 0bbaee37a77495d7654aac8347ce971e1589a39706c473b38945f7a4812fc518
Contents?: true
Size: 1.13 KB
Versions: 7
Compression:
Stored size: 1.13 KB
Contents
# frozen_string_literal: true require 'spec_helper' RSpec.describe Blacklight::Document::GroupComponent, type: :component do subject(:component) { described_class.new(group: group, **attr) } 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(:docs) { 10.times.map { double } } let(:group) do instance_double(Blacklight::Solr::Response::Group, key: 'group1', field: 'group_field', total: 15, docs: docs) end before do allow(view_context).to receive(:render_document_index).with(docs).and_return('results') end it 'renders the group with a header' do expect(rendered).to have_css 'div.group' expect(rendered).to have_css 'h2', text: 'group1' expect(rendered).to have_no_link 'more' end it 'renders the group documents' do expect(rendered).to have_content 'results' end context 'with a limit applied' do let(:attr) { { group_limit: 5 } } it 'renders a control to see more results' do expect(rendered).to have_link 'more' end end end
Version data entries
7 entries across 7 versions & 2 rubygems