Sha256: a9bd888c8925cef0c6b099177625b09b492c0da37cc77e3e08758e2f64804843

Contents?: true

Size: 950 Bytes

Versions: 24

Compression:

Stored size: 950 Bytes

Contents

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

24 entries across 24 versions & 1 rubygems

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