Sha256: 989a07f6462e5068e6756bc9907eec5b585a77fec89ef81f2439b5bc94dbf697

Contents?: true

Size: 1.17 KB

Versions: 24

Compression:

Stored size: 1.17 KB

Contents

# frozen_string_literal: true

RSpec.describe 'Catalog controller', type: :routing do
  describe 'routing' do
    routes { Spotlight::Engine.routes }

    it 'routes to #show with a format' do
      expect(get('/1/catalog/dq287tq6352.xml')).to route_to('spotlight/catalog#show', exhibit_id: '1', id: 'dq287tq6352', format: 'xml')
    end

    it 'routes to #edit' do
      expect(get('/1/catalog/dq287tq6352/edit')).to route_to('spotlight/catalog#edit', exhibit_id: '1', id: 'dq287tq6352')
    end

    it 'routes to #manifest' do
      expect(get('/1/catalog/1-1/manifest.json')).to route_to('spotlight/catalog#manifest', exhibit_id: '1', id: '1-1', format: 'json')
    end

    context 'when the routing constraint is set to allow periods' do
      before do
        allow(Spotlight::Engine.config.routes).to receive(:solr_documents).and_return(constraints: { id: %r{[^/]+} })
        Rails.application.reload_routes!
      end

      after do
        Rails.application.reload_routes!
      end

      it 'routes to #show as expected' do
        expect(get('/1/catalog/gallica.bnf.fr')).to route_to('spotlight/catalog#show', exhibit_id: '1', id: 'gallica.bnf.fr')
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

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