Sha256: f43f9442f1666353964e7e4c830cfec42ad586ce440144b9d89d761cc70790a7

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

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

  before do
    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

2 entries across 2 versions & 1 rubygems

Version Path
curation_concerns-0.5.0 spec/views/collections/_sort_and_per_page.html.erb_spec.rb
curation_concerns-0.4.0 spec/views/collections/_sort_and_per_page.html.erb_spec.rb