Sha256: 9663c8eef907125ebea358a266707897a2f0beed1f1c0792c4a6a28ec795bc3c

Contents?: true

Size: 929 Bytes

Versions: 10

Compression:

Stored size: 929 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, 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, 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

10 entries across 10 versions & 1 rubygems

Version Path
blacklight-spotlight-0.23.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.22.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.21.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.20.3 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.20.2 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.20.1 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.20.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.19.2 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.19.1 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.19.0 spec/controllers/spotlight/view_configurations_controller_spec.rb