Sha256: 9a81e36c66facd91b383f9502ee6b1ea803dba13dd482e56a0cbefa5dbe91786

Contents?: true

Size: 1.3 KB

Versions: 8

Compression:

Stored size: 1.3 KB

Contents

require "rails_helper.rb"
require "pundit/rspec"

describe "items/index" do
  before(:each) do
    @items = assign(:items,
      Kaminari.paginate_array( [
        FactoryBot.create(:item),
      ], total_count: 1).page(1)
    )
    facet1 = double("Facet for available on shelf")
    allow(facet1).to receive(:count).and_return(1)
    allow(facet1).to receive(:value).and_return("Available On Shelf")
    @circulation_status_facet = assign(:circulation_status_facet, [facet1])
    user = FactoryBot.create(:librarian)
    allow(view).to receive(:policy) do |record|
      Pundit.policy(user, record)
    end

    Item.reindex
  end

  describe "circulation_status facet", solr: true do
    it "should work with searching acquired_at fields" do
      view.stub(:filtered_params).and_return(ActionController::Parameters.new().permit)
      render
      expect(rendered).to have_selector "div#submenu ul li a"
      expect(rendered).to have_link "Available On Shelf (1)", href: "/items?circulation_status=Available+On+Shelf"
      view.stub(:filtered_params).and_return(ActionController::Parameters.new(acquired_from: '2012-01-01').permit([:acquired_from]))
      render
      expect(rendered).to have_link "Available On Shelf (1)", href: '/items?acquired_from=2012-01-01&circulation_status=Available+On+Shelf'
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
enju_circulation-0.3.11 spec/views/items/index.html.erb_spec.rb
enju_circulation-0.3.10 spec/views/items/index.html.erb_spec.rb
enju_circulation-0.3.9 spec/views/items/index.html.erb_spec.rb
enju_circulation-0.3.8 spec/views/items/index.html.erb_spec.rb
enju_circulation-0.3.7 spec/views/items/index.html.erb_spec.rb
enju_circulation-0.3.6 spec/views/items/index.html.erb_spec.rb
enju_circulation-0.3.5 spec/views/items/index.html.erb_spec.rb
enju_circulation-0.3.4 spec/views/items/index.html.erb_spec.rb