Sha256: f321d9fe07054ced56083974dd6d86bb7253bde3c1682b28ca0daf5f68bcd54f

Contents?: true

Size: 1.69 KB

Versions: 4

Compression:

Stored size: 1.69 KB

Contents

# -*- encoding : utf-8 -*-

require 'spec_helper'

describe InstitutionsHelper do

  include Blacklight::SearchHelper

  let(:blacklight_config) { CatalogController.blacklight_config }

  before :each do
    allow(helper).to receive_messages(blacklight_config: blacklight_config)
  end

  describe '#link_to_all_inst_items' do
    before { @institution_title = 'Foo Institution'}
    it 'should create a search link with the correct institution params' do
      expect(helper.link_to_all_inst_items('foo')).to include("#{blacklight_config.institution_field}%5D%5B%5D=Foo+Institution")
    end
  end

  describe 'render_institutions_index' do

    before { (@response, @document_list) = search_results({}) }

    describe 'with default document_index_view_type' do
      before { allow(helper).to receive_messages(document_index_view_type: :list) }
      subject { helper.render_institutions_index }
      it { should have_selector '#documents.documents-list' }
    end

    describe 'with "maps" document_index_view_type' do

      before do
        allow(helper).to receive_messages(blacklight_configuration_context: Blacklight::Configuration::Context.new(CatalogController.new))
        allow(helper).to receive_messages(document_index_view_type: :maps)
      end

      subject { helper.render_institutions_index }
      it { should have_selector 'div#institutions-index-map' }

    end

    # remove the instance variables so they don't mess up other specs
    after do
      remove_instance_variable(:@response)
      remove_instance_variable(:@document_list)
    end

  end

  describe '#should_render_inst_az?' do
    it 'should return false' do
     expect(helper.should_render_inst_az?).to be_falsey
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
commonwealth-vlr-engine-0.0.7 spec/helpers/institutions_helper_spec.rb
commonwealth-vlr-engine-0.0.4 spec/helpers/institutions_helper_spec.rb
commonwealth-vlr-engine-0.0.3 spec/helpers/institutions_helper_spec.rb
commonwealth-vlr-engine-0.0.2 spec/helpers/institutions_helper_spec.rb