Sha256: 7bc7ebce95b00964ca20af66082df2643638eba53167d0127d6f42e865afcf33

Contents?: true

Size: 1.65 KB

Versions: 22

Compression:

Stored size: 1.65 KB

Contents

# frozen_string_literal: true

describe Spotlight::MastheadHelper, type: :helper do
  let(:exhibit) { FactoryBot.create(:exhibit) }
  let(:site) { Spotlight::Site.instance }

  before do
    allow(helper).to receive(:current_exhibit).and_return(nil)
    allow(helper).to receive(:current_site).and_return(site)
  end

  describe '#masthead_heading_content' do
    context 'when there is a current exhibit' do
      before { allow(helper).to receive(:current_exhibit).and_return(exhibit) }

      it { expect(helper.masthead_heading_content).to eq exhibit.title }
    end

    context 'when there is no current exhibit' do
      it { expect(helper.masthead_heading_content).to eq 'Blacklight' } # the application_name
    end
  end

  describe '#masthead_subheading_content' do
    context 'when there is a current exhibit' do
      before { allow(helper).to receive(:current_exhibit).and_return(exhibit) }

      context 'when the exhibit has a subtitle' do
        before { exhibit.subtitle = 'MastheadHelper Spec Exhibit' }

        it { expect(helper.masthead_subheading_content).to eq 'MastheadHelper Spec Exhibit' }
      end

      context 'when the exhibit does not have a subtitle' do
        it { expect(helper.masthead_subheading_content).to be_nil }
      end
    end

    context 'when there is no current exhibit' do
      context 'when the site has a subtitle' do
        before { site.subtitle = "The site's subtitle" }

        it { expect(helper.masthead_subheading_content).to eq "The site's subtitle" }
      end

      context 'when the site does not have a subtitle' do
        it { expect(helper.masthead_subheading_content).to be_nil }
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
blacklight-spotlight-3.4.0 spec/helpers/spotlight/masthead_helper_spec.rb
blacklight-spotlight-3.3.0 spec/helpers/spotlight/masthead_helper_spec.rb
blacklight-spotlight-3.2.0 spec/helpers/spotlight/masthead_helper_spec.rb
blacklight-spotlight-3.1.0 spec/helpers/spotlight/masthead_helper_spec.rb
blacklight-spotlight-3.0.3 spec/helpers/spotlight/masthead_helper_spec.rb
blacklight-spotlight-3.0.2 spec/helpers/spotlight/masthead_helper_spec.rb
blacklight-spotlight-3.0.1 spec/helpers/spotlight/masthead_helper_spec.rb
blacklight-spotlight-3.0.0 spec/helpers/spotlight/masthead_helper_spec.rb
blacklight-spotlight-3.0.0.rc6 spec/helpers/spotlight/masthead_helper_spec.rb
blacklight-spotlight-3.0.0.rc5 spec/helpers/spotlight/masthead_helper_spec.rb
blacklight-spotlight-3.0.0.rc4 spec/helpers/spotlight/masthead_helper_spec.rb
blacklight-spotlight-3.0.0.rc3 spec/helpers/spotlight/masthead_helper_spec.rb
blacklight-spotlight-3.0.0.rc2 spec/helpers/spotlight/masthead_helper_spec.rb
blacklight-spotlight-3.0.0.rc1 spec/helpers/spotlight/masthead_helper_spec.rb
blacklight-spotlight-3.0.0.alpha.10 spec/helpers/spotlight/masthead_helper_spec.rb
blacklight-spotlight-3.0.0.alpha.9 spec/helpers/spotlight/masthead_helper_spec.rb
blacklight-spotlight-3.0.0.alpha.8 spec/helpers/spotlight/masthead_helper_spec.rb
blacklight-spotlight-3.0.0.alpha.7 spec/helpers/spotlight/masthead_helper_spec.rb
blacklight-spotlight-3.0.0.alpha.6 spec/helpers/spotlight/masthead_helper_spec.rb
blacklight-spotlight-3.0.0.alpha.5 spec/helpers/spotlight/masthead_helper_spec.rb