Sha256: 3e8049067688b133b839a1366b63a0093a69be7f4f3b0ca5d631f56d42094cae

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

require 'spec_helper'

RSpec.describe 'thumbnail_highlights', js: true do
  fixture_path = File.join(NewspaperWorks::GEM_PATH, 'spec', 'fixtures', 'files')
  let(:query_term) { 'rotunda' }

  # use before(:all) so we only create fixtures once
  # we use instance var for @work so we can access its id in specs
  before(:all) do
    whitelist = Hyrax.config.whitelisted_ingest_dirs
    whitelist.push(fixture_path) unless whitelist.include?(fixture_path)

    @work = NewspaperPage.create!(
      title: ['Test Page for Thumbnail Highlights'],
      visibility: "open"
    )
    attachment = NewspaperWorks::Data::WorkFiles.of(@work)
    attachment.assign(File.join(fixture_path, 'page1.tiff'))
    attachment.derivatives.assign(File.join(fixture_path, 'ndnp-sample1-txt.txt'))
    attachment.derivatives.assign(File.join(fixture_path, 'ndnp-sample1-json.json'))
    attachment.commit!
    @work.save!
  end

  describe 'thumbnail highlighting' do
    it 'adds highlight divs to thumbnail' do
      visit search_catalog_path(q: 'rotunda scarcely')
      within "#document_#{@work.id}" do
        expect(page).to have_selector('.thumbnail_highlight', count: 2)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
newspaper_works-0.1.0 spec/features/search_results_thumbnail_highlights_spec.rb