Sha256: 907595285a9d8875124d777bec46a218b97ffc7f36a38bb04a3c0c2937bfc6a8

Contents?: true

Size: 1.49 KB

Versions: 24

Compression:

Stored size: 1.49 KB

Contents

describe Spotlight::MetaHelper, type: :helper do
  describe '#add_exhibit_meta_content' do
    let(:current_exhibit) { FactoryBot.create(:exhibit) }
    before do
      allow(helper).to receive_messages(current_exhibit: current_exhibit)
      allow(helper).to receive(:site_title).and_return('some title')
      current_exhibit.subtitle = 'xyz'
      current_exhibit.description = 'abc'
      TopHat.current['twitter_card'] = nil
      TopHat.current['opengraph'] = nil
    end

    it 'generates a twitter card for the exhibit' do
      allow(helper).to receive(:exhibit_root_url).and_return('some/url')
      allow(current_exhibit).to receive(:thumbnail).and_return(double(iiif_url: 'https://test.host/images/7777/full/400,300/0/default.jpg'))

      helper.add_exhibit_meta_content

      card = helper.twitter_card
      expect(card).to have_css "meta[name='twitter:card'][value='summary']", visible: false
      expect(card).to have_css "meta[name='twitter:url'][value='some/url']", visible: false
      expect(card).to have_css "meta[name='twitter:title'][value='#{current_exhibit.title}']", visible: false
      expect(card).to have_css "meta[name='twitter:description'][value='#{current_exhibit.subtitle}']", visible: false
      expect(card).to have_css "meta[name='twitter:image'][value='https://test.host/images/7777/full/400,300/0/default.jpg']", visible: false

      graph = helper.opengraph
      expect(graph).to have_css "meta[property='og:site_name'][content='some title']", visible: false
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
blacklight-spotlight-2.4.1 spec/helpers/spotlight/meta_helper_spec.rb
blacklight-spotlight-2.4.0 spec/helpers/spotlight/meta_helper_spec.rb
blacklight-spotlight-2.3.3 spec/helpers/spotlight/meta_helper_spec.rb
blacklight-spotlight-2.3.2 spec/helpers/spotlight/meta_helper_spec.rb
blacklight-spotlight-2.3.1 spec/helpers/spotlight/meta_helper_spec.rb
blacklight-spotlight-2.3.0 spec/helpers/spotlight/meta_helper_spec.rb
blacklight-spotlight-2.2.1 spec/helpers/spotlight/meta_helper_spec.rb
blacklight-spotlight-2.2.0 spec/helpers/spotlight/meta_helper_spec.rb
blacklight-spotlight-2.1.0 spec/helpers/spotlight/meta_helper_spec.rb
blacklight-spotlight-2.0.2 spec/helpers/spotlight/meta_helper_spec.rb
blacklight-spotlight-2.0.1 spec/helpers/spotlight/meta_helper_spec.rb
blacklight-spotlight-2.0.0 spec/helpers/spotlight/meta_helper_spec.rb
blacklight-spotlight-2.0.0.rc6 spec/helpers/spotlight/meta_helper_spec.rb
blacklight-spotlight-2.0.0.rc5 spec/helpers/spotlight/meta_helper_spec.rb
blacklight-spotlight-2.0.0.rc4 spec/helpers/spotlight/meta_helper_spec.rb
blacklight-spotlight-2.0.0.rc3 spec/helpers/spotlight/meta_helper_spec.rb
blacklight-spotlight-2.0.0.rc2 spec/helpers/spotlight/meta_helper_spec.rb
blacklight-spotlight-2.0.0.rc1 spec/helpers/spotlight/meta_helper_spec.rb
blacklight-spotlight-1.5.1 spec/helpers/spotlight/meta_helper_spec.rb
blacklight-spotlight-1.4.1 spec/helpers/spotlight/meta_helper_spec.rb