Sha256: 0cd49d6456983234a8175b22df36c99c9ea70ad5005788eeac8ddb927b96fa7c

Contents?: true

Size: 951 Bytes

Versions: 9

Compression:

Stored size: 951 Bytes

Contents

require 'spec_helper'
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

9 entries across 9 versions & 1 rubygems

Version Path
blacklight-spotlight-0.18.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.17.1 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.17.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.16.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.15.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.14.2 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.14.1 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.14.0 spec/controllers/spotlight/view_configurations_controller_spec.rb
blacklight-spotlight-0.13.0 spec/controllers/spotlight/view_configurations_controller_spec.rb