Sha256: a4b79de95265f2c35c2729113a8e295cb714eb8ffbf5029b56bcbfe70adfbb86

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'

describe CurationConcern::PermissionsController do
  let(:user) { FactoryGirl.create(:user) }
  before { sign_in user }

  describe "#confirm" do
    let(:generic_work) { FactoryGirl.create(:generic_work, user: user) }

    it "should draw the page" do
      get :confirm, id: generic_work
      expect(response).to be_success
    end
  end

  describe "#copy" do
    let(:generic_work) { FactoryGirl.create(:generic_work, user: user) }

    it "should add a worker to the queue" do
      worker = double
      VisibilityCopyWorker.should_receive(:new).with(generic_work.pid).and_return(worker)
      Sufia.queue.should_receive(:push).with(worker)
      post :copy, id: generic_work
      expect(response).to redirect_to controller.polymorphic_path([:curation_concern, generic_work])
      expect(flash[:notice]).to eq 'Updating file permissions. This may take a few minutes. You may want to refresh your browser or return to this record later to see the updated file permissions.'
    end
  end

end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
worthwhile-0.0.1 spec/controllers/curation_concern/permissions_controller_spec.rb
curate-0.6.6 spec/controllers/curation_concern/permissions_controller_spec.rb