Sha256: 66146304ae5a820d65b2bf0ea814bac57a03ad430d23bda9a546e4aa832f6ee7

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'
RSpec.describe 'hyrax/newspaper_titles/_issue_search_form.html.erb', type: :view do
  let(:presenter) { double }

  before do
    allow(view).to receive(:search_form_action).and_return("/catalog")
    allow(view).to receive(:search_state).and_return(search_state)
    allow(view).to receive(:current_search_parameters).and_return(nil)
    allow(view).to receive(:current_user).and_return(nil)

    allow(presenter).to receive(:title_search_params).and_return(f: { "publication_title_ssi" => ["Wall Street Journal"] })
    assign(:presenter, presenter)
    render
  end
  let(:search_state) { double('SearchState', params_for_search: {}) }
  let(:page) { Capybara::Node::Simple.new(rendered) }

  it "has a hidden `f[publication_title_ssi][]` form field" do
    expect(page).to have_selector("[name='f\[publication_title_ssi\]\[\]'][value='Wall Street Journal']", visible: false)
  end

  it "has hidden `all_fields` form field" do
    expect(page).to have_selector("[name='search_field'][value='all_fields']", visible: false)
  end

  it "has a `q` form field for query" do
    expect(page).to have_field("q")
  end

  it "has a checkbox to limit to front pages" do
    expect(page).to have_field("f_first_page_bsi_")
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
newspaper_works-1.0.1 spec/views/hyrax/newspaper_titles/_issue_search_form.html.erb_spec.rb
newspaper_works-1.0.0 spec/views/hyrax/newspaper_titles/_issue_search_form.html.erb_spec.rb
newspaper_works-0.1.0 spec/views/hyrax/newspaper_titles/_issue_search_form.html.erb_spec.rb