Sha256: 55c2df2b88975028843478f85b252aba2c506a288b6701f607ef2768a6f0dfc3

Contents?: true

Size: 1.61 KB

Versions: 24

Compression:

Stored size: 1.61 KB

Contents

# frozen_string_literal: true

describe 'spotlight/searches/edit.html.erb', type: :view do
  let(:blacklight_config) do
    Blacklight::Configuration.new do |config|
      config.add_facet_field :some_field
    end
  end
  let(:exhibit) { FactoryBot.create(:exhibit) }
  let(:search) do
    stub_model(Spotlight::Search, exhibit: exhibit,
                                  id: 99, title: 'Title1', query_params: { f: { 'some_field' => ['xyz'] } })
  end

  before do
    allow(view).to receive(:search_action_path).and_return('/search')
    allow(view).to receive(:mastheads_path).and_return('/mastheads')
    allow(view).to receive(:featured_images_path).and_return('/featured_images')
    allow(view).to receive(:exhibit_search_path).and_return('/search')
    allow(view).to receive(:exhibit_searches_path).and_return('/searches')
    allow(view).to receive(:blacklight_config).and_return(blacklight_config)
    allow(controller).to receive(:search_state_class).and_return(Blacklight::SearchState)

    assign(:exhibit, exhibit)
    assign(:search, search)
    allow(view).to receive(:current_exhibit).and_return(exhibit)
  end

  it 'renders a form w/ the appropriate autocomplete data attribute' do
    render
    expect(rendered).to have_selector 'form[data-autocomplete-exhibit-catalog-path]'
  end

  it 'renders active search constraints' do
    render
    expect(rendered).to have_selector '.appliedParams .constraint-value'
    expect(rendered).to have_selector '.appliedParams .constraint-value .filter-name', text: 'Some Field'
    expect(rendered).to have_selector '.appliedParams .constraint-value .filter-value', text: 'xyz'
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
blacklight-spotlight-3.4.0 spec/views/spotlight/searches/edit.html.erb_spec.rb
blacklight-spotlight-3.3.0 spec/views/spotlight/searches/edit.html.erb_spec.rb
blacklight-spotlight-3.2.0 spec/views/spotlight/searches/edit.html.erb_spec.rb
blacklight-spotlight-3.1.0 spec/views/spotlight/searches/edit.html.erb_spec.rb
blacklight-spotlight-3.0.3 spec/views/spotlight/searches/edit.html.erb_spec.rb
blacklight-spotlight-3.0.2 spec/views/spotlight/searches/edit.html.erb_spec.rb
blacklight-spotlight-3.0.1 spec/views/spotlight/searches/edit.html.erb_spec.rb
blacklight-spotlight-3.0.0 spec/views/spotlight/searches/edit.html.erb_spec.rb
blacklight-spotlight-3.0.0.rc6 spec/views/spotlight/searches/edit.html.erb_spec.rb
blacklight-spotlight-3.0.0.rc5 spec/views/spotlight/searches/edit.html.erb_spec.rb
blacklight-spotlight-3.0.0.rc4 spec/views/spotlight/searches/edit.html.erb_spec.rb
blacklight-spotlight-3.0.0.rc3 spec/views/spotlight/searches/edit.html.erb_spec.rb
blacklight-spotlight-3.0.0.rc2 spec/views/spotlight/searches/edit.html.erb_spec.rb
blacklight-spotlight-3.0.0.rc1 spec/views/spotlight/searches/edit.html.erb_spec.rb
blacklight-spotlight-3.0.0.alpha.10 spec/views/spotlight/searches/edit.html.erb_spec.rb
blacklight-spotlight-3.0.0.alpha.9 spec/views/spotlight/searches/edit.html.erb_spec.rb
blacklight-spotlight-3.0.0.alpha.8 spec/views/spotlight/searches/edit.html.erb_spec.rb
blacklight-spotlight-3.0.0.alpha.7 spec/views/spotlight/searches/edit.html.erb_spec.rb
blacklight-spotlight-3.0.0.alpha.6 spec/views/spotlight/searches/edit.html.erb_spec.rb
blacklight-spotlight-3.0.0.alpha.5 spec/views/spotlight/searches/edit.html.erb_spec.rb