Sha256: 9cb5d06efa7a518000f7250827bb9fcfe2c5677194a2c1a568a7c1c9fc3992e9
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
require 'spec_helper' describe Spotlight::Resources::UploadController, :type => :controller do routes { Spotlight::Engine.routes } let(:exhibit) { FactoryGirl.create(:exhibit) } describe "when not logged in" do describe "POST create" do it "should not be allowed" do post :create, exhibit_id: exhibit expect(response).to redirect_to main_app.new_user_session_path end end end describe "when signed in as a curator" do let(:user) { FactoryGirl.create(:exhibit_curator, exhibit: exhibit) } before {sign_in user } describe "POST create" do before do allow_any_instance_of(Spotlight::Resource).to receive(:reindex) end it "create a Spotlight::Resources::Upload resource" do post :create, exhibit_id: exhibit, resources_upload: { url: "url-data" } expect(assigns[:resource]).to be_persisted expect(assigns[:resource]).to be_a(Spotlight::Resources::Upload) end it 'should redirect to the item admin page' do post :create, exhibit_id: exhibit, resources_upload: { url: "url-data" } expect(flash[:notice]).to eq 'Object uploaded successfully.' expect(response).to redirect_to admin_exhibit_catalog_index_path(exhibit) end it 'should redirect to the upload form when the add-and-continue parameter is present' do post :create, exhibit_id: exhibit, "add-and-continue" => "true", resources_upload: { url: "url-data" } expect(flash[:notice]).to eq 'Object uploaded successfully.' expect(response).to redirect_to new_exhibit_resources_upload_path(exhibit) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
blacklight-spotlight-0.2.0 | spec/controllers/spotlight/resources/upload_controller_spec.rb |