Sha256: 25468b3294a8625606e587ada7dbda565d0b26bee1cc5a3f163fe4954299933c

Contents?: true

Size: 981 Bytes

Versions: 18

Compression:

Stored size: 981 Bytes

Contents

# frozen_string_literal: true

describe Spotlight::ViewConfigurationsController, type: :controller do
  routes { Spotlight::Engine.routes }
  let(:exhibit) { FactoryBot.create(:exhibit) }

  describe 'when the user is not authorized' do
    before do
      sign_in FactoryBot.create(:exhibit_visitor)
    end

    describe 'GET show' do
      it 'denies access' do
        get :show, params: { exhibit_id: exhibit }
        expect(response).to redirect_to main_app.root_path
        expect(flash[:alert]).to be_present
      end
    end
  end

  describe 'when signed in' do
    let(:user) { FactoryBot.create(:exhibit_admin, exhibit: exhibit) }
    before { sign_in user }

    describe 'GET show' do
      it 'is successful' do
        get :show, params: { exhibit_id: exhibit, format: 'json' }
        expect(response).to be_successful
        available = JSON.parse(response.body)
        expect(available).to match_array %w(list gallery slideshow)
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
blacklight-spotlight-3.0.0.alpha.2 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-3.0.0.alpha.1 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-2.13.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-2.12.1 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-2.12.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-2.11.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-2.10.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-2.9.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-2.8.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-2.7.2 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-2.7.1 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-2.7.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-2.6.1.1 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-2.6.1 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-2.6.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-2.5.2 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-2.5.1 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-2.5.0 spec/controllers/spotlight/view_configurations_controller_spec.rb