Sha256: 11f4e28127bdaf891f18c43e4fabca58a4d8b632027bba8755cfe46e4103bedd

Contents?: true

Size: 953 Bytes

Versions: 23

Compression:

Stored size: 953 Bytes

Contents

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

  describe 'when the user is not authorized' do
    before do
      sign_in FactoryGirl.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) { FactoryGirl.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

23 entries across 23 versions & 1 rubygems

Version Path
blacklight-spotlight-1.0.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-1.0.0.alpha2 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-1.0.0.alpha1 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.34.1 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.34.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.33.3 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.33.2 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.33.1 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.33.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.32.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.31.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.30.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.29.1 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.29.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.28.3 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.28.2 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.28.1 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.28.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.27.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.26.1 spec/controllers/spotlight/view_configurations_controller_spec.rb