Sha256: 637e77a0aa6106e2e15dd7297c48421bdd4e61eac84c54feab21153792d90a9a

Contents?: true

Size: 1.37 KB

Versions: 1

Compression:

Stored size: 1.37 KB

Contents

require 'spec_helper'

module Spotlight
  describe "shared/_header_navbar", :type => :view do
    let(:current_exhibit) { FactoryGirl.create(:exhibit) }
    let(:masthead) { 'exhibit-masthead' }
    let(:navbar) { 'exhibit-navbar' }
    let(:breadcrumbs) { 'exhibit-breadcrumbs' }
    before do
      stub_template '_user_util_links.html.erb' => 'links'
      stub_template 'shared/_exhibit_masthead.html.erb' => masthead
      stub_template 'shared/_exhibit_navbar.html.erb' => navbar
      stub_template 'shared/_breadcrumbs.html.erb' => breadcrumbs
      allow(view).to receive_messages(exhibit_masthead?: true)
      allow(view).to receive_messages(current_exhibit: current_exhibit)
    end
    it 'should render the masthead above the navbar' do
      render
      expect(rendered.index(masthead)).to be < rendered.index(navbar)
    end
    it 'should render the navbar above the search masthead' do
      allow(view).to receive_messages(exhibit_masthead?: false)
      render
      expect(rendered.index(navbar)).to be < rendered.index(masthead)
    end
    it 'should render the breadcrumbs' do
      render
      expect(rendered).to have_content(breadcrumbs)
    end
    it 'should not render breadcrumbs when there is a search masthead' do
      allow(view).to receive_messages(exhibit_masthead?: false)
      render
      expect(rendered).to_not have_content(breadcrumbs)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blacklight-spotlight-0.4.1 spec/views/shared/_header_navbar.html.erb_spec.rb