Sha256: b9f0cbd086b35866117fe07bf42c127058479b54e8850042575a44ec200e3b31

Contents?: true

Size: 1.15 KB

Versions: 62

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

describe 'collections/_sort_and_per_page.html.erb' do
  let(:collection) { double }
  let(:response) { double(response: { 'numFound' => 3 }) }
  let(:search_state) { double('SearchState', params_for_search: {}) }

  before do
    allow(view).to receive(:search_state).and_return(search_state)
    allow(view).to receive(:sort_fields).and_return(['title_sort', 'date_sort'])
    allow(view).to receive(:document_index_views).and_return(list: Blacklight::Configuration::ViewConfig.new)
    assign(:response, response)
  end

  context "when the action is edit" do
    before do
      controller.action_name = "edit"
    end
    it "renders the form with a button" do
      expect(view).to receive(:button_for_remove_selected_from_collection).with(collection)
      render 'collections/sort_and_per_page', collection: collection
    end
  end

  context "when the action is show" do
    before do
      controller.action_name = "show"
    end
    it "renders the form without a button" do
      expect(view).not_to receive(:button_for_remove_selected_from_collection)
      render 'collections/sort_and_per_page', collection: collection
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
curation_concerns-1.7.8 spec/views/collections/_sort_and_per_page.html.erb_spec.rb
curation_concerns-1.7.7 spec/views/collections/_sort_and_per_page.html.erb_spec.rb
curation_concerns-2.0.0 spec/views/collections/_sort_and_per_page.html.erb_spec.rb
curation_concerns-2.0.0.rc2 spec/views/collections/_sort_and_per_page.html.erb_spec.rb
curation_concerns-1.7.6 spec/views/collections/_sort_and_per_page.html.erb_spec.rb
curation_concerns-1.7.5 spec/views/collections/_sort_and_per_page.html.erb_spec.rb
curation_concerns-1.7.4 spec/views/collections/_sort_and_per_page.html.erb_spec.rb
curation_concerns-1.7.3 spec/views/collections/_sort_and_per_page.html.erb_spec.rb
curation_concerns-1.7.2 spec/views/collections/_sort_and_per_page.html.erb_spec.rb
curation_concerns-2.0.0.rc1 spec/views/collections/_sort_and_per_page.html.erb_spec.rb
curation_concerns-1.7.1 spec/views/collections/_sort_and_per_page.html.erb_spec.rb
curation_concerns-1.7.0 spec/views/collections/_sort_and_per_page.html.erb_spec.rb
curation_concerns-1.7.0.beta1 spec/views/collections/_sort_and_per_page.html.erb_spec.rb
curation_concerns-1.6.3 spec/views/collections/_sort_and_per_page.html.erb_spec.rb
curation_concerns-1.6.2 spec/views/collections/_sort_and_per_page.html.erb_spec.rb
curation_concerns-1.6.1 spec/views/collections/_sort_and_per_page.html.erb_spec.rb
curation_concerns-1.6.0 spec/views/collections/_sort_and_per_page.html.erb_spec.rb
curation_concerns-1.5.0 spec/views/collections/_sort_and_per_page.html.erb_spec.rb
curation_concerns-1.4.0 spec/views/collections/_sort_and_per_page.html.erb_spec.rb
curation_concerns-1.3.3 spec/views/collections/_sort_and_per_page.html.erb_spec.rb